{'fraction_non_alphanumeric': 0.037357815116346206, 'fraction_numerical': 0.009469368901206768, 'mean_word_length': 4.515923566878981, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Novel Active Contour Model for Texture Segmentation

Texture is intuitively defined as a repeated arrangement of a basic pattern or object in an image. There is no mathematical definition of a texture though. The human visual system is able to identify and segment different textures in a given image. Automating this task for a computer is far from trivial. There are three major components of any texture segmentation algorithm: (a) The features used to represent a texture, (b) the metric induced on this representation space and (c) the clustering algorithm that runs over these features in order to segment a given image into different textures. In this paper, we propose an active contour based novel unsupervised algorithm for texture segmentation. We use intensity covariance matrices of regions as the defining feature of textures and find regions that have the most inter-region dissimilar covariance matrices using active contours. Since covariance matrices are symmetric positive definite, we use geodesic distance defined on the manifold of symmetric positive definite matrices PD(n) as a measure of dissimlarity between such matrices. We demonstrate performance of our algorithm on both artificial and real texture images.


Introduction
Texture is intuitively defined as a repeated arrangement of a basic pattern or object in an image. There is no universal mathematical definition of a texture though. The human visual system is able to identify and segment different textures in a given image without much effort. Automating this task for a computer, though, is far from trivial. Apart from being a tough academic problem, texture segmentation has several applications. Texture segmentation has been applied to detect landscape changes from aerial photographs in remote sensing and GIS [31], content based image retrieval [12] and diagnosing ultrasound images [20] and others. There are three major components in any texture segmentation algorithm: (a) The model or features that define or characterize a texture, (b) the metric defined on this representation space, and (c) the clustering algorithm that runs over these features in order to segment a given image into different textures. There are two approaches of modeling a texture: Structural and Statistical. The structural approach describes a texture as a specific spatial arrangement of a primitive element. Vor-onoi polynomials are used to specify the spatial arrangement of these primitive elements [27,26]. The statistical approach describes a texture using features that encode the regularity in arrangement of gray-levels in an image. Examples of features used are responses to Gabor filters [11], graylevel cooccurrence matrices [33,14], Wavelet coefficients [8], human visual perception based Tamura features [25], Laws energy measures [18], Local binary patterns [21] and Covariance matrices of features [28,10]. In [16], the authors compare performance of some of the above mentioned features for the specific goal of image retrieval. In fact, Zhu, Wu & Mumford [32] propose a mechanism of choosing an optimal set of features for texture modeling from a given general filter bank. Markov random fields [7], Fractal dimensions [5] and the space of oscillating functions [29] have also been used to model textures. Various metrics have been used to quantify dissimilarity of features: Euclidean, Chi-squared, Kullback-Leibler & its symmetrized version [30], manifold distance on the Gabor feature space [6] and others. k−NN, Bayesian inference, c− means, alongwith active contours algorithms are some of the methods used for clustering/segmentating texture areas in the image with similar features. In this paper, we use intensity convariance matrices over a region as the texture feature. Since these are symmetric positive definite matrices which form a manifold, denoted by PD(n), it is natural to use the intrinsic manifold distance as a measure of feature dissimilarity. Using a novel active contours method, we propose to find the background/foreground texture regions in a given image by maximizing the geodesic distance between the interior and exterior covariance matrices. This is the main contribution of our paper. In the next subsection we list out some existing texture segmentation approaches using active contours model.

Related work
Sagiv, Sochen & Zeevi [6] generalize both, geodesic active contours and Chan & Vese active contours, to work on a Gabor feature space. The Gabor feature space is a parametric 2−D manifold embedded in R 7 whose natural metric is used to define an edge detector function for geodesic active contours, and to define the intra-region variance in case of the Chan & Vese active contours. In [23], the authors use Chan & Vese active contours on Local Binary Pattern features for texture segmentation. In [22], the authors propose a Chand & Vese active contour model on probability distribution of the structure tensor of the image as a feature. The closest approach to our algorithm is by Houhou et. al. [15], where the authors find a contour that maximizes the KL-divergence based metric on probability distribution of a feature for points lying inside the contour and outside the contour. The feature used is based on principal curvatures of the intensity image considered as a 2−D manifold embedded in R 3 . In particular, the cost function for a curve Ω is defined as where p in (Ω), p out (Ω) is the probability distribution of the feature κ inside and outside the closed contour Ω respectively. Gaussian distribution is assumed as the model for the probability distribution of the feature both inside as well as outside the contour. In our approach, instead of using some scalar feature to represent texture, we iteratively compute a contour that maximizes the geodesic distance between the interior and exterior intensity covariance matrix of the contour. It can be seen that the maximization process has to be carried out over the manifold of symmetric positive definite matrices, making it fundamentally different from the approach in [15]. Moreover, we can easily extend this approach to covariance matrices of any other texture feature one may want to use. The paper is organized as follows:In next section we provide a brief review of active contour models for image segmentation. In section refersection label, we describe our active contour model based on geodesic distance between the interior and exterior covariance matrices of a contour. We give our experimental results in Section 3 followed by conclusions and future scope.

Active contours and Level sets
In classical active contours [17], user initializes a curve C(q) : [0, 1] → Ω ⊆ R 2 on an intensity image I : Ω → R 2 which evolves and stabilizes on the object boundary.
The curve evolution is gradient descent of an energy functional, E(C), given by where α, β and λ are real positive constants, C and C are first and second derivatives of C and ∇I is the image gradient. First two terms are regularizers, while the third term pushes the curve towards the object boundary. Geodesic active contours [3] is an active contour model where the objective function can be interpreted as the length of a curve C : [0, 1] → R 2 in a Riemannian space with metric induced by image intensity. The energy functional for geodesic active contour is given by where g : R → R is a monotonically decreasing edge detector function. One such choice is g(s) = exp (−s). The curve evolution equation that minimizes this energy is given by wheren is the inward unit normal and κ is the curvature of the curve C.
A convenient computational procedure for curve evolution is the level set formulation [1]. Here the curve is embedded in the zero set of a function φ : R 2 → R and the function is made to evolve so that its zero level set evolves according to the desired curve evolution equation. For a curve evolution equation of the form ∂C ∂t = vn, the corresponding level set evolution is ∂ φ ∂t = v|∇φ |. See Appendix in [3]. In particular the level set evolution for geodesic active contours is given by Another active contours approach was introduced by Chan and Vese [4] where the energy function was based on regional similarity properties of an object, rather then its edges (image gradient). Suppose that C is the initial curve defined on the domain Ω of the intensity image I. Ω can be divided into two parts, interior (denoted by int(C)) and exterior (denoted by ext(C)). Let us represent the mean gray value of the region int(C) and ext(C) by c 1 and c 2 respectively, then the energy function for which the object boundary is a minima is given by After adding some regularizing terms the energy functional F(c 1 , c 2 ,C), is given by where µ ≥ 0, ν ≥ 0, λ 1 , λ 2 > 0 are fixed scalar parameters. The level set evolution equation is given by where δ ε is a smooth approximation of the Dirac delta function. A nice survey on active contours and level set implementation can be found in [1]. We now describe our active contour model for texture segmentation.

Proposed Active contour model for texture segmentation
In what follows, we assume familiarity with concepts from differential geometry like geodesic distance, Riemannian Exponential and Riemannian Logarithm maps. A thorough introduction to these concepts can be found in the books [2,9]. We are given an intensity image I : Ω ⊂ R 2 → R. Our algorithm assumes that the image contains a background and a foreground texture. At every point x ∈ Ω, let N(x) be a R 2 × 1 vector of intensities over a small neighborhood 1 , say of size R × R. Given a closed contour C on Ω, we define the following two covariance matrices: where int(C), ext(C) denote the interior and exterior of C respectively. Note that M i (C) and M e (C) both belong to the set of R 2 × R 2 symmetric positive definite matrices, which is a Riemannian manifold henceforth denoted by PD(R 2 ). Let d : PD(R 2 ) × PD(R 2 ) → R denote the geodesic distance between two points of this manifold. Since the image contains two different texture regions, it is evident that the two covariance matrices(points on this manifold) defined in (1) will be furthest away (in terms of geodesic distance) from each other when the contour C lies on the boundary between the two textures. We justify this claim with an empirical evidence in Figure 1. For a given texture image I : Ω → R, we propose where M i (C), M e (C) are defined in Equation (1). We find the contour C that maximizes this cost, using the gradient ascent approach giving us a novel active contour scheme. Instead of working on parametric representations of C, we work with its level set representation which has several benefits as discussed in [1]. The curve C is represented as the zero level set of the function φ : Ω → R, i.e., C = φ −1 (0). A typical choice of φ is the signed distance function of C: with d R 2 (x, y) as the usual Euclidean distance on R 2 between x and y. The sets int(C), ext(C) can then be defined in terms of the level set function φ as Using the level set function φ and the Heaviside function we redefine the covariance matrices from Equation (1), as Re-writing our cost function from Equation (2) in terms of the level set function φ gives us To maximize this cost function we use gradient ascent algorithm, and the gradient is computed as follows where ., . M i and ., . M e are the Riemannian inner products defined on the Tangent space of PD(R 2 ) at points M i (φ ) and M e (φ ), respectively. Specific details on this inner product can be found in [13]. The derivatives of the geodesic distance d is given by 2 where Log denotes the Riemannian log map defined on PD(R 2 ). Derivatives of the covariance matrices defined in Equation (4) are given by where |Ω int | and |Ω ext | are given by and δ is the Dirac delta function. Substituting Equations (7),(8),(9),(10) into Equation (6), we get The gradient ascent as a level set evolution equation is therefore given by In the next section, we provide necessary implementation details and results on various images. 2 A simpler explanation for this can be given in case we are working with R 2 instead of PD(R 2 ). In this case ∂ d ∂ x (x, y) = −(y − x) and ∂ d ∂ y (x, y) = −(x − y). This is exactly what is done by the Riemannian Log map on manifolds.

Experiments
The Heaviside and the Dirac delta functions are not continuous, instead, we use the following smooth approximation as given in [4]: We add curvature flow as a regularizer to obtain the following level set evolution equation: where κ = div ∇φ |∇φ | is the curvature of the curve and λ is the weight assigned to the curvature term. We evolve an initial contour given by the user till the cost function given in Equation (2) increases, we stop the evolution the moment it decreases. We re-initialize the level set function when required following the algorithm given in [24]. All images shown in this section are of size 200 × 200 pixels. The results shown in this section were obtained on a Intel Core2Duo, 2GB RAM machine using MATLAB. The time required for computing these results was under 10 minutes, most of the time taken in re-initializing the level set function. We begin by first validating our algorithm on artificially created images. Results are shown in Figure 2. Topology of the evolving contour can change due to the level set implementation. Next, we give results on real texture images, that of a zebra and the Europe night sky image, in Figure 3. Texture being a neighborhood property rather than a pixel property, the segmented boundary will lie a pixel or two away from the actual boundary.
We next compare our results with the results generated by the algorithm in [15], on some images from the Berkeley Segmentation dataset [19], in Figure 4. We have used images from [15] to display their results. One can clearly see that our algorithm gives a better texture segmentation. Small noise-like artifacts are (a) (b) (c) Figure 2: Segmentation results on artificial texture images. As is evident, the change of topology property is preserved by our model. The size of neighborhood for these results is R = 5 (5 × 5 pixels) here, i.e. the manifold under consideration is PD (25). Initial contour in yellow, final contour in red.
(a) (b) Figure 3: Segmentation results on real texture images. The size of neighborhood for these results is R = 5 (5 × 5 pixels) here, i.e. the manifold under consideration is PD (25). Initial contour in yellow, final contour is shown in red.
in fact regions where texture similar to the object texture is present, for instance, in the tiger image, there are reflection of the tiger strips in the water that our algorithm is able to successfully segment. With our algorithm, one can also segment usual gray level images, as explained next. Let the neighborhood size R to be 1, i.e. N(x) = I(x). The covariance matrices M i (C), M e (C) defined in Equation (1), will simply be the mean of squared intensities in the interior and exterior of the closed contour C, respectively. Also note that the covariance matrices now belong to PD(1), i.e., the set of positive real numbers R + , of course with a metric different from the usual Euclidean one on R. Our algorithm will then find the contour that maximizes the difference (geodesic distance on PD(1)) between the two numbers M i (C) and M e (C). Typical image segmentation results using this approach and results using the Chan & Vese active contours [4] is shown in Figure 5. Of course, with R = 5, the covariance matrix can capture textures of that scale only. If we have large scale textures, our algorithm will over-segment the image, as can be seen in Figure 6. Simply increasing the neighborhood size R may not solve the problem, as the detected boundary may not be properly localized near the actual texture boundary.

Conclusion
In this paper, we propose a novel active contour based unsupervised texture segmentation algorithm. The algorithm finds a contour with maximum geodesic distance between its interior and exterior intensity covariance matrices. The results from previous section are in favor of our algorithm. With the least possible neighborhood size R = 1, the process successfully segments gray-level images. In its current state, the method depends on the size of the neighborhood R. Efforts are on to make it independent of R, either using a semi-supervised approach or using other multi-scale methods. Instead of intensity covariance matrices, one may also use covariance matrices of well-chosen multi-scale texture features. The method is able to capture even a slight deviation in a texture. This may be an advantage in some cases, but generally one may want the algorithm to be more invariant to small deviations.  Figure 4: Comparing results from [15](left column) with results from our algorithm (right column). Initialized contour is shown in yellow, while the final contour in shown in red. The size of neighborhood for these results is R = 5 (5 × 5 pixels) here, i.e. the manifold under consideration is PD (25). It can be seen that our results are better in most cases. The small noise-like artifacts are points around which object-like texture is present. For example, in the last image, our algorithm also captures the tiger-strips that appear due to reflection in water.