ORIENTATION SPECTRUM ALGORITHM DEVELOPMENT

A morphological orientation spectra is proposed. This spectrum describes basic directions of shape parts. Fast discrete-continuous algorithm for computing orientation spectrum is presented. It is based on usage of continuous skeleton that is constructed from polygonal shape contour. A definition for disc orientation map is given. Comparison experiments for binary shapes with the usage of orientation spectra are carried out. Cyclic shift and EMD-L distance are used for spectra comparison. The obtained results indicate that the aggregation of the thickness spectra with orientation spectra increases the quality of inter-class recognition.


INTRODUCTION
In the field of computer vision, many approaches exist to the problem of description and analysis of the 2D shapes.Among them, pure analytical method or methods based on analytical solutions have an advantage.Such analytical methods are often very fast and allow to build more precise and compact descriptors then fully discrete methods.For example, in paper (Mestetskiy, 2009) and (Masalovitch, 2009) computational effective algorithms were proposed for constructing continuous skeletons of 2D (flat) polygonal shapes.Continuous skeletons are informative, but unstable descriptors.That is why, it is reasonable to use morphological pattern spectrum (Maragos, 1989) that is more stable (Sidyakin, 2013).Connection between various skeletal representation (Mestetskiy, 2009) and a morphological pattern spectrum (Maragos, 1989) is also well-known.Morphological discrete-continuous morphological pattern spectrum (Sidyakin, 2013) with a disc structuring element (SE) can be calculated using continuous skeleton and radial function (Mestetskiy, 2009) and (Masalovitch, 2009).This spectrum allows us to characterize the local thickness of shape parts, but tells us nothing about the "orientation" of these parts.To solve this "orientation" problem, we could use elliptical SE and existing efficient algorithm (Serra, 1982), but real accounting of all possible ellipse parameters combinations reduces efficiency of elliptical discrete-continuous morphological pattern spectrum algorithm (Serra, 1982).
In this paper, we propose more simple and effective solution then the elliptic one in (Serra, 1982), which allows us to extract the information about orientation of shape parts.Its core idea is to use the orientation of continuous skeleton bones and build one additional discrete orientation accumulator a la algorithm (Sidyakin, 2013).Thus, the presented approach utilize the robustness and efficiency of continuous skeleton to build the orientation pattern spectra.
The remaining part of the paper is organized as follows.In section 2, theoretical concepts of morphological pattern spectrum and thickness map is given.In Section 3, the review of the related pattern spectrum algorithms that are based on continuous skeletons are brought down.The proposed approach is presented in section 4. In section 5, we present the experimental results conducted on standard shape datasets.The comparative analysis * Corresponding author with the existing similar disc spectrum approach is also presented in this section.The conclusion is given in section 6.

MORPHOLOGICAL PATTERN SPECTRUM
Figure 1: The morphological pattern spectrum of objects in the image X with disc SE and the stages of its morphological processing.
The original idea of pattern spectrum proposed by Maragos (Maragos, 1989) is based on Serra's Mathematical morphology filters (opening/closing).More formally, let X be the given binary image (pattern).Let B be the structuring element with (0, 0) as the origin on the 2D object plane P .The parametrically scalable structuring element B(r) cab be defined as B(r) = {rb|b ∈ B}, r ≥ 0, b = (x b , y b ) ∈ P .Let X ⊆ P and B ⊆ P , the morphological pattern spectrum (PS) of X is defined as where S(X)= X L 1 , is the area of X, P S(r) -the spectrum for positive part of the axis r (spectrum of image objects), P S(−r) -the spectrum for negative part of the axis r (spectrum of image background).This means that S(X • B(r)) is a quantitative measure of rB in X.Hence, the pattern spectrum is defined as a morphological tool that gives the quantitative information The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XL-5/W6, 2015 Photogrammetric techniques for video surveillance, biometrics and biomedicine, 25-27 May 2015, Moscow, Russia about the shape and sizes of the objects in the image.The size distribution is represented in the form of histogram for further processing (fig.1).
Since it is inconvenient to carry out computations with derivatives, in practice a discrete morphological spectrum of continuous image is used: where ri = i∆r, i ∈ Z, ∆r -the scale step.
In the paper (Sidyakin, 2013), the new definition for pattern spectrum with disc SE was given based on disc thickness maps.
Let F be a binary figure which fully fits on the frame K : F ⊆ K. Denote F C(K) = K \ F , the background of figure F on the frame K. Then the binary image, that correspond to the figure F , is defined as: Figure 2: Left: thickness map for foreground; Right: thickness map for background.
Let B(q, r) be a translatable flat disc with the center at the point q=(x, y)=B(q, 0) and the scale parameter r.Definition 1. Thickness map TB(fF ) of a binary image fF (x, y) with disc structuring element B(q, r) is real-valued image defined on the frame K, with each point representing the maximum size of its covering disc structuring element fully inscribed in the figure shape F .For the background of figure F , the value of the scale parameter is negative, as shown in fig. 2.
In particular, it was also proven in (Sidyakin, 2013) that discrete Maragos pattern spectrum with disc structuring element is a histogram of discrete disc thickness map.The proposed disc thickness map made possible the creation of precise fast disc pattern spectrum computation algorithm.This algorithm is briefly described in the next section.

Fast Disc Algorithm For Pattern Spectra Construction
Fast Discrete-continuous disc spectrum algorithm (Sidyakin, 2013) sequentially goes through points of rasterized representation of continuous skeleton bones and accumulate (collect) point's votes in cells (pixels) of the thickness accumulator.Vote value at the point is equal to the radial function value (radius of maximum inscribed empty circle with the center at this point) at the current skeleton bone's point.Accumulation process of vote's values in one cell is to choose maximum value between new vote value and vote value recorded before in this cell.Thickness map is a thickness accumulator filled with votes.As a result, values of the maximum inscribed empty discs are recorded in the cells (pixels) of the thickness map and there is a connection link between points (pixels) of the shape and skeleton points, which are the centers of the maximum inscribed empty discs.The histogram of thickness map represents discrete disc spectrum.Fig. 3 shows the main steps of the described approach.Further the described technic was generalized for elliptical spectra (section 2.2.).

Elliptical Algorithm For Pattern Spectra Construction
In paper (Sidyakin, 2014) approach to construction of morphological spectra with the fixed and arbitrary elliptical SE was proposed.An application of elliptical SE allows to describe both thickness and orientation information.An elliptical spectrum algorithm with a fixed elliptic SE is based on a continuous skeleton constructed with disc SE for equi-affine transformed contour of the original shape.Ellipse to disk equi-affine transformation matrix is used.Next, a disc thickness map is constructed using rasterization of maximum inscribed discs by fast and precise generalized Bresenham algorithm (Zingl, 2012).Elliptical thicknesses map is created with the help of disc to ellipse equi-affine transform.Elliptical spectrum is a histogram of elliptical thicknesses map.This approach is illustrated in fig. 4. Further, this approach has been generalized to arbitrary rotating elliptical SE.In practice, the effective construction of the spectrum with an arbitrary elliptical SE is only available for a limited set of orientations of the ellipse principal axes and for a limited set of the relations between the axes of the ellipse.Proposed in section 3 orientation spectrum algorithm is deprived of this drawback and allows to take into account all the orientations presented in the figure.

ORIENTATION SPECTRUM ALGORITHM
To get started with orientation spectrum of 2D shapes, let's define the orientation property for all skeleton points.One possible definition of the orientation of the point is the tangent angle at this point to the skeleton.If the skeleton point is the node point (fig.6) -this is a special case, and we assume that the orientation of the point is the tangent angle at this point to the skeleton bone with the maximum average thickness.If there are several bones of equal average thickness, we assume that there is no orientation at this node point.
Thus, 2D function (radial function, orientation) is given at all points of the skeleton.Therefore, maximum inscribed circles describe the local thickness of shape that is elongated in a certain direction (have certain orientation).This orientation is assigned to the skeleton points.
Definition 2. Orientation map -2D function, that is defined on the image.This 2D function has the value at each point, that is equal to the orientation of the bone to which the maximum empty disk of the maximum area, covering this point, belongs.So, Definition 2 is very similar to Definition 1. Definition 3. Orientations spectrum is a histogram of orientation map.
Overall, the algorithm to obtain a morphological orientation pattern spectrum is presented below.(c) Create a two-dimensional thickness accumulator and initialize all his elements with zeros.Create a two-dimensional orientation accumulator and initialize all his elements with zeros.
(d) Select a continuous bone (parabolical or line bone) from a list of skeleton bones.If the list is empty, go to (h).
(e) Compute discrete representation of the continuous bone with the help of Bresenham algorithm (Zingl, 2012) and form a set of points {pi(xi, yi, ri)}, defined by the coordinates (xi, yi) of the center and the radius ri of relevant maximum empty circles computed with the following equations (Mestetskiy, 2010): -in the case of two site-segments we have a corresponding linear bone, that is described by the 1-st order Bezier curve: The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XL-5/W6, 2015 Photogrammetric techniques for video surveillance, biometrics and biomedicine, 25-27 May 2015, Moscow, Russia This contribution has been peer-reviewed.doi:10.5194/isprsarchives-XL-5-W6-13-2015where V0, V1 -end points of linear bone, r0, r1 -maximum inscribed discs' radii that correspond to end points, t -curve parameter, t ∈ [0 . . .1]; -in the case of site-segments and site-point, we have a corresponding parabolical bone, that is described by the 2-nd order Bezier curve: where V0, V2 -end points of parabolical bone, r0, r2 -maximum inscribed discs' radii that correspond to end points, B1, B2 -end points of site-segment, t -curve parameter, t ∈ [0 . . .1]; -in the case of two site-points we have a corresponding linear bone, that is described by the 2-nd order rational Bezier curve: where V0, V2 -end points of linear bone, r0, r2 -maximum inscribed discs' radii that correspond to end points, t -curve parameter, t ∈ [0 . . .1], ω1 -weight coefficient, r1 -control disk radius, x1 -control vertex on the abscissa axis.The system of equations ( 10) is solved To determine r1 and x1: where c -half of the distance between site-points.The system of equations ( 11) is solved to determine ω1: (f) Construct discrete thickness map and orientation map in accumulators.The following logic is applied: bigger maximum circles cover smaller maximum circles.So, for current bone point pi construct a filled maximum circle of the radius ri in the accumulator with the help of Bresenham algorithm for discrete circle representation (fig.8.4).When filling the circle with the value of radius ri in the corresponding accumulator elements, the following condition is checked: if ri is bigger than the current accumulator element value, store ri to the current thickness accumulator element and orientation oi of the current disc to the current orientation accumulator element, otherwise leave accumulators' elements without any changes.If ri is equal to rj, choose o based on average bone thickness.Return to step (d).
(h) Calculate the morphological orientation pattern spectrum as the histogram of the two-dimensional accumulator.Zero elements of accumulator correspond to the background part of the spectrum.Positive values of accumulator correspond to the object part.(i) Normalize morphological orientation pattern spectrum: the sum of all spectrum bins should be equal to one.
To increase stability of the proposed descriptor it is recommended to regularize polygonal contour of the shape (fig.9) (Sidyakin, 2013).
Adjustable parameter of this algorithm is the orientation sampling step.This parameter determines the sensitivity of the spectrum to the variety of orientations presented in the shape.10 degrees step was chosen for the experiments.

EXPERIMENTS
In this section, we present the experimental results conducted on the standard shape dataset Kimia-216.The Kimia-216 shape dataset consists of 18 classes with 12 samples in each class.Examples of objects of different classes are shown (fig.10).All shapes (presented in images) in this dataset were transformed to the same shape-area-based scale (i.e, the scale is estimated such that the area of all shapes became equal 215140 pixels) and then all the images were bounded to the same image size (height = 507 pixels and width = 467 pixels).The comparison of shapes through the comparison of orientation spectra is performed by  Fig. 11 shows average class precision that was obtained by using thickness spectra and orientation spectra respectively.It is clear to see that in some cases orientation spectrum performs better than thickness spectrum.The thickness spectrum shows better results than orientation spectrum for the first three request images (fig.12).For the last three request images, we have the opposite situation (fig.13).
The experiment, when thickness spectra and orientation spectra were applied consequentially, was conducted.Orientation spectra was built for the reduced set of figures (24 images), these figure shapes were selected by thickness spectra.Average precision is shown on fig.14.
From the above experiments, we have shown that the comparison of the thickness/orientation spectra with the help of EMD-L 1 metric is an adequate way to compare shapes in the case if the compared figures have a rich thickness distribution.The EMD-  L 1 comparison is stable to small deformations of flexible objects, to rotation and to slight noise effects at the borders of the shapes.

CONCLUSION
A morphological orientation spectra is proposed.This orientation spectrum describes basic directions of shape parts in contrast to thickness spectrum.Orientation spectrum can be calculated much faster than elliptical spectrum with arbitrary elliptical SE.This descriptor is invariant to shift of a figure in the frame and can be also applied to the analysis of almost non flexible figures, parts of which can slightly change their directions.Fast discretecontinuous algorithm for computing orientation spectrum is presented.It is based on usage of continuous skeleton that is constructed from polygonal shape contour.A definition for disc orientation map is given.Comparison experiments for binary shapes with the usage of orientation spectra are carried out.Cyclic shift and EMD-L 1 distance are used for spectra comparison.Cyclic shift helps to make comparison rotation invariant.The obtained results indicate that the aggregation of the thickness spectra with orientation spectra increases the quality of inter-class recognition.
Proposed spectrum can also be used for shape segmentation into regions of different orientation and/or thickness.
Figure 14: Average precision for thickness spectra and thickness/orientation spectra.

Figure 4 :
Figure 4: Basic ideas for pattern spectrum algorithm construction with fixed elliptical SE.The most important steps are shown.1. Equi-affine transformation elliptical SE to disc SE; 2. Original 2D Shape; 3. Disc skeleton of equi-affine transformed polygonal shape; 4. Disc thickness map of transformed shape; 5. Elliptical thickness map obtained from disc thickness map by equi-affine transformation of disc SE to elliptical SE.

Figure 5 :
Figure 5: Elliptical thickness maps for arbitrary (not fixed) elliptical SE.It is possible to build them based on discrete-continuous morphological pattern spectrum algorithm for fixed elliptical SE, but to do it fairly effectively we need to use a finite set of allowed ellipse parameters.

Figure 7 :
Figure 7: Orientation map construction for "common red point".Orientation map is build based on thickness map.b(r b , o b ) -big maximum disc with center in point b, radius r b and orientation o b .s(rs, os) -small maximum disc with center in point s, radius rs and orientation os.

Figure 12 :
Figure 12: Top closest shapes for the requested shape.Thickness spectrum was used.

Figure 13 :
Figure 13: Top closest shapes for the requested shape.Orientation spectrum was used.