Automatic Crack Detection in Eggshell Based on SUSAN Edge Detector Using Fuzzy Thresholding

,


Introduction
Generally, crack defections are the most important in processing and grading Table eggs (Brake J., 1997) because the presence of eggshell crack is one of the most influential factors in the quality and price of eggs (Brake J., 1997).Besides, eggshell has great resistance to the entry of micro-organisms (Solomon, S. E., 1991), (Rachel K. et al, 2005).Eggshell cracks are a food safety concern because micro-organisms can allow contamination of the egg cause by pathogens, such as Salmonella (Pourreza R., 2008).If they penetrate in to the shell, the egg will be poisoned and the health of the consumers will be threatened.
In egg grading and packaging centers, an inspector sorts the abnormal eggs, including blood defections or dirt defection as well as cracked eggs, from normal eggs by observation with the naked eye using the candling method.As intelligence level of human operator is decreased gradually, by difficult conditions of working environment such as air or sound pollution, it is probable that some surface defection is hidden from human remind the operator's eye.So, developing an algorithm for automatic detection of the defects which lacks disadvantages of human operator work seems necessary.One application of this system may be elimination of defective eggs before reaching the coloring, packaging or sorting stages.This will reduce unnecessary costs and subsequent satisfactions of customers lead to.
In order to solve the above mentioned problems and automatic detection of eggshell cracks, two common techniques, machine vision (Pourreza R., 2008) and Digital Signal Processing (DSP) (Cho, H. K, et al., 2000;Karoui, R. 2009) have been developed (Baerdemaeker, 2000;Cho, H.K, et al., 2000).DSP is based on the analyses of the acoustically measured frequency response of an egg aroused with a soft impact on different locations on the eggshell equator (Das, K.1992;Chalker, B. A., 2003).In industrial place where there is a lot of noise, these methods do not work efficiency in the process and take a long time to detect cracks.Up to now, different researchers have made efforts in the area of automatic detection of defects egg by image processing technology and machine vision, Patel, V.C, (1998) have used classical transforms on colored images (Elster, R., 1991;Ribeiro, A., (2000) have used thresholding and found the threshold using high pass filters has been suggested used laplacian and gradient North-West filters for detecting cracks (Baerdemaeker, 2000).All of these algorithms are highly sensitive to noise because they used derivative and gradient operators (Gonzalez, C. 2004).But Smith (Smith S. M., and Brady J.M., 1997) developed a very simple edge detector that uses no spatial derivatives at all.The Smith edge detector does not require any smoothing and so there is no degradation in localization accuracy due to smoothing.
The present study aims at presenting an efficient algorithm for crack detection in eggshell, our approach is based on Fuzzy theresholding and SUSAN edge detector, because SUSAN edge detector used no derivative ,compared with other method, this approach is less sensitive to noise and this is considered the main advantage of this method.

Fuzzy C-Means Algorithm
Fuzzy C-Means (FCM) is a method of clustering which allows one piece of data to belong to two or more clusters.This method is used in image processing for segmentation (especially background elimination).It is based on minimization of the following objective function: (1) where m is any real number greater than 1, uij is the degree of membership of xi in the cluster j, xi is the ith of d-dimensional measured data, cj is the d-dimension center of the cluster, and ||*|| is any norm expressing the similarity between any measured data and the center.Fuzzy partitioning is carried out through an iterative optimization of the objective function shown above, with the update of membership uij and the cluster centers cj by: (2) (3) This iteration will stop when , where is a termination criterion between 0 and 1, whereas k is the iteration steps.This procedure converges to a local minimum or a saddle point of J m .

Initialize U=
The class membership of pixels can be interpreted as similarity or compatibility with an ideal object or a certain property.
Since FCM algorithm is an iterative operation, it is very time consuming which makes the algorithm impractical used in image segmentation and background elimination.

Fuzzy thresholding algorithm
The general principle of the Fuzzy thresholding is to incorporate the neighborhood information into the Fuzzy C-Means (FCM) clustering algorithm.
To cope with this problem, the gray level histogram of image is applied to the algorithm (Yong et al., 2004).
In the standard FCM algorithm for a pixel I x k  where I is the image, the clustering of k x with class i only depends on the membership value ik u , if we consider noisy image, after clustering process is related only to gray levels independently on pixels, FCM is noise sensitive.Considering the influence of the neighboring pixels on the central pixel, the Fuzzy membership function can be extended to: . n is the number of pixel, and ik p is the probability of data point k belonging to cluster i ,referred to as weight in this paper which can be determined by the following neighborhood model.Therefore the degrees of membership * ik u and the cluster centers i v are now updated via: The core idea now is to define the auxiliary weight variable ik p , which is priori information to guide the outcome of the clustering process.
Where k N is the data set of the nearest neighbors of central pixel k , and of the data belonging to class i which is got after defuzzyfying the result of the FCM algorithm.
When the algorithm has converged, a defuzzification process then takes place in order to convert the Fuzzy partition matrix U to a crisp partition.A number of methods have been developed to defuzzyfying the partition matrix U, in which the maximum membership procedure is the most important.The procedure assigns object k to the class C with the highest membership.
)} {max( arg For image thresholding c is equal two in equation ( 10).It is easily verified that this technique is almost equivalent to thresholding the image using the maximum membership procedure.

SUSAN edge detector
Although much of the methods edge detection includes at least one non-linear stage, the SUSAN approach represents a somewhat different method for edge and feature extraction, since it is almost entirely based on non-linear filtering (Mertens K., 2005).The basic idea of the SUSAN method is to associate to each pixel of the image a small area of neighbor pixels with similar brightness to this center pixel.This small area is called the "USAN" (for "Univalve Segment Assimilating Nucleus").From the size, centroid and axis of symmetry of these areas, edges and more general "localized features" are located.According to the SUSAN principle, "an image processed to give as output inverted USAN areas has edges and two-dimensional features strongly enhanced, with the two dimensional features more strongly enhanced than edges".The method then resumes in the search for local minima of the USAN areas, hence the acronym SUSAN, for "Smallest Univalue Segment Assimilating Nucleus".The SUSAN edge finder has been implemented using circular masks (sometimes known as windows or kernels) to give isotropic responses.Digital approximations to circles have been used, either with constant weighting within them or with Gaussian weighting (Bezdek J. C., 1981).The usual radius is 3.4 pixels (giving a mask of 37 pixels), and the smallest mask considered is the traditional three by three mask.The 37 pixel circular mask is used in all feature detection experiments unless otherwise stated.This mask has the following form: (11) The mask is placed at each point in the image and, for each point; the brightness of each pixel within the mask is compared with that of the nucleus (the center point).Originally a simple equation determined this comparison.is the brightness of any pixel, t is the brightness difference threshold and c is the output of the comparison.This comparison is done for each pixel within the mask, and a running total, n, of the outputs is made: (13) This total n is just the number of pixels in the USAN, i.e. it gives the USAN's area.The parameter t determines the minimum contrast of features which will be detected and also the maximum amount of noise which will be ignored.Next, n is compared with a fixed threshold g (the geometric threshold), which is set to

max 4 n
where n max is the maximum value which n can take.The initial edge response is then created by using the following rule: (14) Where 0 ( ) R r  is the initial edge response.This is clearly a simple formulation of the SUSAN principle, i.e., the smaller the USAN area, the larger the edge response.When non-maximum suppression has been performed the edge enhancement is complete.

Compilation Samples
The eggs used in this study were selected from local market in Sorkh Hesar town (Tehran, Iran).Damaged eggs were removed then the eggs were cleaned in an air screen cleaner to remove all foreign matter such as dust, dirt and feather.

Candling method and image technique
Candling is the only method of testing eggs for quality, internally and externally, without breaking them.It consists of a lamp with a dark box that makes the interior quality visible (FAO;2003).In this study the eggs positioned on the hole in dark box and cracks on surface egg were appeared.Then the main image was taken by a CCTV camera with CCD 16 mm lens that placed on 0.3 meter height from egg surface.The imaging system was used to obtain color images of cracked eggs and healthy one an egg.
For process of image MATLAB version software was used for input image.The experimental apparatus and the methods are described in Figure 1 (Kazuhiro nakno et al., 1998).

Binerization and image enhancement
In this stage, first the input image that was color image is transformed to gray level by using Binerization equation of MATLAB software.Then gray level image is transformed to binary image by Fuzzy thresholding algorithm.In this step the gray level image was converted to two clusters that one of them was object with matrix value one and the other was background zero.After calculating the Fuzzy thresholding matrix this matrix was multiplied to gray level matrix for background elimination.To improve the efficiency of crack detection in eggshell by using SUSAN edge detector a contrast enhancement method was applied.The flowchart of algorithm is shown in the following Figure2.
The final result of preprocessing stage was considered as the input of SUSAN edge detector.Whit Consideration to top section and the main input image for processing, proposed algorithm for each pixel in main input image were used as the center of a small circular mask for detection crack on surface eggshell.For evaluating our algorithm, we defined an error function, the error function is is the same result with variable level of noise. in order to evaluate the performance of the SUSAN edged Detector, a standard test image of an eggshell crack was taken and its edge was detected using otsu, Brink, Yang edge detector then evaluated the performance of our algorithm in comparison with the performance of other algorithms for crack detection in presence of noise with different level of variance, these algorithm were used by (Maria P., et Al., 2009), (Ribeiro, A., et al., 2000), (Patel V.C., 1998) and [17].

Results and discussion
The evaluations showed that binerization with Fuzzy thresholding toward other algorithms truly found round of the eggs Figure 3.while, Yang, Brink and Gatos algorithm in the presence of noise cannot detected edge of eggs but Fuzzy thresholding edge detection showed best result.However in some time these algorithms at particular qualification truly solutions.Also used power law algorithm for contrast enhancement in image after fuzzy binerization showed Figure4 (b) in Figure 4(a).Otsu binerization showed that in comparison with other algorithms not been special prominence.After applying power law evaluated noise in the background main input image Figure 5.
It has been observed that the SUSAN edge detector works well four algorithms with the Gaussian as well as Poisson noise corrupted images.Figure 5 for the reason that this algorithm not used of the derivative operator and had minimum error function in detection of the eggshell crack.For demonstrating the presence of noise, a narrow band was selected from background and the histogram was plotted, as see in the Figure 6 histogram has some values instead of one value, this because of noise.
After that, added a Gaussian noise with variable level of noise variance and the number of error pixel were found, the variances were between 0.001 and 0.01.We tested proposed algorithm for the all of the images in the database.To demonstrate the performance of the proposed algorithms, a sample of five hundred eggs, 350 broken and 150 healthy, were analyzed for sorting purposes and final inference for acceptance or rejection.The results are shown in the following Figure 7.
In Figure8 showed of the value correct detection of pixel in main input image that percentage of the proposed algorithm in comparison with other algorithm.In Status that noise is equal zero percentage of correct pixels was 98% and in noise 0.01 was 82%.While value other algorithm from sensitive at noise have minor percentage in correct detection pixel.
The processing time for individual image processing is about 0.3 second after converting Matlab codes to C++ that processing time is less than other approach in this field.

Conclusion
The 3 main quality defects occurring in eggs are cracks, blood spots in the albumen, and dirt stains on the shell surface.By using an image-processing algorithm, the non-destructive methods to detect the cracked eggs can be developed.In this paper, an attempt is made to evaluate the performance of the SUSAN edged Detector for noisy images based on fuzzy thresholding.Experimental results have demonstrated that the SUSAN edge Detector works quite well for digital images noisy with Gaussian noise Because the SUSAN algorithm uses no derivative too the proposed algorithm is less sensitive to noise than other edge detectors.From the results mentioned above, it is clarified that the proposed method that uses no derivative is very useful in detecting cracked eggs from healthy ones.Meanwhile this algorithm in comparison with other method had processing time less than other in this field.

Acknowledgment
The authors would like to express their appreciation to the Islamic Azad University, Majlesi Branch for full support of the project.
of the nucleus in the two dimensional image, r  is the position of any other point within the mask,

Figure 1 .
Figure 1.Apparatus for taken image at eggs