The Gray Segmentation of Color Image Based on Level Set Method
Wang Wenjie, Feng Jianhu
College of Science, Chang’an University, Xi’an, China
To cite this article:
Wang WenJie, Feng JianHu. The Gray Segmentation of Color Image Based on Level Set Method. Mathematics and Computer Science. Vol. 1, No. 4, 2016, pp. 82-85. doi: 10.11648/j.mcs.20160104.12
Received: July 4, 2016; Accepted: July 20, 2016; Published: October 18, 2016
Abstract: Firstly, the flaw of usual colored image to gray was discussed. And a new method of colored image to gray based on gradient domain was proposed. Secondly, the gray image was segmented using the level set method. Finally, it was compared the method of this paper with the traditional level set method. The numerical examples shown that the new method is stable and it can deal with the case of the topology change，and it can advance the accuracy of image segmentation.
Keywords: Colored Image to Gray Image, Level Set Method, Gradient Domain, Image Segmentation
At present, although the color image has been widely used, in many cases, the gray image is still needed to use and need to convert color image to gray image. Each pixel gray value of the gray image is generally obtained by the simple weighted sum to the red, green, blue three color space brightness for the traditional color image gray method. However, it is difficult to distinguish for the region of the color image which the brightness is same or similar and the color is different based on the traditional method of gray scale. Therefore, our goal is not only to grayscale images as accurate as possible to reflect the brightness of the color image, but also in the gray image as much as possible to retain the details of the color image can be distinguished.
Image segmentation, as an image preprocessing method, has attracted more and more attention. People have put forward a lot of effective and robust segmentation algorithms [1-5], and have been applied to many fields of science and engineering. And in those, the most inspiring should be the level set method which is proposed by Osher and Sathian  in 1998. This method overcome the weakness of other algorithms, such as the sensitivity of segmentation results to the initial position, the weakness of the topological adaptability and the difficultness to separate structure more complex objects and so on.
In this paper, we proposed a method of color image gray transformation based on gradient domain, and discussed the basic idea of the level set method and used the level set method for image segmentation.
2. Color Image Gray
Firstly, the color image is transformed into LCrCb space, and then the gradient of each component is calculated. If the gradient is larger, then keep its gradient unchanged; if the gradient is small, and the color difference component Cr or Cb gradient of the corresponding position of is larger, then keep the gradient direction unchanged, increase its gradient value. Finally, the gray image is obtained by solving the Poisson equation.
Let is the luminance component of the LCrCb spatial, is recorded as the gradient magnification function, and the modified gradient is , then
According to the method of literature , searching the function space of two-dimension, make the gradient of gray image close to in the least square difference. That is to minimize the integral
According to the variational principle, the function is minimized (2) in the integral, must meet the Euler-Lagrange equation
Substitution and simplification, can obtain Poisson's equation:
In which is the Laplasse operator, ; is the divergence of the gradient. The gray image is obtained by solving this Poisson equation.
The following is the definition of gradient amplification function . Firstly, calculates the average values of the luminance gradient and the chroma gradient , .
In which is the total number of pixels. For the brightness gradient value is smaller than its average value and the sum of the two chroma gradient is greater than the average value of the pixel, the gradient is enlarged, the function is defined as . Thus, the greater of the chroma gradient, the larger of the magnification; the other conditions remain unchanged, that is, .
3. Level Set Method for Image Segmentation
Let is a single connected region, is a moving open subset, whose boundary is , the internal region of the open subset is , that is, . Suppose that the intensity of the color image can be divided into two different values and , where is the intensity of the target image, and .
According to the literature , we can get the following form of the variational problem:
In which the constantis the average intensity image in the region and in the medium of the original corresponding. Thus, when the energy functional (5) reaches minimum, the boundary of the moving open subset reaches the edge of the target image.
Then, the corresponding Euler-Lagrange equation of the variational problem (5) is:
In order to maintain the smooth of the zero level set, and to avoid the appearance of small and isolated regions in the final segmentation results, we need to add the length penalty term in the regularization term, which is related to the length of the evolution curve. Let is a smooth closed planar curve: , the parameter , so the length of the curve can be expressed: . The curve can be substituted for the zero level set of the level set function, and the length of the curve can be expressed as:
In which, and are Heidegger's function and Dirac function respondingly. The effect of the length penalty term is that: it has a binding effect to the change of the length of the curve making the evolution curve keep as short as possible in minimum of the total energy functional. At this time, the image can be divided into two parts: foreground object and background. The energy functional will have a conversion process between the mean/ of the inside of the curve and the mean / of the outside of the curve. In many cases, The shock will occur for the level set function after the evolution of a period of time, and gradually lose the characteristics of smooth and distance functions. As the evolution continues, the error will continue to accumulate and cause the final curve to deviate from the true target edge. In order to avoid the emergence of these problems, the level set function is constructed as the sign distance function in the general level set method. At the moment , this process can be written as :
in which represents the shortest Euclidean distance of the point and the evoluted curve .
In order to guarantee the final segmentation accuracy, it is very necessary to use the level set function to maintain the approximate sign distance function in the evolution process, especially in the neighborhood of the zero level set. And the most direct way to re initialization is to extract the evolution curve (zero level set), and then calculate the shortest Euclidean distance of all points on the image and the level set. this is a very time consuming process. In order to reduce the computation of reinitialization, Sussman et al (1999) proposed a distance function iteration method, which can be realized by solving the following partial differential equations with the time variation of the level set function : , in which, is the level set function which needs to be initialized, is a symbolic function. When the partial differential equation is stable, the level set function will be a distance function with the same level set for .
Reinitialization is widely used as a numerical technique in the level set method, which can ensure the stability of the curve evolution and the accuracy of the evolution. However, it is clear that the reinitialization also appear the case of in consistent to the theory and the numerical realization for the level set method, and may make the zero level set from the original location. In addition, whether it is to take the distance function iteration method or short distance equation method, the calculation of the larger amount is also a problem, and when and how to reinitialization is a problem too.
In order to accelerate the iterative process of solving the Euler-Lagrange equation (6), in this paper, we replace for . So the equation (6) can be rewritten as:
Finally, we use the numerical method to solve the equation (9) in the literature , and get the result of the segmentation of the color image after the gray scale.
4. Numerical Results
We use a writing brush and sunflower pictures on the algorithm proposed in this paper. In Fig. 1 and Fig. 2, (a) express the original image; (b) is the segmentation image obtained using the traditional level set method and (c) express the segmentation image obtained by the method of this paper. As can be seen from the graph, when using the traditional level set method, Fig. 1 (b) and Fig. 2 (b) "讯" word and petals of several sharp been cut off and it can not located to the complex objects. Using the method described in this paper can accurately outline the "news" word and the outer contour of the petals, such as Fig. 1 (c) and Fig. 2 (c).
Through the numerical examples, we can see that this method can not only improve the accuracy of color image segmentation, but also can adapt to the change of topology structure.
Wenjie Wang, lecturer. Research direction: Image processing based on partial differential equations.
|Feng Jianhu, professor. The equation of hyperbolic conservationlaws.|