Application of The Ring Theory in The Se 1
Application of The Ring Theory in The Se 1
of Digital Images
Abstract. Ring theory is one of the branches of the abstract algebra that has been
broadly used in images. However, ring theory has not been very related with image
arXiv:1402.4069v2 [cs.CV] 24 Nov 2014
segmentation. In this paper, we propose a new index of similarity among images using
Zn rings and the entropy function. This new index was applied as a new stopping
criterion to the Mean Shift Iterative Algorithm with the goal to reach a better seg-
mentation. An analysis on the peformance of the algorithm with this new stopping
criterion is carried out. The obtained results proved that the new index is a suitable
tool to compare images.
1 Introduction
Many techniques and algorithms have been proposed for digital image segmentation. Tradi-
tional segmentation such as thresholding, histograms or other conventional operations are
rigid methods. Automation of these classical approximations is difficult due to the complex-
ity in shape and variability within each individual object in the image.
The mean shift is a non-parametric procedure that has demostrated to be an extremely
versatile tool for feature analysis. It can provide reliable solutions for many computer vision
tasks [2]. Mean shift method was proposed in 1975 by Fukunaga and Hostetler [5]. It was
largely forgotten until Cheng’s paper retook interest on it [1]. Segmentation by means of
the Mean Shift Method carries out as a first step a smoothing filter before segmentation is
performed [2,3].
Entropy is an essential function in information theory and this has had a special uses for
images data, e.g., restoring images, detecting contours, segmenting images and many other
applications [12,15]. However, in the field of images the range of properties of this function
could be increased if the images are defined in Zn rings. The inclusion of the ring theory
to the spatial analysis is achieved considering images as a matrix in which the elements
belong to the cyclic ring Zn . From this point of view, the images presents cyclical properties
associated to gray level values.
Ring Theory has been well-used in cryptography and many others computer vision tasks
[18]. The inclusion of ring theory to the spatial analysis of digital images, it is achieved
considering the image like a matrix in which the elements belong to finite cyclic ring Zn .
The ring theory for the Mean Shift Iterative Algorithm was employed by defining images
in a ring Zn . A good performance of this algorithm was achieved. Therefore, the use of the
ring theory could be a good structure when one desires to compare images, due to that the
digital images present cyclical properties associated with the pixel values. This property will
allow to increase or to diminish the difference among pixels values, and will make possible
to find the edges in the analyzed images.
In this paper, a new similarity index among images is defined, and some interesting
properties based on this index are proposed. We compare also the instability of the iterative
mean shift algorithm (MSHi ) by using this new stopping criterion with regard to the stopping
criterion used in [8,9,10,11]. Furthermore, we make an extension of [7], and we expand the
theoretical aspects by studying in depth the cyclical properties of rings applied to images.
For this purpose, and in order to mark the difference of this paper with regard to [7], some
issues are pointed out below:
2
The remainder of the paper is organized as follows. In Section 2, the more significant
theoretical aspects of the mean shift and entropy are given. Section 3 describes the simi-
larity index, its consecuences for entropy function and the significance of the cyclic ring Zn
for images. Also, it is defined the quotient space of strongly equivalent images and some
properties of entropy are proved. The experimental results, comparisons and discussion are
presented in Section 4. Finally, in Section 5 the conclusions are given.
2 Theoretical Aspects
One of the most popular nonparametric density estimators is kernel density estimation.
Mathematically, the general multivariate kernel density estimate at the point x, is defined
by:
n
1 X x − xi
f (x) = K . (1)
nhd i=1 h
where K(z) is the d − variate kernel function with compact support satisfying the regularity
constraints as described in [16], and H is a symmetric positive definite bandwidth matrix.
For image segmentation, the feature space is composed of two independent domains: the
spatial/lattice domain and the range/color domain. We map a pixel to a multidimensional
feature point which includes the p dimensional spatial lattice (p = 2 for image) and q
dimensional color (q = 1 for gray scale images and q = 3 for color image and q > 3 for
multispectral image). Due to the different natures of the domains, the kernel is usually
broken into the product of two different radially symmetric kernels (subscript s is refer to
the spatial domain, and r to the color range):
! !
2 2
c x x
Khs ,hr (x) = ks kr (3)
(hs )p (hr )q hs hr
where x is a pixel, ks and kr are the profiles used in the two respective domains, hs and hr
are employed bandwidths in spatial − range domains and c is the normalization constant.
Using the equation (3), the kernel density estimator is:
n
! !
X 2 2
c x − x i x − x i
fˆ(x) = ks kr . (4)
n(hs )p (hr )q i=1 hs hr
3
As was shown in (3) and (4), there are two main parameters that have to be defined by the
user: the spatial bandwidth hs and the range bandwidth hr .
The Epanechnikov function is chosen as the kernel function in this work, this function is
defined as:
2
12 c−1
d (d + 2) 1 − kxk , if kxk < 1
KE (x) = (5)
0, otherwise.
n
b (x) = ∇fd 1 X b x − xi
∇f (x) = K , (6)
nhd i=1 h
1 d+2 X
b E (x) =
∇f (xi − x)
n(hd cd ) h2
xi ∈Sh (x)
nx d + 2 1 X
= (xi − x), (7)
n(hd cd ) h2 nx
xi ∈Sh (x)
1 X 1 X
Mh,U (x) = (xi − x) = xi − x (8)
nx nx
xi ∈Sh (x) xi ∈Sh (x)
| {z } | {z }
mean of shift values mean shift
nx
The quantity is the kernel density estimate fc
U (x) (where U means the uniform
n(hd cd )
kernel) computed with the hyper sphere Sh (x), and thus we can write the expression (7) as:
b E (x) = fc d+2
∇f U (x) Mh,U (x) (9)
h2
which yields,
h2 ∇fb E (x)
Mh,U (x) = . (10)
d + 2 fc
U (x)
Expression (10) shows that an estimate of the normalized gradient can be obtained by
computing the sample mean shift in a uniform kernel centered on x. In addition, the mean
shift has the gradient direction of the density estimate at point x. Since the mean shift
vector always points towards the direction of the maximum density increase, it can define a
path leading to a local density maximum; that is, toward the density mode.
A generalization to others kernels is achieved using profile definition and shadow kernel
definition. Moreover, a direct relationship settles down between the kernel used for mean
shift vector Mh (x) and the one used for the probabiity density function [1]. Profile and
4
shadow kernels are two suitable definitions to prove important and relevant properties for
kernels and mean shift vector.
In [2], it was proved that the obtained mean shift procedure by the following steps,
guarantees the convergence:
2.2 Entropy
Entropy is a measure of unpredictability or information content. In the space of the digital
images the entropy is defined as:
Definition 1 (Image Entropy). The entropy of the image A is defined by
B
2X −1
E(A) = − px log2 px , (11)
x=0
where B is the total quantity of bits of the digitized image A and p(x) is the probability of
occurrence of a gray-level value.
By agreement log2 (0) = 0 [13].Within a totally uniform region, entropy reaches the
minimum value. Theoretically speaking, the probability of occurrence of the gray-level value,
within a uniform region is always one. In practice, when one works with real images the
entropy value does not reach, in general, the zero value. This is due to the existent noise in
the image. Therefore, if we consider entropy as a measure of the disorder within a system,
it could be used as a good stopping criterion for an iterative process, by using MSHi . More
goodness on entropy applied to image segmentation algorithm can be seen in [9,15].
where E(·) is the function of entropy and the algorithm is stopped when ν(Ak , Ak−1 ) ≤ ǫ.
Here ǫ and k are respectively the threshold to stop the iterations and the number of iterations.
Definition 2 (Weak Equivalence in Images). Two images A and B are weakly equiva-
lents if E(A) = E(B). We denote the weak equivalence between A and B using A ≍ B.
The similarity index in (12) never consider the spatial information between the images
A and B. For this reason, it is possible to have two very different images and to obtain a
small value by using (12). This is a strong reason to consider that the similarity index (12)
is not appropriated to estimate the distance between two images.
Taking into account the issues raised above, it is necessary consider a new similarity
index based on the following conditions:
The two following subsections have been dedicated to how face this problem by means
of the employment of the ring theory.
It is natural to think that two images are similar if their subtraction is close to zero. The
problem of this idea is that, in general, when the subtraction gives negative values many
authors consider to truncate to zero these elements. This consideration, in general, it not
describe the difference between two images, and in some cases, it is possible to lose important
information. For this reason, it is necessary to define a structure such that the operations
between two images are intern.
Definition 3 (Zn Ring). The Zn ring is the partition of Z (set of integer numbers) in
which the elements are related by the congruence module n.
Mathematically speaking, we say that a is in the class of b (a ∈ Cb ) if a is related by (∼)
with b, where
def
a ∼ b ⇐⇒ a ≡ b(mod n) ⇐⇒ (b − a) ∈ nZ, where
nZ = {0, n, 2n, . . .} and n ∈ Z is fixed.
Proof. As the pixels of the image are in Zn , they satisfy the ring axioms. The operation
between two images was defined pixel by pixel, then it is trivial that Gk×m (Zn ) under the
operations (+, ·) of the Zn ring inherits the ring structure.
The following observations are important in order to understand the main features of
the ring Gk×m (Zn )(+, ·):
– The neutral element for the sum is the image with all pixels have zero value, it is denoted
by O.
– Note that the image with all pixel values are equal to one (I) is the neutral element
respect to the multiplication, (observe that the multiplication between two images was
defined element by element).
– If A ∈ Gk×m (Zn )(+, ·) then E(A) = E(−A), where −A is the additive inverse of A in
Gk×m (Zn )(+, ·).
Working with images with coefficients in Zn , one has a better way to analyze images,
and the cyclical effect opens a new way that largely reflects the resemblance of a gray level
of a pixel with regarding its neighbors.
6
Definition 4 (Strong Equivalence in Images). Two images A, B ∈ Gk×m (Zn )(+, ·) are
strongly equivalents if
A = S + B,
where S is a scalar image. We denote the strong equivalence between A and B as A ∼
= B.
Note that if A = S + B ⇒ ∃ S | B = S + A and S = −(S), where −(S) is the additive
inverse of S in the ring. This is calculated using the inverse of each pixels of S in Zn .
Theorem 2. If two images A and B are strongly equivalents then they are weakly equiva-
lents.
Proof. If A and B are strongly equivalents then A = S + B where S is a scalar image. Then
E(A) = E(S + B) but S is a scalar image and for this reason the sum S + B only change
in B the intensity of each pixel, but this does not change the number of different intensities
or the frequency of each intensity in the image. Then, E(S + B) = E(B). Finally we obtain
that E(A) = E(B) and they are weakly equivalents.
Note that the shown images in Figure 1 are weakly equivalents, but they are not strongly
equivalents. This is an example that A ≍ B ; A ∼ = B. In general, it is important to
understand that two images strongly equivalents have the same histogram of frecuency,
except for one uniform traslation of all gray levels.
Consider the next example to see the importance of the ring theory in the operations
among images. The image in Figure 2(a) has a histogram of frecuency that is shown in Figure
2(b). If it is compute the addition and subtraction of the Figure 2(a) by a scalar image S
(where S has all pixels equal to 100), using the ring theory are obtained the histograms of
frecuency that are shown in Figure 2(c) and Figure 2(d).
Note that the effect of this operations only changes the value of the pixels but do not
changes the frecuency or the number of gray levels. In fact, graphically it is possible to see
that the addition or subtraction in the ring only generates a shift in the frequency histogram,
so, the images with the frecuency histogram in Figure 2(c) and Figure 2(d), have the same
properties and information that the original image in Figure 2(a). On the other hand, if we
consider the classic addition and subtraction among images, it is easy to see in Figure 2(e)
7
and Figure 2(f) that important information is lost due to the effect of truncation. In fact,
this effect causes that high frequencies have been accumulated in 255 in the addition case
and in 0 in the subtraction case (see Figures 2(e) and 2(f)).
Based on the above aspects, it is interesting to define the equivalence classes among
images based on the concept of strong equivalence. This definition is necessary because the
strong equivalent images has the same information, but from the point of view of intesity
pixel, they do not have to be identically equal. In such sense, we will define the quotient
group containing images in equivalent classes.
It is natural to consider the definition of the similarity index using the quotient space
of the images by using strong equivalent images, considering the given equivalence classes
above. For this reason, it is necessary to proof that the quotient space exists. More precisely,
as strong equivalent images have been defined by the addition operation, the quotient group
will be built on this operation.
Theorem 3. The set N = {S ∈ Gk×m (Zn )(+, ·), S is a scalar image} is a normal (or
invariant) subgroup of Gk×m (Zn )(+, ·).
Proof. First we will show that the set N is a subgroup of Gk×m (Zn )(+, ·).
We have proved that N is a subgroup of Gk×m (Zn )(+, ·), only remains to prove that N is
normal. For this purpose we use that N is a normal subgroup of G if ∀g ∈ G, g + N = N + g
(see [17,18,19] for more details).
Gk×m (Zn )(+, ·)
Let A ∈ and S ∈ N , let us define B = A + S where bi,j = ai,j + si,j ∀i, j.
N
But, we know that Zn is abelian, therefore Gk×m (Zn )(+, ·) is abelian too, so, bi,j = si,j +
ai,j ∀i, j, ⇒ B = S + A. Finally A + S = S + A.
With the last result, it was proved that the quotient space is well-defined, and it will
Gk×m (Zn )(+, ·)
be denoted by . Remember that the elements of this quotient space are the
N
equivalence classes. Now, it does not matter which element of the class is chosen to carry
out the operation, since any of these images are a representative element of its respective
equivalence class.
Definition 6 (Natural Entropy Distance). Let CA and CB be two elements in the quo-
Gk×m (Zn )(+, ·)
tient space , A1 ∈ CA and B1 ∈ CB are images. The Natural Entropy
N
Distance (NED) between A1 and B1 is defined by
The “Natural Entropy Distance” have the following properties related with the axioms
of distance:
8
1. Non-Negativity: ν̂(A1 , B1 ) ≥ 0.
Since entropy function is always positive, then
If it are considered the images of Figure 1, applying the natural entropy distance the
result shows that:
With this result, one can appreciate that have been differentiated images, including the
spatial information too. The similarity index that was proposed in (13) is very simple and
computationally efficient.
stability in the segmentation process. For this aim, we used three different images for the
experiments, which have been chosen according to the differences among their respective
levels of high and low frequencies. The first image (“Bird”) has low frequencies, the second
(“Baboon”) has high frequencies and in the image (“Montage”) has mixture low and high
frequencies.
All segmentation experiments were carried out by using a uniform kernel. In order to be
effective the comparison between the old stopping criterion and the new stopping criterion,
we use the same value of hr and hs in MSHi (hr = 12, hs = 15). The value of hs is related
to the spatial resolution of the analysis, while the value hr defines the range resolution. In
the case of the new stopping criterion, we use the stopping threshold ǫ = 0.9 and when the
old stopping criterion was used ǫ = 0.01.
Figure 4 shows the segmentation of the three images. Observe that, in all cases, the
MSHi had better result when the new stopping criterion was used.
Bird Baboom Montage
Fig. 4: Segmentation of the experimental images. In the first row are shown the segmentation
using the new stopping criterion and in the secound row are the segmented images using the
old When
stopping
onecriterion.
compares Figures 4(a) and 4(d), in the part corresponding to the face or
breast of the bird, more homogeneous area, with the new stopping criterion was obtained
10
(see arrows in Figure 4(d)). Observe that, with the old stopping criterion the segmentation
gives regions where different gray levels are originated. However, these regions really should
have only one gray level. For example, Figure 4(b) and 4(e) show that the segmentation is
more homogeneous when the new stopping criterion was used (see the arrows). In the case
of the “Montage” image one can see that, in Figure 4(f) exists many regions that contains
different gray levels when these regions really should have one gray level (see for example
the face of Lenna, the circles and the breast of the bird). These good results are obtained
because the defined new stopping criterion through the natural distance among images in
expression (14) offers greater stability to the MSHi .
Figure 5 shows the profile of the obtained segmented images by using the two stopping
criterion. The plates that appear in Figure 5(b) and 5(d) are indicative of equal intensity
levels. In both graphics the abrupt falls of an intensity to other represent the different
regions in the segmented image. Note that, in Figure 5(b) exists, in the same region of
the segmentation, least variation of the pixel intensities with regard to Figure 5(d). This
illustrates that, in this case the segmentation was better when the new stopping criterion
was used.
(a) New Criterion (b) Profile (c) Old Criterion (d) Profile
Fig. 5: An intensity profile through of a segmented image. Profile is indicated by a line. (a)
and (c) are the segmented images and (b) and (d) are the profile of (a) and (c) respectively.
Figure 6 shows the performance of the two stopping criterion in the experimental images.
In the “x” axis appears the iterations of MSHi and in the “y” axis is shown the obtained
values by the stopping criterion in each iteration of the algorithm.
Fig. 6: Behavior of the stability of each algorithm according to the test images.
11
The graphics of iterations of the new stopping criterion (Figure 6(a), 6(b), 6(c)) show
a smoother behavior; that is, the new stopping criterion has a stable performance through
the MSHi . The new stopping criterion not only has good theoretical properties, but also, in
the practice, has very good behavior.
On the other hand, if we analyze the old stopping criterion in the experimental images
(Figure 6(d), 6(e), 6(f)), one can see that the performance in the MSHi is unstable. In
general, we have this type of situation when the stopping criterion defined in (12) is used.
This can originate bad segmented images.
5 Conclusions
In this work, a new stopping criterion, for the iterative MSHi , based on the Ring Theory was
proposed. The new stopping criterion establishes a new measure for the comparison of two
images based on the use of the entropy concept and the spatial information. The quotient
space was defined using the equivalent classes of images, to be able of selecting any element
of the class. Through the obtained theoretical and practical results, it was possible to prove
that the new stopping criterion had very good performance in the algorithm MSHi , and was
more stable that the old criterion.
References
1. Y. Cheng, “Mean Shift, Mode Seeking, and Clustering”, IIEEE Trans. on Pattern Analysis and
Machine Intelligence Ph. D. Thesis, New York University, 17 (8) (1995), pp. 790–799.
2. D. I. Comaniciu, “Nonparametric Robust Method for Computer Vision. ,”Ph. D. Thesis, Rutgers,
The State University of New Jersey, (2000).
3. D. Comaniciu, P. Meer, “Mean Shift: A Robust Approach toward Feature Space Analysis”, IEEE
Trans. on Pattern Analysis and Machine Intelligence Ph. D. Thesis, New York University, 24(5)
(1974).
4. D. Dominguez and R. Rodriguez, “Convergence of the Mean Shift using the Linfinity Norm in
Image Segmentation,” International Journal of Pattern Recognition Research, 1 (2011) pp. 3–4.
5. K. Fukunaga and L. D. Hostetler,, “The Estimation of the Gradient of a Density Function,”
IEEE Trans. on Information Theory, IT-21(1) (1975) pp. 32–40.
6. T. Grenier, C. Revol-Muller, F. Davignon, and G. Gimenez, “Hybrid Approach for Multipara-
metric Mean Shift Filtering”, IEEE Image Processing, International Conference, Atlanta, GA,
17(8) (2006) pp. 8–11.
7. Y. Garces, E. Torres, O. Pereira, C. Perez, R. Rodriguez: Stopping Criterion for the
Mean Shift Iterative Algorithm, Springer, Progress in Pattern Recognition, Image Analysis, Com-
puter Vision, and Applications, Lecture Notes in Computer Science, Vol. 8258, pp. 383–390, 2013.
8. R. Rodriguez, E. Torres, and J. H. Sossa, “Image Segmentation based on an Iterative Compu-
tation of the Mean Shift Filtering for different values of window sizes,” International Journal of
Imaging and Robotics, 6 (2011) pp. 1–19.
9. R. Rodriguez, A. G. Suarez, and J. H. Sossa, “A Segmentation Algorithm based on an Iterative
Computation of the Mean Shift Filtering,” Journal Intelligent & Robotic System, 63(3-4) (2011),
pp. 447–463.
10. R. Rodriguez, E. Torres, and J. H. Sossa, “Image Segmentation via an Iterative Algorithm of
the Mean Shift Filtering for Different Values of the Stopping Threshold,” International Journal
of Imaging and Robotics, 63 (2012), pp. 1–19.
11. R. Rodriguez, “Binarization of medical images based on the recursive application of mean
shift filtering: Another algorithm,” Journal of Advanced and Applications in Bioinformatics and
Chemistry, Dove Medical Press, I (2008) pp. 1–12.
12. P. Suyash, and R. Whitake, “Higher-Order Image Statistics for Unsupervised, Information-
Theoretic, Adaptive, Image Filtering”, IEEE Trans. on Pattern Analysis and Machine Intelli-
gence, 28(3) 2006 pp. 364–376.
13. C. Shannon, “A Mathematical Theory of Communication”, Bell System Technology Journal,
24(5) (1948) pp. 370-423, pp. 623–656.
14. C. Shen, and M. J. Brooks, “Fast Global Kernel Density Mode Seeking: Applications to
Localozation and Tracking”, IEEE Trans. on Image Processing, 16(5) 2007 pp. 1457–1469.
12
15. H. Zhang, J. E. Fritts and S. A. Goldma, “An Entropy-based Objective Evaluation Method
for Image Segmentation, Storage and Retrieval Methods and Applications for Multimedia,” Pro-
ceeding of The SPIE, 5307 2003 pp. 38–49.
16. Wand, M., Jones, M.,“Kernel Smoothing”, Chapman and Hall, p. 95, 1995.
17. A. I. Kostrikin. “Introducción al Algebra”, Editorial Mir Moscu, 1983.
18. LIDL, Rudolf; Harald, Neiderreiter. “Introduction to finite fields and their applications”, Cam-
bridge university press, 1994.
19. Noriega Sánchez, Teresita; Arazoza Rodrı́guez, Hector. “Algebra”, Editorial Félix Varela, vol.
2, 2003.