Applications of Algebraic Moments for Edge Detection ... - Springer Link

0 downloads 0 Views 2MB Size Report
algebraic moments of the brightness function of halftone images. For an ... Keywords: edge detection, spatial moments, fast computation of moments, subpixel ...
REPRESENTATION, PROCESSING, ANALYSIS, AND UNDERSTANDING OF IMAGES

Applications of Algebraic Moments for Edge Detection for Locally Linear Model A. A. Abramenko* and A. N. Karkishchenko** Southern Federal University, ul. Chekhova 22, Taganrog, 347928 Russia *e-mail: [email protected] **e-mail: [email protected] Abstract—We describe a subpixel edge detection approach in images. The proposed approach is based on the algebraic moments of the brightness function of halftone images. For an ideal two-dimensional edge, we consider a model with the following four parameters: the edge orientation, the distance from the edge to the center of the mask, and the brightness values from both sides of the edge. To obtain all subpixel parameters of the edge, six algebraic moments are used. To compute the moments rapidly, masks are used. The specificity of the proposed approach is as follows: masks of almost all sizes can be used and they are computed by means of explicit relations provided in the present paper as well. Increasing mask sizes, one can increase the accuracy of the detection of subpixel edge parameters, which is especially important for high-definition images. We present experiments displaying the efficiency of the proposed approach. Keywords: edge detection, spatial moments, fast computation of moments, subpixel measurements DOI: 10.1134/S1054661817030026

INTRODUCTION To find object edges or contour points in images is a fundamental problem of image processing and computer vision. There are various approaches to the problem (see [1]). Edge detection methods are applied in segmentation problems (see [2]) and contour-selection problems (see [3]), as well. The problem of finding contour points in a digital image is well-studied and a number of efficient methods (such as the socalled Roberts, Sobel, Marr, Laplace, and Canny operators, as well as their modifications) are known. Any such operator has certain peculiarities determining its advantages or disadvantages for any particular case, but they all presume the presence of a regular orthogonal pixel net on the digital image and they all act in a fixed neighborhood, where a discrete function is considered. Almost all such operators have a differential nature; i.e., they approximate the computation of derivatives or gradients. Hence, they are computationally instable a priori and they strongly depend on the presence of a noise in the image. To reduce the influence of noise, preliminary smoothing inside the neighborhood of the considered point is usually used. Such smoothing increases the detection stability for contour points, but it generates additional errors such that it is hard to estimate theoretically. Therefore, an inaccuracy appears in the further interpolation (e.g., piecewise linear interpolation) of the object edge.

Received March 16, 2017

An alternative approach to the detection of edge points is based on the usage of integral characteristics of an image neighbourhood presumably containing a point of the boundary contour. One method to formalize this approach is the use of moment characteristics of the function representing the image. An indirect confirmation of the advantage of the approach based on moments is the fact that initial and central moments of the first and second order (in certain cases, of higher orders as well) are used for the parametrical description of the most propagated distribution laws for random variables. Since moments have integral character (under the assumption that the noise is additive and statistically independent), it follows that the influence of that noise on the accuracy of computations decreases compared with differential approaches. For a sufficiently large domain of computation of moments, errors might become negligibly small. Regarding the usage of moments, it is important that no orthogonal (or even regular) structure is required for the location of image pixels. In particular, they can be computed (with the same accuracy) on other pixel lattices (for instance, hexagonal ones) or even in cases where there is no data regularity at all (this happens, e.g., in the analysis of range-measuring data). Another advantage of the usage of moments to detect edges of images is as follows: they can be efficiently adopted to analyze images with subpixel accuracy. The point is that there are applications (such as the analysis of medical images or images of remote satellite probing, photogrammetry, or quality moni-

ISSN 1054-6618, Pattern Recognition and Image Analysis, 2017, Vol. 27, No. 3, pp. 433–443. © Pleiades Publishing, Ltd., 2017.

434

ABRAMENKO, KARKISHCHENKO

Using the method of least squares, one can find the subpixel location of the edge, comparing the image brightness with the edge model given a priori. In [18], the hyperbolic tangent function is used as the edge model. In [19], the local energy function is introduced to find the parameters of the edge. In [7], a method based on the Gaussian model of the edge is proposed. To summarize, the methods of this group are efficient and reliable for noisy images, but they are cost-intensive computationally.

plexity because only three masks are required to compute the moments. However, it is hard to use Zernike moments to describe low-size objects. In [23], the Fourier–Mellin orthogonal moments proposed in [24] are applied to the model of an ideal edge from [21]. However, seven moments must be computed to implement that method; thus, its computational complexity is high. The disadvantage of existing methods based on moments is as follows: there is no clear classification to distinguish edge pixels and non-edge ones. Due to the high computational complexity, those methods are not frequently applied in practical problems. However, they can be effectively used to refine the locations of edges once they are roughly detected at the initial stage: in such a case, the computational complexity can be substantially decreased (see [25]). In the current work, we describe a method to detect edges by means of algebraic moments of the image brightness function. In the first section, the used edge model is described and canonical moments are introduced to represent it. In the second section, we explain how to obtain recurrent relations to compute any canonical moment analytically, using one of two known canonical moments. Also, in the second section, we use the obtained recurrent relations to find the parameters of the linear model, allowing us to detect the location of the edge. In the third part, we derive analytic expressions to compute masks of any size, used for the fast computation of moments of any order. The fourth part is devoted to experiments demonstrating the work of the method. At the end of the paper, we summarize and discuss the results.

Methods based on moments use integral operators; it is noted above that their sensitivity to the noise in images is less than the sensitivity of the methods using other approaches. In [20], which is the first paper in the framework of that approach, three brightness moments are used. The authors define an edge as a sequence of intensities of one value following a sequence of intensities of another value. Moments are defined as the sum of the values of pixel intensities and they do not take into account any spatial information about pixel locations. The main disadvantage of this method is as follows: it finds edges only in a nondecreasing or nonincreasing sequence of intensities. In [21], an ideal two-dimensional model of the edge and spatial moments is used to obtain the parameters of the edge (such as location, orientation, background intensity, and brightness variation on the edge). The presented approach requires the computation of six moments; therefore, a computationally hard method is obtained. Circular masks are proposed for moment computations. This increases the computation speed, but no general method to construct masks of arbitrary size is provided; rather, six masks are computed at the intermediate stage. Further, the ideal model of the edge, introduced in [21], is used for other approaches: in [22], a method using Zernike orthogonal moments is proposed, which decreases the computational com-

1. EDGE MODEL AND ITS DESCRIPTION VIA MOMENTS Consider halftone images assuming that they are described by a two-dimensional piecewise-constant brightness function f ( x, y) on a bounded rectangular domain D given in an orthogonal coordinate system XOY . The requirement that the function be piecewiseconstant reflects the fact that real images in the framework of any pixel are given by constant-brightness values. Applying the method of moments to detect the edge points of an object on an image, we base on the assumption that any small segment of a contour can be represented by a line segment. In other words, a local model of a segment C of the edge is a small line segment approximating the edge at point A such that the normal to that segment forms an angle θ with the positive direction of the axis OX (Fig. 1). For simplicity, we assume that there exists a small neighborhood of the point A such that the brightness of the image is approximately constant at each side of the linear edge (denote these constant values by f ( x, y) = a and f ( x, y) = b respectively) and these values are sufficiently different from each other to say that the edge really exists. Also, one can say that the local model of

toring for industrial products) that require the parameters of the edge to be found with a high accuracy. In such cases, traditional pixel-level detection methods for edges (see [4–6]) are replaced with subpixel methods used to detect the location and orientation of edges inside any pixel of the image. There are three general kinds of subpixel methods (see [7]): methods based on interpolation, the method of least squares, and the method of moments. Also, there are approaches to subpixel edge detection outside the framework of the given classification (see [8–11]) and approaches combining several of the approaches listed above (see [12]). Interpolation methods find the subpixel edge location, interpolating the image and its derivatives. In [13], a method is proposed such that the Canny detector (see [4]) is used first and Hermite interpolation is applied to identify the domains with edges afterwards. Works [14–17] can be treated as interpolation methods as well. To summarize, the methods of this group are numerically efficient, but are sensitive to the presence of a noise in the images.

PATTERN RECOGNITION AND IMAGE ANALYSIS

Vol. 27

No. 3

2017

APPLICATIONS OF ALGEBRAIC MOMENTS FOR EDGE DETECTION

435

Y

Y

C R

f(x, y) = a A

b

θ O

r θ

f(x, y) = b

O

t

X

a X

Fig. 1. The model for the case of a linear edge.

the edge is a step such that its height is equal to b − a and its length is defined by the neighborhood size along the presumed edge. Next, we say that the described model of the edge is linear and the points located on the line approximating the edge are called edge points (points of the edge). Thus, the reconstruction of a locally linear segment of the edge is reduced to the detection of the point A , which is the middle of the approximating segment, the angle θ, the brightness a, and the brightness b . Those parameters can be analytically expressed via twodimensional moments of the brightness function f ( x, y) in a fixed neighborhood containing the sought point A . Directly using the image of f ( x, y), we compute these moments in the given neighborhood. Then, using the found expressions, we can obtain the particular values of all of the parameters.

Fig. 2. The current coordinate system related to the circular neighborhood S .

to the angle φ inside the same neighborhood S can be expressed explicitly:

M pq =

m pq =

∫∫ x

y f ( x, y ) dxdy.

y f ( x cos φ − y sin φ,

p q

S

x sin φ + y cos φ)dxdy. Indeed, exchanging the variables u = x cos φ − y sin φ and v = x sin φ + y cos φ in the last relation yields the relation

For the two-variable function f ( x, y ) , the moment of order p + q in any domain S ⊆ D is defined as follows: p q

∫∫ x

p

M pq = × cos

(1)

q

⎛ p⎞ ⎛q⎞

∑∑ ⎜⎝ i ⎟⎠ ⎜⎝ j ⎟⎠ (−1)

i =0 j =0 p −i + j q +i − j

φsin

q− j

φ m p + q − i − j ,i + j .

S

Note that the detection of the parameters of the edge segment imposes no restrictions on the shape of the neighborhood. Therefore, taking into account that the analytic computation of moments is greatly simplified in circular domains, we assume that S is a circular neighborhood (i.e., a disk of radius R ). To any circular neighborhood, assign a current coordinate system such that its origin coincides with the disk center and its axes are parallel to the corresponding axes of the original coordinate system. Thus, to obtain the current system, we translate the original one to the center of the neighborhood (Fig. 2). Note that the relation between the moments m pq and the moments M pq of the function f ( x, y) rotated PATTERN RECOGNITION AND IMAGE ANALYSIS

In particular, the rotation angle can be selected such that the location of the edge segment is convenient for analytic computations. This means that we rotate the function f ( x, y) to the angle θ such that the edge line is parallel to the axis OY (see Fig. 3). Then the point A belongs to the axis OX ; hence, its coordinates are (t, 0). Thus, the problem to find the point A is reduced to the problem to find the parameter t . The angle θ can be found as follows. If the edge is parallel to the axis OY, then the center of inertia belongs to the axis OX by virtue of symmetry; hence, M 01 = 0 . Therefore, for the case where φ = θ , we assign p = 0 and q = 1 in the last relation and obtain

Vol. 27

No. 3

2017

436

ABRAMENKO, KARKISHCHENKO

try with respect to the axis OX , all moments with odd q are equal to zero, i.e.,

Y R

M p,2k +1 = 0,

k = 0,1, 2,...

Therefore, in the sequel, we assume that q is even.

b

θ O

Let S = {( x, y)| x 2 + y 2 ≤ R 2} be a circular neighborhood, S a = {( x, y)| x 2 + y 2 ≤ R 2, x ∈ [−R, t )}, and S b = {( x, y)| x 2 + y 2 ≤ R 2, x ∈ [t, R]} such that t is fixed, the brightnesses a and b are constant, and

t

X

S = Sa

a

∪ S . Then b

M pq =

∫∫x

y f ( x, y)dxdy = a

p q

S

∫∫x

p q

y dxdy

Sa

+b

∫∫x

y dxdy.

p q

Sb

Fig. 3. The canonical state of a linear edge.

Integrating by parts, we obtain the following recurrent relation for the moments:

whereas M 01 = m01 cos θ − m10 sin θ = 0 , m10 m01 and sin θ = . This cos θ = 2 2 2 2 m01 + m10 m01 + m10 implies that that

θ = arctan

m01 . m10

(2)

Substituting the expressions for cos θ and sin θ in the expression for M pq , we obtain the moment relation under the canonical state of the edge: 2 2 M pq = (m01 + m10 ) p

×

q

∑∑ i =0 j =0



M pq =

q +1 q −1 2(b − a) M p + 2,q −2 − t p +1(R 2 − t 2 ) 2 , (4) ( p + 1)(q + 1) p +1 p = 0, 1, 2,...; q = 2, 4, 6,...

This relation shows that all moments of the same order are functionally linked. Therefore, to compute all moments recurrently, it suffices to know the moments of the kind M p0, p = 0, 1, 2,...:

M p0 =

p

f ( x, y)dxdy

S

p+q 2

⎛ p⎞ ⎛q⎞ q − j p −i + j q + i − j ⎜ i ⎟ ⎜ j ⎟ (− 1) m10 m01 m p + q −i − j,i + j . ⎝ ⎠⎝ ⎠

∫∫x

=a

dxdy + b

Sa

(3)

For simplicity, we say that the neighborhood location such that the center of inertia belongs to the axis OX , i.e., M 01 = 0 , is the canonical state and the moments computed for the canonical state of the edge are the canonical moments. To find the parameters t , a , and b of the edge, it suffices to have three canonical moments, e.g., M 00 , M 10, and M 20 . The analytical expressions needed to find the edge parameters are presented in the next section.

∫∫x

p

∫∫x

p

dxdy.

Sb

Integrating by parts, we obtain the following recurrent relation as well:

M p + 2,0 =

3 p +1 2 2(b − a) p +1 2 R M p0 + t (R − t 2 )2, (5) p+4 p+4 p = 0, 1, 2,...

2. RECURRENT RELATIONS FOR CANONICAL MOMENTS

Thus, once explicit relations for M 00 and M 10 are known, one can use relations (4) and (5) to compute all the other moments of any order recurrently. The structure of the functional dependence of the moments is displayed in Fig. 4. In this figure, the bidirectional arrow means that there exists a relation intermediately linking moments such that their orders p + q are given by the numbers of rows and column such that the arrows leave them.

In this section, we find the recurrent relations useful for the computation of the canonical moments of any order. First, we note that, by virtue of the symme-

Computing M 00 and M 10 intermediately and using relation (5) to compute M 20 , we obtain the following system of equations:

PATTERN RECOGNITION AND IMAGE ANALYSIS

Vol. 27

No. 3

2017

APPLICATIONS OF ALGEBRAIC MOMENTS FOR EDGE DETECTION 1 ⎧ 1 (a + b)πR 2 − (b − a) ⎛ t(R 2 − t 2 ) 2 + R 2arcsin t ⎞ , M = ⎜ ⎟ ⎪ 00 2 R⎠ ⎝ ⎪ 3 ⎪⎪ 2 (b − a)(R 2 − t 2 ) 2, = M ⎨ 10 3 ⎪ 3 ⎪ 2 2 2 2 1 1 ⎪M 20 = R M 00 + (b − a)t(R − t ) . 4 2 ⎪⎩

Using the obtained system, one can find the unknown parameters t , a, and b . In fact, combining the equations of this system appropriately, one can easily obtain the relation

4M 20 − R 2M 00 . t= 3M 10

(7)

From the first and second equations of system (6) we find that

M b = 002 + 3M 10 πR

2 2 2 2 πR + 2t R − t + 2R arcsin t R 3

4π R (R − t ) 2 3M 10 . 3 2

a=b−

2

2

(8)

2(R − t )2 2

2

The value of t yields the coordinate of the jumplike brightness variation point in the neighborhood S . It is easy to see that if the brightness is constant inside S , q 0

p

1

2

3

4

5

6

0 1 2 3 4 5 6

Fig. 4. An illustration of the functional dependence of canonical moments. PATTERN RECOGNITION AND IMAGE ANALYSIS

437

(6)

i.e., a = b , then 4M 20 − R 2M 00 = 3M 10 = 0 ; i.e., t is not defined (which is expected for such a case). 3. MASKS OF ARBITRARY SIZE FOR FAST MOMENT COMPUTATIONS The construction of edge points presumes repeated computations of moments (1) of various orders inside a circular neighborhood, i.e., a circular window running throughout the full image. Therefore, the complexity and accuracy of the parameter detection essentially depends on the speed and accuracy of the computation of these moments. In [21], it is proposed to use a priori prepared masks to compute the moments. In this case, to find a moment, it suffices to compute the convolution of the image with the corresponding masks. However, the only particular masks provided in [21] are masks for a circular window with a diameter of five pixels, intended for the computation of the moments m00 , m10, m01 , m20 , m02 , and m11. On the other hand, to detect edge points, it might be necessary to compute moments of higher orders in circular neighborhoods of arbitrary diameter. Therefore, it would be reasonable to have relations for the exact construction of masks of arbitrary sizes and for arbitrary two-dimensional moments, i.e., to obtain a general method to construct masks for the fast computation of moments. This section is devoted to the described problem. The idea of constructing masks is as follows. Assume that the center of the circular neighborhood S always coincides with the center of a pixel of the image (and is assigned to be the origin of the coordinate system) and the diameter of the neighborhood is an odd integer. The side length of the square pixel is assigned to be the length unit. On Fig. 5, examples of possible neighborhoods are displayed: their diameters are 5, 7, 9, and 11 pixels. Fix a circular neighborhood of diameter d and consider the least square domain A containing the circular neighborhood S . It is obvious that A = [−R, R] × [−R, R], where R = d is the radius of the 2 neighborhood. The set A is a square sliding window used to compute moments. The pixel coordinates are treated as the coordinates (i, j ) of its center. Let Aij = i − 1 , i + 1⎤ × j − 1 , j + 1⎤ be the set of points 2 2⎥⎦ 2 2⎥⎦

(

Vol. 27

No. 3

(

2017

438

ABRAMENKO, KARKISHCHENKO

The following assertion is easily proved (it is almost obvious). Proposition 1. For all integers i and j , the following relations hold:

j

−i, j

p

i,− j

q

i, j

m pq = (− 1) m pq ; i, j

m pq = (− 1) m pq .

0

1 2 3 4 5

Also, this implies that m −pqi,− j = (− 1) p + q m ipq, j . These relations mean that it suffices to compute the moments m ipq, j for i and j ≥ 0, while other ones are reconstructed by virtue of the symmetry.

i

Fig. 5. Circular neighborhoods with diameters of 5, 7, 9, and 11 pixels.



of the (i, j )th pixel such that A = Aij is the i, j decomposition of the square window into pixels. Introduce the following characteristic function χ( x, y) of a circular neighborhood S :

⎧1, if x 2 + y 2 ≤ R 2, χ( x, y) = ⎨ ⎩0, otherwise. Then, taking into account that the brightness f(x, y) of the image is constant inside any pixel Aij, we conclude that

∫∫x

m pq = = =

∫∫

⎢⎣R ⎥⎦

p q

y f ( x, y)dxdy

S p q

x y χ( x, y) f ( x, y)dxdy

A ⎢⎣R ⎥⎦

∑ ∑

∫∫x

f (i, j )

i =− ⎣⎢R ⎦⎥ j =− ⎣⎢R ⎦⎥

y χ( x, y)dxdy,

p q

Aij

where ⎢⎣ x ⎥⎦ denotes the integer part of x. Introduce the notation m ipq, j =

∫∫

m pq =

Aij

x p y q χ( x, y)dxdy . Then

⎣⎢R ⎦⎥

⎣⎢R ⎦⎥

∑ ∑

m ipq, j f (i, j ).

(9)

i =− ⎣⎢R ⎦⎥ j =− ⎣⎢R ⎦⎥ i, j (m pq )i, j =− ⎣⎢R⎦⎥,...,⎣⎢R⎦⎥

The matrix is the mask to compute the moments mpq in the circular neighborhood S of diameter d. Thus, the problem is reduced to the construction of the procedure to compute the moments m ipq, j of the function χ(x, y) for arbitrary p and q on the pixels Aij.

To find the moments m ipq, j for i and j ≥ 0, we note that all pixels in A form three disjoint classes: the external ones do not intersect the boundary of the circular neighborhood and are completely located outside it; the internal ones do not intersect the boundary of the circular neighborhood and are completely located inside it; and the boundary ones intersect the boundary at least at one point. Note that the boundaries of circular neighborhoods never intersect pixel vertices. In fact, by construction, each vertex has coordinates of the kind k + 1 , l + 1 , where k and l are integers; taking into 2 2 account that the neighborhood diameter is odd by condition, we conclude that its radius is equal to m + 1 , where m is an integer. However, no integers 2 k, l , and m exist to satisfy the relation 2 2 2 k + 1 + l + 1 = m + 1 . Therefore, classifying 2 2 2 pixels by means of the coordinates of their vertices, one can use only strict inequalities. Thus, it is easy to see that any pixel (i, j ) can be associated with one and only one class as follows:

)

(

(

)

( ) ( ) (

)

( ) ( ) ( ) ( )

2 2 ⎧ 1 + j − 1 > R 2, is external, if i − ⎪ 2 2 ⎪ 2 2 ⎪ pixel(i, j ) ⎨is internal, if i + 1 + j + 1 < R 2, 2 2 ⎪ is boundary, otherwise. ⎪ ⎪⎩

For convenience, introduce the notation i − = i − 1 2 1 and i + = i + . The next proposition provides relations to 2 compute masks that can be used to compute arbitrary moments in a neighborhood of any diameter d = 2R.

)

(

Proposition 2. Let i, j ≥ 0, (i, j ) ≠ 0, R − 1 , 2 1 (i, j ) ≠ R − , 0 . Then the following assertions hold: 2

(

)

PATTERN RECOGNITION AND IMAGE ANALYSIS

Vol. 27

No. 3

2017

APPLICATIONS OF ALGEBRAIC MOMENTS FOR EDGE DETECTION

1. if (i, j ) is an external pixel, then m ipq, j = 0;

i, j 2 2 2 2 m pq = 1 I ( R − j + , R − j − ) q +1

2. if (i, j ) is an internal pixel, then m ipq, j =

i +p +1

i −p +1

j +q +1

+

j −q +1

− − ; ⋅ p +1 q +1 3. if (i, j ) is a boundary pixel, then the moments are defined as follows:

1 ( j +q +1((R 2 − j +2 ) ( p + 1)(q + 1)

if

R − i− ∈ ( j−, j+ ) 2

i, j m pq

if

j −q +1 ((R 2 − j −2 ) ( p + 1)(q + 1) 2

and

p +1 2

2

2

R − 1, 0

m pq 2

where I (α,β) =



β

α

and

p +1 2 2 j− )

p +1 2

− i −p +1)

− i −p +1)) R − j + ∈ (i − , i + ), 2

and

2

m ipq, j = 1 I ( R 2 − j +2, i + ) q +1 q +1 2 2 1 + ( j + ((R − j + ) ( p + 1)(q + 1) q +1 p +1 p +1 − j − (i + − i − ))

R − j − ∈ (i − , i + ), 2

R − j + ∈ (i − , i + ) 2

if

j −q +1 p +1 p +1 = 1 I (i −, i + ) − (i + − i − ) q +1 ( p + 1)(q + 1)

R 2 − i −2 ∈ ( j − , j + )



R − j − ∈ (i −, i + )

if

− i −p +1) 2

j −q +1((R 2



m ipq, j = 1 I (i −, R 2 − j −2 ) q +1 −

439

0, R −1 2

m pq

R 2 − i +2 ∈ ( j −, j + ),

2

p +1 2

p +1

− i− )

R − i + ∈ ( j − , j + ), 2

and

2

( )

(R − 1) q +1 = 1 I −1,1 − (1 − (− 1) p +1), p +1 q +1 2 2 ( p + 1)(q + 1)2

p +1 ⎛ ⎞ ⎛ 2 1 2⎞ 2 p +1 ⎟ ⎜ R − − R − ( 1) ⎜ q +1 ⎟ 2 ⎠⎟ (1 − (− 1) ) ⎜ ⎛ 2 1 2 ⎞ ⎝ = , R ⎟⎟ + ⎜ I ⎜⎜ R − ⎟, q +1 2 q +1 ⎜ ⎝ ( p + 1)2 ⎠ ⎟ ⎜ ⎟ ⎝ ⎠

x p (R 2 − x 2 )

()

()

q +1 2

case a : j − < R − i − < j + and i − < R − j − < i + ; 2

dx.

Formally, the specified four cases can be described by the following conditions:

2

2

2

2

case c : i − < R 2 − j −2 < i + and i − < R 2 − j +2 < i + ; cas e d : i − < R 2 − j +2 < i + and j − < R 2 − i +2 < j + . Let us compute the moment m ipq, j for case a :

tion 2 yields an expression for m ipq, j obtained by means of the intermediate computation of a double integral over the square domain Aij . Assertion 3 contains the moment values on boundary pixels. Consider this assertion in detail. It is easy to verify that six different cases are possible (for i, j ≥ 0) for intersections of a pixel and the boundary of the circular neighborhood; they are displayed in Figs. 6 and 7. For the initial four cases, we have i, j > 0 : in case a , the boundary intersects the left and the lower sides of the pixel; in case b , it intersects the left and the right sides; in case c , it intersects the upper and the lower sides; and in case d , it intersects the upper and the right sides.

2

case b : j − < R − i − < j + and j − < R − i + < j + ; 2

Proof. The proof is reduced to the intermediate computation of moments on pixel for a finite number of possible cases. Assertion 1 is obvious because χ( x, y) = 0 in all points of the pixel in that case. Asser-

PATTERN RECOGNITION AND IMAGE ANALYSIS

2

m ipq, j =

∫∫x

y χ( x, y)dxdy

p q

Aij

R − j− 2

=

2



⎛ x ⎜ ⎜⎜ ⎝

R −x

p

i−



2

2



⎞ y dy ⎟ dx = 1 I (i − , R 2 − j −2 ) ⎟⎟ q +1 ⎠ q

j− q +1

j− ((R 2 − j −2 ) ( p + 1)(q + 1)

where I (α,β) =



β

α

x p (R 2 − x 2 )

q +1 2

p +1 2

− i −p +1),

dx .

For cases b , c , and d , the moments are computed in the same way. The integral I (α,β) contained in all of the expressions is an integral of a rational function if q is odd; for

Vol. 27

No. 3

2017

440

ABRAMENKO, KARKISHCHENKO

(a)

(b)

(c)

(d)

j+

j+

j+

j+

j

j

j

j

j−

j−

j−

j−

i

i−

i+

i−

i

i+

i−

i

i+

i−

i

i+

Fig. 6. Possible intersection cases for neighborhoods and pixels, i, j > 0 .

the case where q is even, there exist explicit expressions for the primitive (see, e.g., [26], p. 95). Two other cases must be added to the considered four ones; they correspond to the highest and rightmost boundary pixels (see Fig. 7). Those pixels are completely characterized by their coordinates 0, R − 1 and R − 1 , 0 respectively. The values of the 2 2

) (

(

)

0, R −1

R − 1,0

corresponding moments m pq 2 and m pq 2 are computed by means of intermediate integrating and their form corresponds to the one claimed in the assumption of the proposition. Masks for the neighborhood with diameter of seven pixels computed by means of the above relations are presented in Fig. 8. Using them, we can accelerate (as much as possible) the computation of moments on images, while the accuracy is preserved. 4. EXPERIMENT RESULTS In this section, we provide the results of experiments to detect edges by means of moments, using masks of various sizes. On the subpixel level, the main steps to detect the edges are as follows: (a)

(b)

j+

j+

j

j

j−

j− i

i−

i+

i−

(

i

i+

)

Fig. 7. Intersection of the upper pixel 0, R − 1 and the 2 right pixel R − 1 , 0 with the neighborhood. 2

(

)

• compute masks of the required size by means of Proposition 2; • compute the convolution of these masks with the image points to obtain the moments m pq (see (9)); • compute the canonical moments M pq by means of relation (3); • compute the parameters θ, t , a, and b by means of relations (2), (7), and (8). To obtain subpixel edge parameters for any image point, one has to repeat these steps for any pixel of the image. To obtain the image of the edges on the pixel level, a post-processing of the obtained subpixel parameters is required, but the description of the corresponding procedures is outside the framework of the present paper. Figure 9 presents an artificially generated image of a rectangle of the size 500 × 500 pixels. The background brightness value is equal to 0 . 8902 , while the brightness value for the rectangle is equal to 0 . 2039 . The rectangle is rotated such that the angle between its left boundary and the vertical axis i is equal to 2  (0 . 0349 radian). Subpixel parameters computed for masks of various sizes are presented in the Table. The Table shows that the accuracy of the found parameters grows as the size of the used masks increases. Also, the fact that the moments are integrals and large-size masks are used for their computation (under the assumption that the noise is additive and statistically independent) guarantees that the influence of the noise on the computation accuracy declines. CONCLUSIONS In the present paper, we describe an approach to the detection of edges in images, based on algebraic moments of the brightness function describing halftone images. We provide relations for the detection of points belonging to the boundaries between objects of different brightness. The edge parameters are computed analytically; the simplest implementation is obtained for the case of circular neighborhoods. Using two-dimensional moments of different orders to local-

PATTERN RECOGNITION AND IMAGE ANALYSIS

Vol. 27

No. 3

2017

APPLICATIONS OF ALGEBRAIC MOMENTS FOR EDGE DETECTION −







− −



− − −



m00 −

m11



























− −



















441









− −









− −

m10



− −

− −



m01

m20

m02

Fig. 8. The collection of masks to compute moments up to second order (inclusively) for the neighborhood of diameter d = 7 .

ize edges, we obtain recurrent relations for the fast sequential computations of moments of any order. The simplest way to find the parameters of object boundaries in an image is to use canonical moments characSubpixel parameters of the edge for the image in Fig. 9 d

i

j

θ

t

b

a

7 7 7 7 27 27 27 27 67 67 67 67

220 221 222 223 220 221 222 223 220 221 222 223

197 197 197 197 197 197 197 197 197 197 197 197

–0.0372 –0.0390 –0.0398 –0.0406 –0.0346 –0.0354 –0.0363 –0.0370 –0.0349 –0.0349 –0.0348 –0.0348

–0.2968 –0.2593 –0.2202 –0.1795 –0.2559 –0.2213 –0.1865 –0.1514 –0.2597 –0.2246 –0.1892 –0.1536

0.8843 0.8835 0.8827 0.8819 0.8898 0.8898 0.8898 0.8898 0.8901 0.8901 0.8901 0.8901

0.2112 0.2121 0.2128 0.2134 0.2044 0.2044 0.2044 0.2044 0.2040 0.2040 0.2040 0.2040

PATTERN RECOGNITION AND IMAGE ANALYSIS

terized by a particular location of the coordinate system. That is why we provide relations expressing canonical moments via original ones computed directly via the image. In addition, explicit expressions for the coefficients used to compute moments are obtained in the present paper. These coefficients form so-called masks such that, computing them a priori, we are guaranteed to rapidly compute the moments used to find edge parameters. The expressions obtained for the coefficients allow us to rapidly compute masks of any size. Therefore, the accuracy of the subpixel detection of edges can be increased by means of the use of large-size masks. The main results of the present paper are based on the so-called linear model of edges, ensuring an acceptable localization of the edges even for small diameters of circular windows and for high-definition images. However, the localization adequacy still may be broken if a sharp break of the object boundary occurs in the analyzed circular neighborhood: as a rule, such a break leads to an undesirable smoothing of angular edge points. Thus, we need theoretical cri-

Vol. 27

No. 3

2017

442

ABRAMENKO, KARKISHCHENKO

0

7. J. Ye, G. Fu, and U. P. Poudel, “High-accuracy edge detection with blurred edge model,” Image Vision Comput. 23 (5), 453–467 (2005).

100

8. A. Trujillo-Pino, K. Krissian, M. Aleman-Flores, et al., “Accurate subpixel edge location based on partial area effect,” Image Vision Comput. 31 (1), 72–90 (2013).

200

9. X. Ji, K. Wang, and Z. Wei, “Structured light encoding research based on sub-pixel edge detection,” in Proc. IEEE Int. Conf. on Information Engineering and Computer Science (Wuhan, 2009), pp. 1–4.

300

10. X. B. Hong and Y. L. Chen, “Edge-directed sub-pixel extraction and still image superresolution,” in Proc. 2nd IEEE Int. Congress on Image and Signal Processing CISP’09 (Tianjin, 2009), pp. 1–4.

400

500

0

100

200

300

400

500

Fig. 9. A test image.

teria to estimate the adequacy of the linear model while the edge is being detected. To increase the detection certainty for edge points, we plan to use the voting method (its justification is interesting both from the theoretical and practical viewpoints). The specified method can substantially improve the approach based on moment local characteristics of the image; we plan to present this approach in our next paper (together with experimental results on real images). ACKNOWLEDGMENTS This study was supported by the Russian Foundation for Basic Research, project no. 16-07-00648. REFERENCES 1. G. Papari and N. Petkov, “Edge and line oriented contour detection: state of the art,” Image Vision Comput. 29 (2), 79–103 (2011). 2. D. R. Martin, C. C. Fowlkes, and J. Malik, “Learning to detect natural image boundaries using local brightness, color, and texture cues,” IEEE Trans. Pattern Anal. Mach. Intellig. 26 (5), 530–549 (2004). 3. T. F. Chan and L. A. Vese, “Active contours without edges,” IEEE Trans. Image Processing 10 (2), 266–277 (2001). 4. J. Canny, “A computational approach to edge detection,” IEEE Trans. Pattern Anal. Mach. Intellig. No. 6, 679–698 (1986). 5. J. M. Prewitt, “Object enhancement and extraction,” Picture Processing Psychopictorics 10 (1), 15–19 (1970). 6. R. Deriche, “Using Canny’s criteria to derive a recursively implemented optimal edge detector,” Int. J. Comput. Vision 1 (2), 167–187 (1987).

11. M. Kisworo, S. Venkatesh, and G. West, “2-D edge feature extraction to subpixel accuracy using the generalized energy approach,” in Proc. 10th IEEE Region Int. Conf. on EC3-Energy, Computer, Communication and Control Systems, TENCON’91 (New Delhi, 1991), pp. 344–348. 12. A. Fabijanska, “A survey of subpixel edge detection methods for images of heat-emitting metal specimens,” Int. J. Appl. Math. Comput. Sci. 22 (3), 695–710 (2012). 13. S. H. Xie, Q. Liao, and S. R. Qin, “Sub-pixel edge detection for precision measurement based on canny criteria,” Key Eng. Mater., Trans. Tech. Publ. 295, 711–716 (2005). 14. C. Steger, “Subpixel-precise extraction of lines and edges,” Int. Arch. Photogrammetry Remote Sensing 33 (3), 141–156 (2000). 15. T. Hermosilla, E. Bermejo, A. Balaguer, et al., “Nonlinear fourth-order image interpolation for subpixel edge detection and localization,” Image Vision Comput. 26 (9), 1240–1248 (2008). 16. L. Zhang and X. Wu, “An edge-guided image interpolation algorithm via directional filtering and data fusion,” IEEE Trans. Image Processing 15 (8), 2226– 2238 (2006). 17. J. W. Hwang and H. S. Lee, “Adaptive image interpolation based on local gradient features,” IEEE Signal Processing Lett. 11 (3), 359–362 (2004). 18. V. S. Nalwa and T. O. Binford, “On detecting edges,” IEEE Trans. Pattern Anal. Mach. Intellig. No. 6, 699– 714 (1986). 19. M. Kisworo, S. Venkatesh, and G. West, “Modeling edges at subpixel accuracy using the local energy approach,” IEEE Trans. Pattern Anal. Mach. Intellig. 16 (4), 405–410 (1994). 20. A. J. Tabatabai and O. R. Mitchell, “Edge location to subpixel values in digital imagery,” IEEE Trans. Pattern Anal. Mach. Intellig. No. 2, 188–201 (1984). 21. E. P. Lyvers, O. R. Mitchell, M. L. Akey, et al., “Subpixel measurements using a momentbased edge operator,” IEEE Trans. Pattern Anal. Mach. Intellig. 11 (12), 1293–1309 (1989).

PATTERN RECOGNITION AND IMAGE ANALYSIS

Vol. 27

No. 3

2017

APPLICATIONS OF ALGEBRAIC MOMENTS FOR EDGE DETECTION

443

22. S. Ghosal and R. Mehrotra, “Orthogonal moment operators for subpixel edge detection,” Pattern Recogn. 26 (2), 295–306 (1993). 23. T. J. Bin, A. Lei, C. Jiwen, et al., “Subpixel edge location based on orthogonal Fourier-Mellin moments,” Image Vision Comput. 26 (4), 563–569 (2008). 24. Y. Sheng and L. Shen, “Orthogonal Fourier-Mellin moments for invariant pattern recognition,” J. Opt. Soc. Am. A 11 (6), 1748–1757 (1994).

25. F. Da and H. Zhang, “Sub-pixel edge detection based on an improved moment,” Image Vision Comput. 28 (12), 1645–1658 (2010).

Alexander Andreevich Abramenko. Born 1992. Graduated from Southern Federal University (Applied Mathematics and Informatics) in 2015. Post-graduate student at Southern Federal University, Taganrog. Author of eight scientific papers. Scientific interests include data analysis, computer vision, robotic systems, and mathematical problems of pattern recognition and classification.

Alexander Nikolaevich Karkishchenko. Born 1956. Graduated from Taganrog State Radio-Engineering University (Applied Mathematics) in 1978. Received candidate’s degree in 1983 and doctoral degree in 1997. Professor of Southern Federal University, Taganrog. Main scientific interests: graph theory, combinatorial analysis, theory of possibilities, theory of nonadditive measures, mathematical models of classification, image processing and analysis, and pattern recognition. Author of more than 180 scientific papers.

PATTERN RECOGNITION AND IMAGE ANALYSIS

26. A. P. Prudnikov, Yu. A. Bychkov, and O. I. Marichev, Integrals and Series (Nauka, Moscow, 1981) [in Russian].

Translated by A. Muravnik

Vol. 27

No. 3

2017