Detection of Wormhole in Maize based on Kernel RGB Image and Lighting Transformation Method

To effectively extract wormhole areas in kernels of maize, the uneven intensity distribution that was produced by the lighting system or by part of the vision system in the image must be transformed. A methodology was developed to convert non-uniform intensity distribution on objects into a uniform intensity distribution. A basically plane image with the wormhole area having a lower gray level than this plane was obtained by using proposed algorithms. Then, the wormhole areas can be easily extracted by a global threshold value. The experimental results with a 99.0% classification rate based on 100 kernel images showed that the proposed algorithm was simple and effective.


INTRODUCTION
Currently, machine vision technology is becoming more popular in the agricultural products quality and safety research filed (Abbott, 1999;Chen et al., 2002;Brosnan and Sun, 2002;Ma et al., 2009;Liu and Ying, 2005;Ying and Liu, 2008).However, one concern for the image acquisition is that the lighting on agricultural products is not uniformly distributed (Tao, 1996).This generally results in a darkening of the edges of the object, while the central part appears brighter (Aleixos et al., 2002).Moreover, this darkening of the edges can even lead to sound area frequently being mistaken for defective areas in the detection of defects for agricultural products (Gómez-Sanchis et al., 2008).Therefore, some researchers have addressed the issue by using the proper lighting system (Yang, 1993;Leemans et al., 1998;Moltó et al., 1998), flat field correction (Kleynen et al, 2005), local thresholding (Blasco and Moltó, 2002) and so on.Although a lot of work have been done, but it was not very effective.Maize is a widely grown crop in the world recently.The quality of kernel is very important to high yields and quality of corn.So, selection of kernel is essential.Usually, chemistry technology is a main evaluation method for quality of kernel.However, this method is extremely low efficiency and high intensity.Currently, computer vision technology is gradually used to evaluate the quality of kernel (Hao et al., 2008;Han and Zhao, 2009;Shi et al., 2008;Liao et al., 1992, Ni et al., 1997).The aim of this study is to effectively extract wormhole areas in kernels of maize based on kernel RGB image and lighting transformation method.

Samples:
In this study, 100 kernels of maize were selected.In the laboratory, they were separated into group I (37) and group II (63) by visual inspection.Note that the group I represents the kernels of maize with wormhole areas and the group II represents the sound kernels of maize without any defects.
Image acquisition: The machine vision system for sample images acquisition consisted of a computer equipped with image capture card (X64-CL-Express, DALSA, Canada), a RGB color CCD camera (AD-080GE, JAI, Japan) with lens (LM6NC3, Cowa, Japan), a lighting chamber with white LED lights and the inner surface of lighting chamber was painted black.Every image captured has a resolution of 768×1024 pixels.The schematic of the whole imaging system was shown in Fig. 1.

Lighting transform algorithm:
The basic nature of a kernel image, f (x, y), captured using an area scan camera imaging, may be characterized by two components: illumination component i (x, y) and reflectance component r (x, y).Then, the image f (x, y) can be formed by combining i (x, y) and r (x, y) as a product: F (x, y) = i (x, y) r (x, y) (1) The illumination component of a kernel image generally is characterized by the slow spatial variations,  Multiply the input image by (-1) x + y to center the transform and compute Fourier transform F (u, v) by the following equations: where, [•] demotes the Fourier transform.Multiplying f (x, y) by (-1) x + y shifts the origin of F (u, v) to frequency coordinates (M/2, N/2), which is the center of the MN area occupied by the two dimensions Discrete Fourier transform. The Fourier transform of output image is given by: where, G (u, v) : Fourier transform of output image H (u, v) : A low pass filter function F (u, v) : The Fourier transform of input image The H (u, v) was used to obtain the low frequencies that represent illumination information in the image.A Butterworth low pass filter of order 1 was used Therefore, in this study , the Butterworth low pass filter of order 1 was selected because it has no ringing and it has the strong adaptability comparing to ideal low pass filter and Gaussian low pass filter.The filter is defined as (Gonzalez and Woods, 2010): where, D 0 : Cutoff frequency D(u, v) : The distance from any point (u, v) to the center (origin) of the Fourier transform  Obtained the illumination component image g(x, y): where, -1[•] denotes the inverse Fourier transform; The real part is selected in order to ignore parasitic complex components resulting from computational inaccuracies. Once the g(x, y) is generated, the corrected image (x, y) could be given by: ( , ) ( , ) 255 ( , ) The (x, y) is basically a plane image with wormhole areas below the plane in gray levels.The binary image d (x, y) with only wormhole areas can be easily obtained by the following global threshold operation: where, T is the threshold setting at or near the flat plane in the.(x, y) The threshold is useradjustable for wormhole areas sensitivity adjustment.
Background segmentation: In order to enhance the contrast between background and objective, the black background is used in this study.First, a sample RGB image is randomly selected from all acquired images.Then, three single component images (R component, G component and B component) are extracted and analyzed.The results show that R component is potential for extracting wormhole area since the clear contrast between wormhole area and sample sound surface and R component is also potential for removing background since clear contrast between background and sample area.Therefore, R component is used in the next study.Figure 2 shows the three component images of a sample with wormhole area.Figure 2b is R component image, Fig. 2c is G component image and Fig. 2d is B component image.In order to more distinct contrast, the original RGB image is also shown in Fig. 2a.Mask method is used to remove background of R component image.First, a mask template image I R is built.Observing the histogram of R component, we found that a binary mask image was easy to be obtained by applying threshold of 15 to this component image.In order to obtained single sample objective, the following equation need to be performed: where, R : R component image I mask : The binary mask image The detailed method for background segmentation can be found in reference (Leemans et al., 1998).
Morphology operation: Morphological filtering was used during wormhole areas extraction with an aim of removing undesired small size pixels in the binary images.The morphological opening operation based on a rectangle structuring element with a 1×1 kernel size in MATLAB morphological filter tools were used in this study and defined as erosion of the image by structuring element, followed by a dilation of the result by same structuring element.

RESULTS AND DISCUSSION
Figure 3 shows the binary mask and R component image after removing background.Figure 3a shows the binary mask image obtained from R component.Figure 3b is the R component image after removing background based on mask method.Seen from Fig. 3b, the background is completely removed and the single sample with wormhole area is completely retained.
The aim of this study is to effectively extract wormhole areas in kernels of maize based on original RGB images and illumination transform algorithm.Figure 4 is a typical example.Figure 4b is the transformed image by applying the lighting transform method proposed to R component shown in Fig. 2b. Figure 4a is the illumination component image, or called the lighting mask, obtained from Fig. 3b.Before applying the transformation method, it can be observed After obtaining the lighting mask and applying it to original image, as shown in Fig. 4b, the sample displays a uniform intensity distribution over the whole surface and preserves the wormhole area.This fact is even more apparent in Fig. 5. Figure 5a shows the intensity distribution of uncorrected original R component image.The different color corresponds to different gray level.From mazarine blue to yellow, the gray level gradually increases.In contrast, Fig. 5b shows the intensity distribution over the whole sample surface after correction.As show in Fig. 5b, the intensity level (in yellow or red) of edges of sample is converted to the similar intensity level to normal center surface (in dark red).
Figure 6 is the resultant binary wormhole areas image obtained by applying a simple thresholding method to Fig. 4b.Seen from the binary image, the wormhole areas is effective segmented avoiding the influence of uneven illumination on the sample surface.Before obtaining the Fig. 6, morphological opening operation was used to remove some small noises.The proposed lighting transformation method for detecting the wormhole areas in kernels of maize was evaluated using 100 sample images.The results are shown in Table 1.As shown in Table 1, an overall detection rate of 99.0% was achieved.(97.3%) of samples with wormhole areas were correctly classified.One defective sample is misclassified as healthy samples.We observed that wormhole areas in R component image of these misclassified samples are not very clear due to similar color to normal peel.That may be the reason for the low classification accuracies for samples with wormhole areas.100% healthy samples are corrected classified.This result is satisfying.

CONCULION
The extraction of wormhole areas in kernels of maize is a critical step for maize quality detection based on machine vision technology.The success of this step will lay a foundation for further analysis and sorting.In this study, a novel method was developed based on RGB image and lighting transformation method for extracting wormhole areas in kernels of maize.One hundred sample images were used to estimate the performance of algorithm.An overall classification rate of 99.0% was achieved.Further research will focus on increasing the sample size and collecting samples with other types of external defects to evaluate the quality of kernels.

Fig. 1 :
Fig. 1: Machine vision system used to acquire images of kernels while the reflectance component tends to vary abruptly.These characteristics lead to associating the low frequencies of the Fourier transform of an image with illumination and the high frequencies with reflectance.The illumination component image can be obtained by the following steps: Fig. 2: (a) Original RGB image with wormhole area, (b) R component image, (c) G component image and (d) B component image

Table 1 :
The detection results of kernels with wormhole areas