Dirt Detection on Brown Eggs by Means of Color - Poultry Science

Jo Welch | Download | HTML Embed
  • Sep 7, 2005
  • Views: 14
  • Page(s): 7
  • Size: 293.02 kB
  • Report

Share

Transcript

1 Dirt Detection on Brown Eggs by Means of Color Computer Vision K. Mertens,*,1 B. De Ketelaere,* B. Kamers,* F. R. Bamelis,* B. J. Kemps,* E. M. Verhoelst,* J. G. De Baerdemaeker,* and E. M. Decuypere* *Egg Quality and Incubation Research Group, Faculty of Applied Bioscience and Engineering, Katholieke Universiteit Leuven, Kasteelpark Arenberg 30, 3001 Heverlee, Belgium ABSTRACT In the last 20 yr, different methods for de- line set-up. In an experiment, 100 clean and 100 dirty tecting defects in eggs were developed. Until now, no eggs were used to validate the classification algorithm. satisfying technique existed to sort and quantify dirt on The designed vision system showed an accuracy of 99% eggshells. The work presented here focuses on the design for the detection of dirt stains. Two percent of the clean of an off-line computer vision system to differentiate and eggs had a light-colored eggshell and were subsequently quantify the presence of different dirt stains on brown mistaken for showing large white stains. The accuracy of eggs: dark (feces), white (uric acid), blood, and yolk stains. differentiation of the different kinds of dirt stains was A system that provides uniform light exposure around 91%. Of the eggs with dark stains, 10.81% were mistaken Downloaded from http://ps.oxfordjournals.org/ by guest on September 12, 2016 the egg was designed. In this uniform light, pictures of for having bloodstains, and 33.33% of eggs with blood- dirty and clean eggs were taken, stored, and analyzed. stains were mistaken for having dark stains. The devel- The classification was based on a few standard logical oped system is possibly a first step toward an on line dirt operators, allowing for a quick implementation in an on- evaluation technique for brown eggs. (Key words: computer vision, dirt detection, brown eggs, egg grading) 2005 Poultry Science 84:16531659 For the other quality aspects, there is a need for further INTRODUCTION research. Studies on blood spot detection using spectro- metric methods have shown good results in white eggs Whereas collecting and packaging eggs already is au- but disappointing detection rates in brown eggs (Brant tomated, some egg-grading aspects, such as quality, still et al., 1952; Gielen et al., 1979). For dirt detection on require improvement. The 3 main quality defects oc- eggs, the technique of computer vision appears to offer curring in eggs are cracks, blood spots in the albumen, interesting results (Patel et al., 1994b; Garca-Alegre et and dirt stains on the shell surface. The detection of al., 1997, 2000; Ribeiro et al., 2000). cracks in eggshells has been implemented in on-line In the last 20 yr, several researchers have used com- grading machines for years now. The method developed puter vision to detect defects in eggs. Elster and Goo- by Bliss (1973) is based on the analysis of the response drum (1991), Goodrum and Elster (1992), Patel et al. of a piezo sensor when excited by a rolling egg, and is (1994a,b), Han and Feng (1994), Garca-Alegre et al. commercially available from Diamond Systems.2 Moay- (1997, 2000), and Ribeiro et al. (2000) all reported meth- eri (1996) described a methodology of detecting cracks ods of detecting egg defects based on a vision system. based on the number of rebounds of a small iron sphere Patel et al. (1998) carried out a study to differentiate after impacting the egg. This system has been commer- blood spots, dirt stains, and cracks by training neural cialized by Moba BV.3 Both methods provide local infor- networks with color histograms obtained from color im- mation and require multiple (up to 24) measurements. ages. It resulted in a good performance for one defect Coucke (1998) and De Ketelaere et al. (2000) developed but was unable to evaluate eggs showing more than one an alternative system based on acoustic resonance defect. Up until now, no studies presented quantified analysis. results on differentiation of dirt stain detection on eggs. Dirt detection in the grading process is still performed mainly by human graders, and as egg processing speed 2005 Poultry Science Association, Inc. Received March 3, 2005. runs up to 120,000 eggs/h, a grader must inspect at 12 Accepted June 15, 2005. eggs/s, resulting in false rejects and false approvals. 1 To whom correspondence should be addressed: [email protected] Whereas false rejects generate economical losses, false biw.kuleuven.be. 2 Farmington Hills, MI. approvals can be hazardous to health due to the pres- 3 Barneveld, The Netherlands. ence of high levels of bacteria in the dirt stains. This 1653

2 1654 MERTENS ET AL. candling performance varies with different factors, as was separated from its background, consisting of the described by Oosterwoud et al. (1976). bottom plate of the frame and the rollers. Both compo- Dirt stains on eggs are caused mainly by feces (black nents are colored blue because this color is not present to light brown stains), uric acid (white stains), yolk, as in the eggshell or in dirt. In this way, one gets a good a result of leaking of other eggs, and blood. The present discrepancy between both egg and background. Starting work focuses on the design of an off-line computer vi- from an original color image acquired by the camera, sion system to detect, differentiate, and quantify differ- the egg is isolated by the following steps. 1) The color ent dirt stains on brown eggs. The objective of this study image is converted into a grayscale image by selecting is to develop a system based on simple logical operators, the saturation plane. In this plane, a high discrepancy using an algorithm that works independently of varia- in gray values of the egg and its background is achieved. tions in certain parameters, such as shell color, color of The resulting image displays the eggshell as light-gray, the dirt stain, egg shape, and so on, and to display results and possible dirt stains and the background as darker that are easy to interpret. gray. 2) Application of a median filter with kernel 3 3 to smooth the image. 3) A histogram of the resulting MATERIAL AND METHODS grayscale image is made, and a threshold is set at a value of 150. This generates a binary image of the egg surface with value 1 (white), and the background and Hardware possible dirt stains on the egg with value 0 (black). In this way the egg is considered as a white particle in the Downloaded from http://ps.oxfordjournals.org/ by guest on September 12, 2016 In order to use computer vision to evaluate objects black background. 4) In order to fill black holes in the by an algorithm, it is important to create a uniform light white egg (caused by possible dirt stains), subsequently field around the object. To achieve this and additionally a closingopeningclosing function (in this order) with to eliminate any effect of environmental light, a cubic a square frame consisting of a 3 3 structuring element box of 0.80 0.80 0.80 m with white reflecting walls using connectivity 8, is applied. This results in a binary was constructed. At every wall on the inside of the box, image showing the complete egg as a white particle except the bottom, 4 high-frequency tubular lamps4 (value 1) in a black (value 0) background. From this were attached, 20 lamps in total. point on, this image is used as a mask to define the A white frame of aluminum plates was used to mount region of interest for the rest of the processing program. an electric motor and small specially designed rubber 5) Finally, the total number of pixels in the whole egg rollers to support the egg. This frame is also used and (pixels with value 1) is counted. described by Coucke (1998) for the detection of cracks Dirt Detection. Generally, there are 7 main processing using the acoustic resonance technique. The eggs were steps discernable in the detection of every kind of dirt. rotated around the longitudinal axis by the rollers. The 1) Preprocessing of the color image is the step only done rollers and the bottom of the frame were colored in in the detection of bloodstains. A logical XOR operation blue in order to simplify the separation of the egg from (mathematical operator: 0xor0=0; 0xor1=1; 1xor0=1; its background. 1xor1=0) between the original image and the color red Above the set-up, a digital camera5 was placed and was performed to accentuate the red color in the blood directed to the frame. This camera acquires images taken and to remove red from the brown shell leaving it green- in the red-green-blue color space (640 480 pixels) of colored. Subsequently, subtracting (mathematical oper- the egg at 30 frames/s. Figure 1 shows a picture of the ator) the color green results in a blue egg with red stains test set-up. The camera was connected to a computer in a pinkish background. In this way there is a clear through a fire wire connection. The pictures acquired color difference between the stains and the eggshell. 2) by the camera were processed in Labview 6.0.6 The second step is color plane extraction. In this step, the original color image was converted into a grayscale Software image by extracting the color plane that shows the best discrepancy in grayscale values between the dirt stains A classification program was developed to detect dark and the eggshell. 3) Optimizing brightness-contrast stains caused by feces, white stains caused by uric acid, properties is the third step. In order to improve this egg yolk stains, and bloodstains. There are 2 major steps difference in grayscale values between dirt and eggshell, in this program. First, the detection of the egg to define the brightness and contrast properties of the image were the region of interest for the detection of dirt stains, and optimized. This was achieved by histogram equalization second, the detection and classification of the dirt. and, in the case of white stain detection, by a gamma Isolation of the Egg from Its BackgroundDefin- correction. 4) When an optimal difference between dirt ing the Region of Interest. In the first step, the egg and eggshell was obtained, the gray-scale image was transformed into a binary black and white (0 or 1) image by setting a threshold. The threshold was set in function 4 Philips Master TL5 HE Super 80 14W/865 SLV, Royal Philips Elec- of the histogram of the gray-scale image. The resulting tronics, Eindhoben, The Netherlands. 5 Sony DFW-VL500, Sony Corp., Tokyo, Japan. image will show the stains as white particles (value 1) 6 National Instruments Corp., Austin, TX. in a black background (value 0). 5) In this fifth step,

3 DIRT DETECTION ON BROWN EGGS 1655 Figure 1. The experimental test set-up. Left: Outside view showing the camera (instake) on top of the cubic box. Right: Inside view showing the frame with blue rollers and bottom plate and the tubular lamps against each wall. Downloaded from http://ps.oxfordjournals.org/ by guest on September 12, 2016 the region of interest was defined in order to exclude in 2 steps: first, the white, dark, and bloodstains, and possible particles in the background. To define this re- second, the yolk stains. This was because the detection gion of interest, an image mask was applied using the method to check for yolk stains also detects the other binary image resulting from step 1, detecting the region kinds of dirt, whereas the detection methods of the other of interest. Applying an image mask was done by per- kinds of dirt were unable to detect yolk. This is the forming a logical AND operation between these two reason why eggs are first checked for the first 3 kinds images. In this way, the pixels of the image coinciding of dirt stains. Then, when none of them is detected, the with the pixels of the image mask with value 0 are set egg is examined for yolk stains. to 0, and the pixels coinciding with the pixels of the Evaluation. After the number of pixels of the whole image mask with value 1 retain their original value. This egg and of the possible stains was determined, the per- means that all background pixels are set to 0. 6) The centage of every kind of dirt was calculated from: application of a particle filter removes all particles with a size between 0 and 5 pixels. This was done to correct Number of pixels dirt for particles that were wrongfully detected as dirt stains 100 = % dirt [1] Number of pixels whole egg but could be caused by pigmentation or small shell irreg- ularities. 7) In the last step, a particle analysis was car- ried out to count the total number of pixels in the differ- The processing time for the evaluation of 1 picture of ent particles of the dirt stains. an egg takes about 165 ms of time. In order to obtain In Table 1, a survey is given of the specific application all of the information regarding possible dirt present of the different processing steps to detect the different and hence to be able to obtain repeatable measurements, kinds of dirt. The detection of dirt stains was performed 15 pictures should be taken of every egg while spinning around its axis. To define this optimal number of pic- tures, an experiment was carried out using 400 dirty eggs. In this experiment, the number of pictures that was taken to make an evaluation was increased stepwise from 1 to 20. In every step, each egg was evaluated 5 times and subsequently the CV of the total dirt percent- age of the egg was calculated. The average CV per num- ber of pictures taken is shown in the graph in Figure 2. It was found that the global optimal number of pictures to be taken was 15. These 15 pictures were evaluated separately for the different kind of dirt stains as de- scribed above. The sum of these results was the total percentage of every kind of dirt stain. Finally, these different percentages of dirt stains on the eggshell were added up to obtain the total percentage of dirt on the Figure 2. Graph showing the variation between 5 evaluations of the same egg by the vision system in function of the number of images examined egg. If this value exceeded the detection limit taken for the evaluation. of 0.05%, the egg was evaluated as being dirty.

4 1656 MERTENS ET AL. Table 1. Survey of the different image processing steps for detection of the different dirt stains Processing step White stains Dark stains Blood stains Yolk stains Color image Preprocessing Logical operator: (original image) XOR (color red) Subtraction color: green Color plane extraction Blue plane Red plane Red plane Saturation plane Grayscale image Optimizing brightness- Histogram equalization Histogram equalization Histogram equalization Histogram equalization contrast values of 31 to 248 interval of 0 to 185 interval of 77 to 181 interval of 27 to 210 interval Gamma correction: = 2.0 Threshold 150 145 150 80 Binary image Image mask Image mask Image mask Image mask Image mask Particle filter 0 to 5 pixels 0 to 5 pixels 0 to 5 pixels 0 to 5 pixels Particle analysis Pixel count Pixel count Pixel count Pixel count some of the resulting pictures when processing an origi- Downloaded from http://ps.oxfordjournals.org/ by guest on September 12, 2016 Experiments nal image to isolate the egg from its background. To calibrate the designed set-up, 400 dirty and 100 Furthermore, as an example for the dirt detection, clean Isa Brown eggs were evaluated. To test whether Figure 5 is showing the different steps for detection of the set-up is applicable for dirt detection in practice, a white stains caused by uric acid. validation experiment was carried out. For this experi- The result of the experiment in order to define the ment, 200 Isa Brown eggs were used, 100 clean and 100 number of pictures that should be taken per egg to ob- dirty eggs. The classification of the eggs as clean or dirty tain repeatable measurements, is shown in Figure 2. was performed beforehand by the producer on the farm. In general, processing of every captured image re- Afterward, the eggs with an open breakage were re- sulted in 4 (when the system didnt perform the detec- moved and the different kinds of stains on each dirty tion of yolk stains because of presence of other stains) egg was observed and noted. Subsequently, each egg or 5 (when yolk stains were detected) binary (black- was placed in the test set-up and evaluated by the de- white) images. The first image showed the whole white signed vision system. Finally, the noted observations of egg in its black background. The other 3 or 4 images the human vision and the results of computer vision displayed white particles of possible dirt stains in a black were compared. background. The determination of the total number of pixels in the white particles of every binary image re- RESULTS AND DISCUSSION sulted in numbers that quantify either total pixels in the egg or total pixels in possible dirt stains. These numbers Vision System were plugged into equation [1] to calculate the dirt per- centage. When defining the region of interest (step 3), a thresh- The presented off-line computer vision system fo- old value was set based on the histogram of the grayscale cused on the detection and differentiation of dirt oc- image after selection of the saturation plane. This histo- curring on the shell of brown eggs, based on color im- gram is shown in Figure 3. In addition, Figure 4 shows ages. This differentiates the presented research from previous work (Elster and Goodrum, 1991; Goodrum and Elster, 1992; Patel et al., 1994a,b, 1998; Han and Feng, 1994; Garca-Alegre et al., 1997, 2000; Ribeiro et al., 2000), which focused on detecting several egg de- fects, like shell cracks, internal blood spots, and dirt, using computer vision and neural networks. Further- more, the classification of the dirt was based on simple logical operations, whereas complex manners of image processing were described in the literature, such as neu- ral networks by Patel et al. (1994, 1998), mathematics- based filtering by Goodrum and Elster (1992), two-di- mensional fast Fourier transform and multivariate dis- criminate analysis by Han and Feng (1994), and Visual Figure 3. Histogram of a picture from an egg on the frame after Basic programming by Garca-Alegre et al. (1997, 2000). selecting the saturation plane. There is a clear contrast between the background and the egg itself. The threshold value is based on this his- The image processing in the system presented is based togram. on a practical and easy-to-use software program and is

5 DIRT DETECTION ON BROWN EGGS 1657 Figure 4. Sequence of different images resulting from the image processing to isolate the egg from its background. 1) Original image; 2) image after extraction of the saturation color plane (step 1) and applying the median smoothing filter (step 2); 3) image after setting the threshold (step 3); 4) image after filling holes (step 4). written in an interface allowing simple interpretation of resulting in an overall accuracy of 99% (100% for the the results. dirty and 98% for the clean eggs) for the plain detection The total processing time of the vision system in its of dirt stains included in this test (dark, white, blood, current set-up may seem quite high. But the number of and yolk). Patel et al. (1994b, 1998) obtained accuracies images that had to be taken per evaluation, namely 15, is for dirt detection of 83.33 and 85%, respectively. Garca- Downloaded from http://ps.oxfordjournals.org/ by guest on September 12, 2016 the global optimum. When this algorithm is transformed Allegre et al. (2000) reported an accuracy of 92% for into a set-up suitable for use in practice, it might be dirty eggs and 82% for clean ones. These accuracies are sufficient to take only 8 images per egg without losing lower than the accuracy of 99% obtained by this new to much information of every egg, as shown in Figure 2. vision system. The false rejects in the experiment were In combination with faster image acquisition hardware, caused by the very light color of these eggs. This leads this will decrease the processing time dramatically. to an overexposure of the egg in the image and this is Moreover, the computation time to evaluate one im- evaluated as being soiled, with over 80% of white stains. age is approximately 165 ms, which is considerably less Although the vision system detected all dirty eggs, it than that reported by Patel et al. (1999) who used a wrongfully classified 9% of them (accuracy of 91%). Of processing time of more than a second, and comparable the eggs with dark stains, 10.81% were misclassified as to time values obtained by Garca-Allegre et al. (2000; eggs with bloodstains, whereas 33.33% of the eggs with 100 ms) and Ribeiro et al. (2000; 150 ms). bloodstains were evaluated as eggs with dark stains. This misevaluation is caused by a low color difference. Experiment Dark stains are mistaken for bloodstains if they are very thin and well spread over the shell surface. An explana- In Table 2, the results of the validation experiment tion for this is not clear. On the other hand, the red color are shown. The vision system detected 100% of the dirty in bloodstains fades over time (through degeneration eggs and generated 2% of false rejects in the clean eggs, of the red blood cells), changing it to brown. All eggs Figure 5. Sequence of images for the detection of white stains caused by uric acid. 1) Original image; 2) image after extraction of the blue color plane; 3) image after adjustment of brightness and contrast properties of the image; 4) image after setting a threshold on 150; 5) image after applying the image mask for the region of interest and after filtering the very small particles off.

6 1658 MERTENS ET AL. Table 2. Results of the validation experiment: the most left column shows the different classes of dirty eggs as evaluated by human vision; the last 5 columns show the different classes of dirty eggs as evaluated by the vision system Classification vision system Dark and Dark White white Blood Yolk Actual Dirt n stains stains stains stains stains Clean Dark stains, % 41 89.19 10.81 White stains, % 29 100 Dark and white stains, % 12 100 Blood stains, % 11 33.33 66.66 Yolk stains, % 7 100 Clean, % 100 2 98 containing white stains were detected, and furthermore, be used as a measuring method to monitor dirty eggs even eggs with a calcium splash defect were detected, in different housing systems. these eggs were classified as containing white stains. ACKNOWLEDGMENTS Possible Applications Downloaded from http://ps.oxfordjournals.org/ by guest on September 12, 2016 This research is performed within the framework of This system could be used to research the occurrence the project S6133. Quality control in the production of dirty eggs in different kinds of housing systems for chain of consumption eggs as a tool for reduction of laying hens (classical cages, enriched cages, aviary, free- bacterial infection is sponsored by the Belgian Ministry range, biological, etc.). Besides the total percentage of of Agriculture. dirty eggs, the occurrence of the different kinds of dirt in every system could be monitored. This could contrib- REFERENCES ute to the research concerning the new alternative hous- Bliss, G. N. 1973. Crack detector. United States Patent No. ing systems that will substitute the classical cage sys- 3744299. U.S. Patent Office, Washington, D.C. tems. Moreover, it would be of interest to examine Brant, A. W., K.H. Norris, and G. Chin. 1952. A spectrophoto- whether the proposed system displays a good correla- metric method for detecting blood in white-shell eggs. tion with the bacterial load present on the dirty eggs. Poult. Sci. 32:357363. In case of a good correlation between the quantification Coucke, P. 1998. Assessment of some physical egg quality parameters based on vibration analysis. Ph.D. Thesis. Ka- of the dirt and the actual bacterial load, the proposed tholieke Univ., Leuven, Belgium. system would be a fast measure for the latter, whereas De Ketelaere, B., P. Coucke, and J. G. De Baerdemaeker. 2000. its current determination is achieved through complex Eggshell crack detection based on acoustic resonance fre- and time-consuming laboratory work as described by quency analysis. J Agric. Eng. Res. 76:157163. De Reu et al. (2005). De Reu, K., K. Grijspeerdt, M. Heyndrickx, M. Uyttendaele, and L. Herman. 2005. The use of total earobic and Gram- After further optimization and increase of speediness, negative flora for quality assurance in the production chain the new vision system could be integrated into a grading of consumption eggs. Food Control 16:147155. machine for on-line detection of dirt on brown eggs. An Elster, R. T., and J. W. Goodrum. 1991. Detection of cracks in important factor that has to be taken into account is the eggs using machine vision. Trans. ASAE 30:307312. Garca-Alegre, M. C., J. Enciso, A. Ribeiro, and D. Guinea. fact that the threshold values of the program are based 1997. Towards an automatic visual inspection of eggshell on the illumination of the set-up. When the system is defects. Pages 5166 in Proc. Int. Workshop on Robotics and transformed into practice, the illumination might Automated Machinery for Bio-Productions, Gandia, Spain. change and the threshold values have to be adjusted Garca-Alegre, M. C., A. Ribeiro, D. Guinea, and G. Cristobal. as well, but the different image processing steps, will 2000. Color index analysis for automatic detection of egg- shell defects. Pages 380387 in Proc. SPIE 3966:380-387. remain the same. Gielen, R. M. A. M., L. P. De Jong, and H. M. M. Kerkvliet. 1979. Furthermore, this detection program can form the ba- Electrooptical blood-spot detection in intact eggs. Trans. sis for the development of a detection system for dirt Instrument. Measur. 28:177183. on white eggs. Again, illumination, and hence threshold Goodrum, J. W., and R. T. Elster. 1992. Machine vision for values, are the program parts that will change the most. crack detection in rotating eggs. Trans. ASAE. 35:13231328. Han, Y. J., and Y. Feng. 1994. Egg shell inspection using global image analysis. Appl. Eng. Agric. 10:109114. Conclusions Moayeri, H. 1996. Probe, inrichting en werkwijze voor het testen van eieren. Patent no. 1000177, The Netherlands. In conclusion, the designed off-line computer vision Oosterwoud, A., J. E. R. Frijters, and C. Davids. 1976. Some system can be used as a blueprint for the development factors affecting mass candling performance of eggs. Br. Poult. Sci. 17:249260. of on-line dirt detection systems in modern egg grading Patel, V. C., R. W. McClendon, and J. W. Goodrum. 1994a. machinery. Its accuracy and low computation time meet Crack detection in eggs using computer vision and neural the demands for such equipment. Furthermore, it can networks. Artif. Intell. Appl. 8:2131.

7 DIRT DETECTION ON BROWN EGGS 1659 Patel, V. C., R. W. McClendon, and J. W. Goodrum. 1994b. the detection of defects in poultry eggs. Artif. Intell. Rev. Detection of blood spots and dirt stains in eggs using com- 12:163176. puter vision and neural networks. Report No. 94-G-034. Ribeiro, A., M. C. Garca-Alegre, D. Guinea, and G. Cristobal. Pages 833834 in Proc. Int. Conf. Agric. Eng., Milan, Italy. 2000. Automatic rules generation by G.A. for eggshell defect Patel, V. C., R. W. McClendon, and J. W. Goodrum. 1998. classification. Eur. Congr. Comput. Methods Appl. Sci. Color computer vision and artificial neural networks for Eng., Barcelona, Spain. Downloaded from http://ps.oxfordjournals.org/ by guest on September 12, 2016

Load More