METHOD FOR ASSESSING THE SYMMETRY OF OBJECTS ON DIGITAL BINARY IMAGES BASED ON FOURIER DESCRIPTOR

: In this paper we solve the problem of ﬁnding the symmetry axis of the object in a digital binary image. A new axial symmetry criterion is formulated for a connected discrete object. The problem of determining the symmetry measure and ﬁnding the symmetry axes arises in a variety of applications. In discrete images, exact symmetry is possible only in special cases. The disadvantage of the existing methods solving this problem is the high computational complexity. To improve computational efﬁciency, it is proposed to use the so-called Fourier descriptor. A new method for estimating the asymmetry of a discrete silhouette is proposed. The described algorithm for calculating the measure of asymmetry and determining the axis of symmetry is quadratic by the number of contour points. Methods for reducing the volume of calculations using a convex hull and taking into account the values of the modules of Fourier coefﬁcients are proposed. Computational experiments are conducted with silhouettes of aircraft extracted from earth remote sensing images. The reliability of the described solution is established.


INTRODUCTION
The symmetry axis is a straight line dividing the object into two symmetrical parts.In this paper, we solve the problem of finding the symmetry axis of an object on a digital binary image, and also formulate a new axial symmetry criterion of a connected discrete object.The problem of determining the symmetry measure and finding symmetry the axes occurs in a variety of applications, for example, there is a problem of detecting tumors in a digital image in medicine, which is characterized by the presence of the axis of symmetry (1).In discrete images, exact symmetry is possible only in special cases.We introduce a new symmetry measure of discrete objects based on the use of the so-called Fourier descriptor of the contour (9).A method for determining the symmetry based on the Fourier descriptor was proposed earlier in (11), the difference of our method consists in a new symmetry measure numerical evaluation, which proved itself well in experiments with noisy images.
The existing methods solving this problem have high computational complexity.A naive boundary points pairs search with a comparison to some extent of the similarity of the two figure halves to find the symmetry axis has a cubic complexity by the number of boundary points.There are known more efficient algorithms to solve the problem.There are two classes of algorithms.The methods in the first class based on the comparison of the two halves of the image (contour, skeleton view).For example, there are (7), ( 8), ( 10), (4).The second class are methods of grayscale image analysis, for example, with the use of integral transforms.There are (3), ( 5).An algorithm for refining the axis of symmetry for binary discrete images is presented in (1).
Section 2 describes the complete problem statement.Section 3 contains a mathematical justification and a complete description of the created method and the algorithm that implements it.Section 4 describes computational experiments that confirm the correctness, operability and efficiency of the algorithm.

PROBLEM STATEMENT
The input data is a binary image containing silhouettes of the figures.The task is to determine the existence of the symmetry axis of these objects.If the symmetry axis exists, it will additionally be required to describe it with the coordinates of the point lying on the axis and the tilt angle to the x-axis.
As an input, there is a binary matrix M , where the element mij is an indicator that the pixel number (i, j) belongs to the object.

SOLUTION
Let the original object be a single-connected region, then consider the silhouette digital contour as a sequence of points on the complex plane: U = {u l } N −1 l=0 .This sequence consists of all the boundary pixels of the silhouette in the 4-neighborhood.It describes a closed curve connected in the 8-neighborhood.The contour construction methods are described in (6).We perform a discrete Fourier transform for U : We will call the sequence of the obtained coefficients {f l } N −1 l=0 the Fourier descriptor of the contour U .
3.1 The Fourier descriptor of a mirror symmetrical object Statement 1.
-symmetrical contour, the symmetry axis coincides with the x-axis, the point u0 is on the symmetry axis.Then for the Fourier descriptor F = {f l } N −1 l=0 of the contour U the following conditions are executed: Im(f l ) = 0, l = 0, N − 1.
Proof.Let x * be a complex conjugation of x.For convenience, we introduce the notation uN ≡ u0.For x-axis symmetrical contour U : For the Fourier descriptor of Û which is F = { fl } N −1 l=0 the equations fl = f * l , l = 0, N − 1 are executed: In the case of a symmetrical contour U = Û is executed, then The proof of the following lemmas can be found in the book (9): Lemma 1.The shift of the contour U to a fixed vector ∆u changes only the value f0.Lemma 2. Turning U by a given angle α around the point 0+0i multiplies all the coefficients f l by the constant exp(iα).Lemma 3.
Using the described facts about the behaviour of the Fourier descriptor in elementary contour transformations, we can generalize the statement 1 to an arbitrary symmetrical contour: Statement 2. Let the contour U = {u l } N −1 l=0 is symmetrical: there is a contour point up lying on the symmetry axis.Let the title angle of symmetry axis to x-axis is equal to α, F = {f l } N −1 l=0 is the Fourier descriptor of a contour U .Then the following equalities hold for all l = 1, N − 1: Proof.Let's shift the contour by ∆u = −up and rotate by the angle −α.Next, we perform a cyclic shift of the obtained contour points by N − p positions.Now the starting point of the contour is up lying on the symmetry axis coinciding with the x-axis.The resulting contour U satisfies the conditions of statement 1.After performing inverse transformations of the Fourier descriptor according to the rules from lemmas 1, 2, 3 we obtain the necessary equations.
In practice, in the case of noisy images, the equalities from the statement 2 are only approximate.
We introduce a value measuring the asymmetry of the contour with respect to axis passing through the vertex up and having a tilt angle α: This value is the norm square of the Fourier coefficients imaginary parts deviation from zero after rotation by an angle −α choosing up as the origin and the contour starting point.
If α is an approximate angle of the symmetry axis passing through the point up, then after rotation the axis of symmetry will coincide with the x-axis and t(α, p) ≈ 0.

A tilt angle computation
We will minimize t(α, p) by α at a fixed value of p to obtain the optimal tilt angle of the symmetry axis passing through the point up.
We calculate the optimal value of α for given p, Let's denote ), l = 0, N − 1 are the Fourier coefficients after the contour start point shift.Let also Then (1) can be rewritten as follows: The optimized function is continuously differentiable by α, it is easy to find the local minima of this function: In [0, π] the equation has two roots: The minimum can also be reached at the segment edges: α3 = 0, α4 = π.The optimized function has a period equal to π, so it is enough to consider only α3.The solution finally takes the form: t(αi, p), α p = α k . (2)

Algorithm
To find the symmetry axis, we perform the described procedure of finding the optimal angle for each contour point, and also calculate the standard deviation of the coefficients from the found optimal axis for all possible p: The closer Q(p) is to zero, the more the found line is similar to the symmetry axis.Choose P = arg min Input parameters: a sequence of complex numbers U , length N .Output parameters: if the contour symmetry axis exists, the output will consist of the coordinates (x, y) of the point on the contour lying on one of the axes of symmetry, and the tilt angle θ of the selected axis to the x-axis.If there is no symmetry axis, return the special value x = −1, y = −1, θ = 0.

Algorithm 1 Symmetry
Require: U , N Ensure: (x, y), θ for l = 0 to N − 1 do The described algorithm 1 for calculating the measure of asymmetry and determining the axis is quadratic by N .

Computational efficiency increasing methods
First, the figure symmetry axis should be the symmetry axis of its convex hull, which can be calculated in subquadratic time.So it is enough to check only a few contour points instead of a complete search of p = 0, . . ., N −1.Namely, on the symmetry axis can lie either a point that is the top of the convex hull, or a point lying on a straight line passing through the mass center (the arithmetic mean value of all the contour points) and the middle of the edge of the convex hull.Since all values are determined numerically, we also check a small neighborhood of these points.An example given in Fig. 1.
Figure 1.Convex hull based points.Blue points are hull vertices and points between middles of hull edges and object center.Red points are their nearest neighbours.Q is the asymmetry measure.
Second, examining the Fourier coefficients module distribution, you may notice that an important contribution to the form description contribute only a small number of coefficients, namely those in which the modules are large enough (usually the first and last harmonics are the most useful, the example in Fig. 2, 3).To speed up the method, we assume α p and Q(p) by a truncated set of Fourier coefficients.We sum only by those indices l, on which the Fourier coefficient modulus |f l | are higher the given threshold.The absolute values of the Fourier coefficients, with the exception of f0, are invariant to the transformations of the type shift, rotation and change of the contour start point, so this operation is correct.In fact, the procedure is equivalent to carrying out the circuit frequency filtering for the symmetry axis approximate localization.We losing some information about the original circuit.Finally, we calculate the full set of coefficients in the small neighbourhood of the found vertex P to determine the exact figure symmetry measure.
Figure 2. A bird unsymmetrical contour.Q is the asymmetry measure.The fast Fourier transform is performed in subquadratic time, thus the final asymptotics of the algorithm is O(N logN + mk), where m is the number of points to iterate by convex hull, k is the number of Fourier coefficients to calculate truncated sums.The described heuristics work at m ≈ 0.05N , k ≈ 0.3.

An ideal symmetry case
In the first experiment, a symmetrical object whose symmetry axis is parallel to the x-axis, namely the symbol Σ, is chosen as the initial image.The contour is constructed as a sequence of boundary pixels.Further, the algorithm 1 is used to find the value of the asymmetry measure, which is equal to 0 (Fig. 4).Next, rotate the original binary image by a known angle θ.For the resulting image, repeat the same operations to construct the contour U .Taking U as input to the algorithm, we find the vertex uP , presumably lying on the symmetry axis.The tilt angle α P is equal to the angle of rotation θ.So, the formula (2) is confirmed by a computational experiment.The value of Q(P ) is close to zero with the error of machine accuracy, which justifies the use of the chosen asymmetry measure in further experiments.
In the case of a symmetrical object (Fig. 5) the Q(p) graph has two local minima close in value, one of which is global.These are the values at two opposite points of the contour lying on the symmetry axis.The figure 6, 7 shows an example of Q(p) behaviour for an asymmetrical contour.
Figure 5.The asymmetry measure of the Σ contour from different contour points.
Figure 6.An unsymmetrical camel contour.Q is the asymmetry measure.
Figure 7.The assymetry measure of the camel contour (Fig. 6) from different contour points.

Real data
To assess the correctness and efficiency of the described algorithm, computational experiments on real data has been carried out.There are the aircraft binary images extracted from the remote sensing of the Earth images (2).We want find the lines that define the orientation of these objects.Figure 10.The first column consists of images with the symmetry axises of plane contours.Q is the asymmetry measure.The second column contains the assymetry measure of given contours from different contour points.

CONCLUSION
A method for solving the problem of determining and searching the parameters of the symmetry axis of a figure in a binary image is developed.An efficient algorithm that implements the created method is constructed.The reliability of the solution is established by computational experiments.A new measure of symmetry of the object is proposed.A new criterion for the axial symmetry of the connected object on digital image has been formulated.This work was supported by the RFBR, grant 17-01-00917.
The most suitable symmetry axis passes through the vertex uP .The value Q(P ) = Q makes sense of the figure asymmetry measure.We will assume the figure to be symmetrical if the value of Q for this figure does not exceed the empirically given threshold.

Figure 4 .
Figure 4.A sigma symmetry axis.Q is the asymmetry measure of object.
2208 binary images of about 120 × 120 pixels in size has been studied.The average image processing time is 0.1 seconds.The orientation has been determined correctly in 98% of cases.Errors are associated with the sampling error (low resolution images).Examples are shown in Fig. 8, 9, 10.

Figure 8 .Figure 9 .
Figure 8.The first column consists of images with the symmetry axises of plane contours.Q is the asymmetry measure.The second column contains the assymetry measure of given contours from different contour points.