#### Abstract

Image segmentation variational method is good at processing the images with blurry and complicated contours, which is useful in quality identification of pathologic picture of onion. An adaptive Shannon wavelet precise integration method (WPIM) on digital image segmentation was proposed based on the image processing variational model to improve the processing speed and eliminate the artifacts of the images. First, taking full advantage of the interpolation property of the Shannon wavelet function, a multiscale Shannon wavelet interpolation scheme was constructed based on the homotopy perturbation method (HPM). The image pixels of the Burkholderia cepacia (ex-Burkholder) infected onions were taken as the collocation points of the WPIM. Then, with this scheme, the image segmentation model (C-V model) can be discretized into a system of nonlinear ODEs and solved by the half-analytical scheme combining the HPM and the precision integration method. At last, the numerical precision and efficiency of WPIM were discussed and compared with other common segmentation methods such as OSTU method and Sobel operator. The results show that the contour curve of the segmentation object obtained by the new method has many excellent properties such as closed and clear topological structure and the artifacts can be eliminated.

#### 1. Introduction

Rot is the primary factor of the onion storage losses. The damages from the pests, soak and over-nitrogen often lead to the onion infected with pathogen. Cross-infection of onions accelerates rotting in the package. Therefore, grading and classification of the onions are necessary in the postharvest processing to decrease the losses of onions.

The manual identification is time-consuming and unreliable. Image measurement technology [1] is the new method for grading the quality of agricultural products. Image segmentation is an important part of the image measurement. Accurate segmentation techniques can be used for rotting detection and grading of onions. The classical segementation methods such as Sobel, Canny, quadtree, and OTSU algorithm, take the gradient of the image as the feature descriptor directly in image segmentation. But the object boundary and target pixels obtained by these methods are often unclosed, which is makes it difficult to analyze geometric characteristics of the target for connection and econometric analysis of segmentation results. In the recent years, the wavelet precise integration method [2–10] has been developed to solve the nonlinear PDEs for image processing, which can improve the efficiency and precision of the image processing effectively. WPIM is an image segmentation variational method based on the C-V model, with which the segmentation results with closed object contour can be obtained. In addition, the continuity of wavelet function is helpful to eliminate the artifact introduced by the difference method. There is no doubt that these merits are necessary in the image measurement and product quality grading.

In the recent decades, many wavelets which have compact support, smoothness, and other properties have been constructed. Cattani studied the properties of the Shannon wavelet function, which possesses many advantages such as orthogonality, continuity, and differentiability [11]. It also has the advantage over the Hermite DAF in that it is an interpolating function, producing matrix equations that have the potential to be relatively sparse. In addition, the second order approximation of a -function, based on Shannon wavelet functions, is given [12]. The approximation is compared with the wavelet reconstruction formula and the error of approximation is explicitly computed [13, 14]. Furthermore, Shannon wavelet has been used to solve the fractional calculus problems in the recent years [15–17]. A perceived disadvantage of the Shannon scaling function is that it tends to zero quite slowly as . A direct consequence of this is that, when calculating the derivatives, a large number of the nodal values will contribute significantly. However, comparing with other wavelets, the Shannon scaling function is one that possesses more excellent numerical properties such as the interpolation, orthogonality, and smoothness. Therefore, Shannon wavelet is employed to construct the multiscale interpolator in our research.

The purpose of this research is to construct a multiscale two-dimension wavelet interpolation operator based on the homotopy perturbation method [18–20], with which the image segmentation PDE (C-V model) can be discretized into a system of nonlinear ODEs. Combining the precise integration method with homotopy perturbation method [21, 22] for solving nonlinear problems, a fast wavelet numerical algorithm for P-M and C-V model in image processing can be obtained. With this new image segmentation method, the pathologic onion classification and grading can be processed precisely and efficiency.

#### 2. Chan-Vese Model

In order to solve Mumford-Shah model with Euler-Lagrange method, a simplified model was deduced by Chan and Vese, in which Euclid length was employed instead of Hausdorff length. This simplified model can also be called Chan-Vese model, which can be expressed as follows: where and are positive constants and and are the average gray level values inside () and outside () of the object contour, respectively. denotes the image to process, is the length of the object contour, and is the weight parameter. According to the level set method, the contour curve of the objects should be embedded into the level set function as follows: Then, the level set-based C-V model can be rewritten as follows: Using the variational method, the PDEs with respect to the variable can be obtained as follows: Obviously, is the curvature of the level set function , and is used to constrain the growth of the level set function.

The solution of (5) is the level set function at time . The zero level set is the object contour curve, which can be obtained by solving the equation . We focus on multiscale wavelet image segmentation discrete format and the corresponding numerical solution method.

#### 3. HPM-Based Wavelet Interpolation Operator Construction Schemes

Let the definition domain of the image be ; the discretization points can be defined as , where is a scale parameter and and are position parameters. So

In addition, denotes the multiscale wavelet function and the corresponding th and th derivatives with respect to and , respectively. The level set function and the corresponding derivative function can be discretized as follows: where and are constants, which denote the wavelet scale number and the maximum of the scale number, respectively. , , and are the wavelet coefficients at the points . According to the interpolation wavelet transform theory, the wavelet coefficients can be written as where denotes the multilevel interpolation operator. In order to obtain the multilevel interpolation operator, it is necessary to express the wavelet coefficients as a weighted sum of in all of the collocation points in the -level. Therefore, we should give the definition of the restriction operator as follows: Using the restriction operator, and can be rewritten as Introducing the extension operators , , and and substituting (10) into (8), the wavelet coefficients can be rewritten as and are similar to . From the above equation, the extension operator can be obtained as and can be obtained with the same method. Therefore, the calculation time complexity of the wavelet transform coefficients , , and is .

Substituting , , and , , , and into (2), the multilevel wavelet interpolation operator can be obtained as Then, (7) can be rewritten as Substituting (14) into (5), the multilevel wavelet discretization scheme of PERONA-MALIK model can be obtained.

The purpose of constructing the multilevel wavelet collocation method is to decrease the amount of the collocation points and then improve the efficiency of the algorithm. But the efficiency will be eliminated if the computation complexity of the multilevel wavelet interpolation operator is too high. It is easy to understand that the interpolation wavelet coefficient is the error between the interpolation result and the exact result at the same collocation point. And so the wavelet coefficient must be the function of the parameter . In other words, the wavelet coefficient should vary with the time parameter . Then, the interpolation operator can be viewed as a nonlinear problem. HPM is efficient and effective tool to solve nonlinear problem. Aiming to improve the efficiency of the multilevel wavelet interpolation operators, HPM would be employed to construct a novel interpolation operator in this section.

For convenience, and its derivative in (5) should be rewritten as respectively, where The value of at is denoted as , and is denoted as . And then a linear homotopy function can be constructed as It is easy to identify the homotopy parameter as According to the perturbation theory, the solution of (18) can be expressed as the power series expansion of as follows: Substituting (20) into (18) and rearranging based on powers of -terms, we have According to HPM, we obtain the wavelet coefficients , , at as follows:Obviously, the calculation time complexity of the wavelet transform coefficients , , and is , which is decreased greatly than that in (8) which is .

Substituting the wavelet transform efficient (22) into (16), we obtain and the derivative function Obviously, the computation complexity is decreased greatly comparing with (14).

##### 3.1. The Multiscale Interpolation Wavelet Approximation of the C-V Model

There are many ways to solve partial differential equations and the most typical method is the difference method. This method uses the flat function to describe image, approximately the surface function. But, it is easy to cause artifacts phenomenon, affecting the accuracy of image segmentation. Wavelet function has both smooth and compactly supported characteristics. Besides, performance of multiscale analysis can be used to construct the multiscale adaptive interpolation operator for solving nonlinear partial differential equations. The wavelet approximation of the level set function and its derivative with respect to and , respectively, can be expressed as follows: where is the wavelet function and its - and -order derivative with respect to and , respectively. , , and are wavelet transform coefficients. We convert (2) to wavelet multiscale discrete format of the level set function by stead of (25):

It is the most direct way for dynamic adaptation to only retain the distribution points of corresponding wavelet coefficients that satisfy the condition

Time domain numerical integration of partial differential equations is an iterative process; therefore, some points, which are possible important next step, need to be kept to enable the algorithm to track singularities of solutions. So adjacent points of distribution points also should be kept. The adjacent region can be delineated as follows: where , are numbers of different scale wavelet and , are constant.

##### 3.2. Nonlinear Discrete Ordinary Differential Equations

Because is a small parameter in ordinary differential equation (26), value of is low. Equation (26) can be converted into The solution of (29) is where

We can get the solution of ordinary differential equations (26) by iterative solution (30).

#### 4. Experiment and Discussion of Onion Infected Region Segmentation

Figure 1(a) is a image of an onion infected by sour skin virus. We noticed that the onion has a water-soaked appearance. Compared with the background, the grayscale difference between the water-soaked appearance and the healthy part is smaller. So it is beneficial to compare performance of the different algorithms. Figure 1(b) is an ideal segmentation results. Segmentation target is infected regions of onion; however infected part is often not uniform. In the image, the difference of gradient is less than 1 at upper left part due to slight infection, so the algorithm is difficult to precise segmentation based on global threshold. Therefore, the best one of the different segmentation algorithms can distinguish the majority of the infected region without serious oversegmentation. Then, it is easy to identify and measure the infected portions by using a priori knowledge.

**(a) Original image**

**(b) Segmentation target**

##### 4.1. Comparison among Different Segmentation Methods

The common image segmentation methods, including watershed algorithm, Sobel operator and Canny edge detection algorithm, Otsu algorithm, and an effective and common quad-tree decomposition algorithm, were selected for comparison. Shannon wavelet was employed to construct the wavelet interpolation operator. The representation of Shannon wavelet is based upon approximating the Dirac delta function as a band-limited function and is given by

Consider a one-dimensional function , . A discrete point sequence of the variable is defined as and the corresponding discrete point sequence of the scaling function can be defined as

The first and second order derivatives of at the discrete point are The corresponding 2-dimension weight function can be represented as the tensor product form of the above equations.

The experimental procedure is described as follows:(1)convert the infested onion image to grayscale (Figure 2(a)) and solve for the gradient map (Figure 2(b));(2)use the grayscale image to test the Sobel operator, Canny operator, Qtdecomp algorithms, and wavelet precise integration method; Use the gradient mat to test the OSTU method and watershed algorithm;(3)applying the watershed method to segment the image which has been processed by OSTU method in order to avoid the oversegmentation from the watershed algorithm.

**(a) Grayscale image**

**(b) Gradient image**

**(c) OSTU**

**(d) Watershed 1**

**(e) Watershed 2**

**(f) Qtdecomp**

**(g) Sobel**

**(h) Canny**

**(i) Wavelet precise integration**

The segmentation results are shown in Figure 2. The watershed algorithm segmentation result shows serious oversegmentation (Figure 2(d)) and cannot recognize the infected part. Although OSTU method separated part infected region of the onion, the partition boundary is discontinuity and is difficult to measure infection specific gravity. To avoid oversegmentation, OSTU was overlapped with the watershed segmentation. The result is shown in Figure 2(e) in which the partition boundary is clear but is unable to distinguish the virus infected part. The Sobel operator recognition on the part of the infection is also not good (Figure 2(g)). Canny operator and Qtdecomp algorithm identified the area of infection, but the boundary points of segmentation region are disorder and cannot be measured. The precise integration method presented in this paper can identify the infected area clearly. So, it is helpful to onion evaluation and classification.

In fact, it is impossible to project image segmentation by a single algorithm. The important reason that partial differential equations are effective for image segmentation is that the method integrated many image segmentation principles to the model of partial differential equations. In this paper, the C-V image segmentation model is a global convex optimization variational model, which is established on image piecewise smooth ( and are the average gray values inside () and outside () of the object contour, respectively). To ensure the accuracy of image segmentation, the curvature of the image, the border gradient, and level set function evolution were taken into account in image segmentation. It means that the global convex optimization model of image segmentation has been built based on integration of a variety of image segmentation theories and has obvious advantages. In addition, the method of iterative solution of the self-adaptive method can also be integrated into the segmentation process to ensure the accuracy of segmentation method further. However, the speed of the algorithm will be affected. Therefore, it is important to find efficient and accurate numerical method.

##### 4.2. Efficiency Comparison of Multiscale Adaptive Wavelet Numerical Method and Difference Method

The C-V model was used for 256 × 302 images segmentation and divided difference method was used to disperse partial differential equations. So discrete 7312 () ordinary differential equations are huge solving workload. But the adaptive wavelet precise integration method can reduce the scale to 9576 equations. It can improve solution efficiency greatly due to less workload and low memory demand. Of course, the use of adaptive wavelet precise integration method for solving the number of distribution points will dynamically change as the solution process. In addition, as shown in Figure 3 distribution points are relatively dense within the ellipse ring and another location was sparse. The evident grayscale difference between the infected and the healthy parts lead to this special points distribution. Furthermore, distribution points also exhibit regular matrix form, which result from block solving method of wavelet transform to improve the efficiency. The matrix-like distribution is from the boundary effect among the different blocks. The interval wavelet can effectively reduce the range effect, but it will also increase the computation work of the wavelet transform.

In this paper, difference method was tested in MATLAB. The wavelet interpolation operator was implemented with VC programming and other parts with MATLAB programming. On the same computer, difference method takes 0.3 seconds, the adaptive wavelet precise integration method takes 0.18 seconds. The results also show that the wavelet transform of the iterative process reduces the overall computational efficiency of the algorithm.

#### 5. Conclusions

Shannon wavelet precise integration method is a new image segmentation method based on the C-V model, which was used to construct adaptive wavelet interpolation operator due to multiscale characteristics of wavelet transform combined with the time precise integration technology. The method makes full use of the multiscale characteristics and the high precise performance of precise integration method. Compared to the gradient method and wavelet transform method of image segmentation, object boundary obtained by WPIM segmentation method is clear and closed; compared to the watershed method, the WPIM method avoids over- and undersegmentation problems and is very suitable for measurement of image segmentation, such as onion quality assessment.

The adaptive interpolation operator in the Shannon wavelet precision integration method can reduce the amount of the collocation points and improve the calculation efficiency. As the interpolation operator contains a wavelet transform process, the corresponding algorithm needs to do a wavelet transform between each two iteration time steps. So the cost of the wavelet transformation is an important part of the calculation amount of the algorithm. Compactly supported orthogonal wavelet function can be expected to solve the problem.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgments

The authors appreciate the funding support from National Natural Science Foundation of China (Award nos. 41171184 and 41171337). The software tools were provided by the Food and Fiber Sensing Lab of University of Georgia and the Computer Center of China Agricultural University.