0% found this document useful (0 votes)
25 views7 pages

Egg Freshness Detection Based On Digital Image Technology: Full Length Research Paper

Uploaded by

Five Light
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views7 pages

Egg Freshness Detection Based On Digital Image Technology: Full Length Research Paper

Uploaded by

Five Light
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Scientific Research and Essay Vol.4 (10), pp.

1073-1079, October, 2009


Available online at http://www.academicjournals.org/sre
ISSN 1992-2248 © 2009 Academic Journals

Full Length Research Paper

Egg freshness detection based on digital image


technology
Qiaohua Wang1, Xiaoyan Deng2, YiLin Ren1, Youchun Ding1, Lirong Xiong1, ZhouPing3,
Youxian Wen1and Shucai Wang 1*
1
College of Engineering and Technology, Huazhong Agricultural University, Wuhan, 430070, P.R. China.
2
College of Basic Sciences, Huazhong Agriculture University, Wuhan, 430070, P.R. China.
3
National Engineering Research Center for Information Technology in Agricultural, Beijing, 100085, P.R. China.
Accepted 6 August, 2009

Yolk index and air room height, two main measures for egg freshness detection, are very difficult to
be accurately measured in practices. This paper investigated an image-based egg freshness
detection method. The perspective image of egg was obtained by computer vision device. The
characteristic regions, including the yolk region and air room region were separated from the
obtained egg picture by image processing. The pixel areas and lengths of the above characteristic
regions were respectively calculated and analyzed. The relative ratios of the pixel area and length
of characteristic regions to that of the whole egg region were selected as characteristic parameters.
It was shown that the above relative ratios increased while egg freshness reduced according to a
detailed analysis. Three detection models of egg freshness were set up based on the correlations
between the characteristic parameters and freshness. The test results showed that the accuracy
rates of these models were 93, 94 and 92% respectively. The egg freshness detection based on
image characteristic of yolk and air room was efficient and feasible.

Key words: Egg yolk, air room, freshness, digital image, computer vision.

INTRODUCTION

Egg freshness detection is an interesting and important and penetrates into yolk. This process continues until the
topic in the food safety researches, mainly due to the fact yolk membrane is completely broken up because of the
that egg is closely related to the everyday lives of com- reduction of membrane elasticity (Zhu, 1985; Geng,
mon people and egg content changes easily during 1998). There is no air room in the newborn egg. When
storage. Many researches have focused on egg fresh- the egg cools down, the egg content will shrink, which
ness detection over the last decade. leads to the formation of air room. The size of air room
Egg content mainly consists of yolk, albumen and air can increase due to water evaporation, the CO2 dissi-
room. There is a layer of yolk membrane between yolk pation and the drying shrinkage of egg contents. At the
and albumen. With the extension of storage time, mois- same temperature and humidity, the longer the storage
ture of albumen gradually evaporates from the shell pores time, the larger the air room size is (Zhang, 1998). So
yolk index and air room height can be viewed as main
measures of egg freshness.
Yolk index is the ratio of egg yolk’s height to its dia-
*Corresponding author. E-mail: [email protected]. Tel: meter, which can only be measured by breaking the egg,
+86-027-87285346. Fax: +86-027-87285346. whereas the height of air room is usually accessed by
1074 Sci. Res. Essays

a self-made ruler. Nonetheless, those methods are te-


dious and inefficient. Nowadays spectroscopy (Chen Bin,
1996; Liu and Qiao, 2002; Liu et al., 2003; Patel et al.,
1998) and image techniques (Chen et al., 2001; Wang et
al, 2006) have been commonly applied in the physical
determination of egg freshness. Those methods which
based on the color characteristics of images require
critical experimental conditions and high-quality pictures.
In this research the morphological characteristics of the
transmitted light images were pre-processed, and the
characteristics of sensitive area could be accurately
shown after an effective image processing had been
done. Then the correlations between egg freshness and
morphological characteristics of egg contents were
Figure 1. Computer vision device of egg image (1-Light
discussed, and the non-destructive detection models for
source, 2-Egg, 3-Digital camera, 4-Dark room, 5-
the egg freshness were set up. Computer, 6-Light room with radiator, 7-Light tube, 8-
Transformer)
MATERIALS AND METHODS

Egg samples

Clean and fresh eggs, four hundred in total were collected from
Hatchery in Huazhong Agricultural University. All of the eggs were
numbered and stored in biochemical incubator at 25°C.

Experimental system

The computer vision equipment used to take egg images was a b c d


shown in Figure 1. The testing equipment consisted of a light
source, a light tube, a light room with radiator, a dark room, a trans- Figure 2. Egg image processing (a-Original image, b-
former, a Canon digital camera and a computer. The mini light Gray scale image, c-Binary image, d-Median filter).
meter DT-1300 was used to measure illuminance with 5900 lux in
this test.

Figure 2-a. The separating method of the egg region from


Experimental procedure the original picture is as follows: Convert the color image
With using above computer vision equipment, the experimental
into gray scale image (Figure 2-b); Process the images
procedure is designed as follows: by the binarization method (Figure 2-c); denoising filter
and remove interferential value. Thus, a binary image
(1) Every day images of ten eggs were taken and stored in with high quality was achieved (Figure 2-d). From Figure
computer at same time. 2-d, the pixel area and length of the whole egg region can
(2) The ten eggs were broken, Haugh unit of representing egg
freshness was measured, and the data (Haugh unit) and storage
be easily calculated and measured.
time were recorded.
(3) Repeated steps (1) and (2) everyday until the yolks of the Separation of egg yolk: The egg yolk could not be seen
sample eggs stored for this experiment were found to become in the original egg image (Figure 2). In this research, the
broken. Here Haugh unit was measured by the method proposed three-components of R, G and B were separated from
by Wang et al., 2006. egg color picture and then the color picture was con-
verted into the gray scale image for finding the feature
RESULTS AND DISCUSSION region of egg yolk.
The gray scale image and its histograms for the R-, G-
Image processing and B-component were shown in Figure 3-a, b and c res-
pectively. It was found that the yolk could only be viewed
Separation of the whole egg: The original picture darkly in the gray scale image of G-component. Mean-
obtained from the computer vision equipment is shown in while it also was found that there were more than two peaks
Wang et al. 1075

b
a b c d
Figure 5. Image processing of egg yolk (a-Binary image of G
component, b-Median filtering, c-Dislodge small points in
foreground, d-Fill egg yolk region).
c

Figure 3. Gray scale images of R-, G-, B-


component and its histograms (a-R, b-G, c-B).

a b c
Figure 6. Gray scale image of HIS (a-H, b-S, c-I).

Figure 4. Gray scale image and it histogram image, so a filter could be selected for image denoising.
equalization of G-component. Medium filtering is a non-linear method of noise reduction.
Figure 5-b was the result of medium filtering for the egg
yolk image using a 5 x 5 template.
There were still some stray points around the yolk in
for all the histograms of R-, G- and B- component, in which image. Dislodge those small points in foreground through
the pixel values centralize in several ranges. Thus the opening operation (Figure 5-c). Some pores still existed
gray scale image of the G-component was selected to in yolk region after filtering, which would bring large error
separate the yolk region from the whole egg image. when calculating yolk’s area. Thus, it was necessary to fill
However, its most gray levers were lower than 100, and egg yolk region to obtain the full yolk image (Figure 5-d).
the image contrast was not strong. To enhance image
contrast, the data mapping was used to extend the gray Separation of air room: RGB and HSI are two
levers to the range of [0, 255]. According to the gray commonly used color models in image processing. In this
lever changes, the histogram equalization was adopted to research the HSI model was selected to deal with the air
enhance the gray scale image and its histogram was room according to the former experimental experience.
shown in Figure 4. As a result, the region of egg yolk Figure 6 was the gray scale image of H, S, I.
could be clearly viewed in Figure 4. It could be viewed from Figures 6-c and 7-a that the air
However, it was still very difficult to calculate the yolk room of I-component was more obvious than others (H-
area from Figure 4. For segmenting the yolk region, the and S-component), so the gray scale image of I-compo-
binary image of egg was obtained with the binary proce- nent was chosen for subsequent processing in this
dure controlled by a threshold. The threshold was selec- research. The feature of air room was more obvious after
ted based on the histogram of gray scale image. The adaptive contrast enhancement (Figure 7-b) and image
result was shown in Figure 5-a. binarization (Figure 7-c).
Various kinds of noises existed in the obtained digital It is required to extract the characteristic parameters:
1076 Sci. Res. Essays

a b c
Figure 7. Image processing of I (a-Gray scale image, b-
Adaptive contrast enhancement, c- Binary image). Figure 9. Edge detection by Newton's Dichotomy.

which has been explained in detail by Zhou et al., (2007).


The edge detection procedure can be divided into two
steps:

Step 1: Find the highest point and the lowest point of


image region using Newton's Dichotomy, marked by Pt0
and Pt1 respectively. The two points are used to deter-
a b c d mine the calculation range of Newton's Dichotomy (see
step 2 for details).
Figure 8. Image processing of air room (a-Median filtering, b-
Fill egg, c-Dislodge small points in foreground, d-Air room). Step 2: Take the highest point Pt0 as the reference point
and find its below edge point Pt , whose X coordinate
the area and height of air room. The following steps are value is same as that of Pt0 . The three points divide the
taken in this research: median filtering (Figure 8-a), fill egg region into two parts: area I and area II. Area I is the
egg (Figure 8-b), dislodge small points in foreground part of egg region located between two level lines
(Figure 8-c) and extract air room (Figure 8-d). From passing through points Pt0 and Pt respectively, and the
Figure 8-d, the area and height of air room can be easily
calculated. area II is the part of egg region located between two level
lines passing through points Pt and Pt1 respectively.
Both the two areas are processed by Newton's Dicho-
Feature extraction and parameters calculation
tomy in order to find and record the edge point of every
The geometric parameters of egg images were calculated line in target image. The obtained image edge by
by the use of pixel points. However the pixel values show Newton's Dichotomy is shown in Figure 9.
great changes to the small variation of shooting distance.
In order to eliminate influence of the external factors and It can be considered that the egg image consists of rows
calculate the morphological changes of egg contents horizontal lines arrayed closely. Each line is deter-mined
accurately, the relative ratios of the pixel area and length by the right and left edge points. So the egg image’s area
of feature regions to that of the whole egg were selected is equivalent to the sum of every line’s length, and the
as characteristic parameters. size of egg image depends on position information of the
right and left edge points. The difference of X value
Calculation of pixel area: Image size is the area of the between the left and right point is the length of each line.
region enclosed by edge, which is usually calculated by The region area can be calculated by formula (1):
the use of statistical sum of the region’s pixels. The
image area is closely related to the information of edge pt1 . y

points. In this research, Newton's Dichotomy was used to A= dxdy = ( ptiR .x − ptiL .x + 1)
detect the edge between backgrounds and objects rapidly, ( x , y∈object ) i = pt0 . y
(1)
Wang et al. 1077

0. 8 0. 16 0. 3
0. 7 0. 14

hei ght r at i o of ai r r oom


ar ea r at i o of ai r r oom
- 0. 0359x 0. 25
0. 6 0. 12 y = 0. 5517e
2
R = 0. 993 0. 2
0. 5 0. 1

0. 4 0. 08 0. 15

0. 3 0. 06
0. 1
0. 2 y = - 0. 0094x + 1. 0549 0. 04
2
R = 0. 9884 0. 05 y = - 0. 0037x + 0. 3989
0. 1 0. 02 2
R = 0. 9745
0 0 0
30 50 70 90 110 30 50 70 90 110 30 50 70 90 110
haugh uni t haugh uni t haugh uni t

a b c

Figure 10. Relationship between ratio and Haugh unit (a-Area ratio of egg yolk and Haugh unit, b-Area ratio of air room and
Haugh unit, c-Height ratio of air room and Haugh unit).

Where PtiL and PtiR , is the left and right edge point of vertical axis. Then scan the long axis from bottom to top
using Newton's Dichotomy, from which the longitudinal
the ith line of feature region respectively,
coordinate values of top and bottom points were obtained.
PtiR x − PtiL x + 1 is the sum of pixels of the ith line, Pt0 The difference of the above two values is the length of
and Pt1 are the highest and lowest point of the feature the whole egg.
The height of air room could be calculated by the same
region respectively. Yolk area and air room area can be method. Finally, the obtained data are shown in Table1.
calculated by the same method.

Calculation of pixel length: Air room is located in the Data analysis and modeling
blunt end of egg, whose height is the length in long axis
direction when the image is put upright. The specific In this section, three correction equations between Haugh
algorithm is presented as follows: unit and characteristic parameters were established by
classical statistical analysis method.
Step 1: Calculate the image centroid according to the The relationship between the area ratio of egg yolk and
formula (2): Haugh unit is shown in Figure 10-a. The obtained
equation is as follows:
x[ f ( x) − g ( x)]dx
b
M
X= Y = a
y1 = −0.0094 x + 1.0549,R 2 = 0.9884 ,
[ f(x) − g(x)]dx
b
M
a (2)
Where x is Haugh unit, y1 is the area ratio of egg yolk;
The calculation procedures are as follows:
The relationship between the area ratio of air room and
(1) The x-value was got after scanning any point in a Haugh unit is shown in Figure 10-b. The obtained
image, then the pixel integral xdA was obtained; equation is as follows:
(2) The surface density of plane image is regarded as unit y 2 = 0.5517e −0.0359 x , R 2 = 0.993 ,
1 and the image mass is calculated by integration which
is equal to image area in value; Where x is Haugh unit, y2 is the area ratio of air room;
(3) The quotient of the two values was obtained;
(4) Scan and calculate all pixel points, then sum the feed- The relationship between the height ratio of air room and
back results to calculate the abscissas value of centroid. Haugh unit is shown in Figure 10-c. The equation is as
Step 2: The long axis passing centroid was defined as the follows:
1078 Sci. Res. Essays

Table 1. Data of characteristic parameters.

Area ratio of Area ratio of Height ratio of


Day Haugh unit
egg yolk air room air room
1 90.75 0.19346 0.020579 0.047962
2 87.93 0.24716 0.02425 0.055755
3 85.20 0.246192 0.024192 0.07645
4 82.54 0.274828 0.028158 0.087026
5 79.98 0.305108 0.03096 0.095875
6 77.49 0.340396 0.035239 0.117402
7 75.08 0.372678 0.037851 0.126012
8 72.74 0.355834 0.042105 0.12414
9 70.49 0.387794 0.046224 0.146132
10 68.29 0.432036 0.049491 0.157368
11 66.16 0.412694 0.052934 0.156606
12 64.11 0.448086 0.056604 0.165328
13 62.11 0.491824 0.06128 0.1843
14 60.18 0.465454 0.06096 0.185526
15 58.31 0.485436 0.063301 0.193904
16 56.50 0.51488 0.07014 0.203682
17 54.74 0.528608 0.07286 0.199108
18 53.03 0.541966 0.080697 0.207958
19 51.39 0.5876 0.085994 0.216942
20 49.79 0.581086 0.090122 0.210668
21 48.24 0.5876 0.090679 0.220208
22 46.74 0.598984 0.091988 0.223218
23 45.29 0.6269 0.107594 0.23358
24 43.87 0.6659 0.112238 0.226536
25 42.51 0.63298 0.128394 0.232006
26 41.19 0.6843 0.13379 0.235056
27 39.91 0.693244 0.13918 0.237716
28 38.67 0.714906 0.144192 0.241304

y3 = −0.0037 x + 0.3989, R 2 = 0.9745 were randomly selected from different batch samples with
, the same variety and experimental procedure. After the
egg images were acquired, Haugh unit representing
Where x is Haugh unit, y3 is the height ratio of air room. freshness was obtained through experiment. Then the
It can be concluded from the equations that: the single characteristic parameters were calculated and put into
variable linear regression equation with high correlation the corresponding model. The results of calculation
coefficient can be established for the area ratio of egg based on model equations were compared with the mea-
yolk and Haugh unit, which is the same to the area ratio sured results, which indicated that the accuracy rate of
of air room and Haugh unit. However, the height ratio of the three models of the area ratio of egg yolk, the area
air room has high exponential correlation with Haugh unit. ratio of air room and the height ratio of air room was 93,
94 and 92% respectively.

Model test and result analysis Analysis of results:


Reliability test: In order to test the detection accuracy of (1) Yolk index of fresh egg is 0.38 - 0.44. And egg whose
the established models, 100 eggs with clean brown shell yolk index is higher than 0.30 can be considered qualified.
Wang et al. 1079

The yolk appears as a globular domain when the egg is paper.


very fresh. However, because of the moisture loss and (2) Area ratio of egg yolk, area ratio of air room, height
the yolk membrane elasticity increase, egg yolk will gra- ratio of air room, can not only reflect the morphological
dually become flat. One of the expressions reflected from change of egg contents, but also eliminate impact of the
the morphology performance is that the yolk area in external factors such as subjective or objective factors.
horizontal direction will change from small to large. The These characteristic parameters are very sensitive to the
research results are consistent with the theory. Area ratio changes of the egg yolk pixel area and the air room
of egg yolk gradually increases with the prolongation of height.
time and decrease of Haugh unit. The established linear (3) Research on image feature parameters of egg yolk
equation is significant, which can present the relationship and air room, is trying to find an indirect measurement of
between morphological characters and egg freshness. the freshness. The feature parameters ratios increase
Main reasons for the misjudgement rate of 7% are as gradually with the prolongation of storage time, and the
follows: As the objective and subjective factors, there decrease of fresh degree.
would be errors in experimental measurement of the (4)The established equations have high detection accu-
Haugh unit representing freshness, and these errors also racy, whose accuracy rate is more than 90%. It shows
exist in the establishment of the model. As a reference that this method can be used in non-destructive detection
standard, the freshness itself has some errors. In addition, of egg freshness.
there are differences in the structure of the eggs, for
example, the impact of the eggshell thickness to the
image quality. These factors were not considered in this ACKNOWLEDGEMENTS
article, which could result some misjudgement. This work is supported in part by the National High
(2) According to the egg quality grading standards set by Technology Research and Development Program of
United States Department of Agriculture (USDA), the China under grant 2007AA10Z214, the Hubei scientific
edible egg is divided into four different levels. And dif- and technological project of China under grant
ferent levels correspond with different Haugh unit ranges. 2007AA201C07.
The height ranges of air room at all levels are as follows:
the air room height of egg at AA level(Haugh 72) is
smaller than 7mm; the value at level A(60 Haugh 72 ) REFERENCES
is smaller than 9mm; the value at level B,C (Haugh 60)
Chen B (1996). Research on egg Photoelectric Quality Detection. J.
is less than 1/3 of the whole egg’s length. The estab- Jiangsu Sci. Technol. Univ. 17(6): 1-5.
lished relationship between the ratios and the correspon- Chen J, Chen X, Ji S (2001). Automatic Detecting Fertility of Hatching
ding freshness are consistent with the theory. Main Eggs by Using Computer Vision. Comput. Appl. Software 018(006):
5-10.
reasons of the misjudgement rate of detection (6 and 8%) Geng T (1998). Mechanism of egg storage. Mech. Egg Storage 14(1):
are as follows: the air room will fluctuate up and down 13-15.
within several days. What's more, the change of air room Liu Y, Qiao Z (2002). Research On The Relevance Of Optical
has direct relation to the factors such as the stomatal Properties And Freshness Of Egg. J. Jiangxi Agric. University, 24(1):
45-47.
density of egg shell. Liu Y, Ying Y, Mao X (2003). Opitical non-destractive inspection of
(3) In this research the three models were tested respect- chicken-egg freshness. Trans. CSAE 19(5): 152-155.
tively. It should be noted the relationship between mor- Patel VC, McClendon RW, Goodrum JW (1998). Development and
phological characteristics and freshness may change evaluation of an expert system for egg sorting. Comput. Electronic
Agric. 20(2): 97-116.
slightly when the experimental samples are different,
Wang Q, Ren Y, Wen Y (2006). Study on Non-destructive Detection
such as birth time, different hens. Method for Fresh Degree of Eggs Based on BP Neural Network.
Trans. Chinese Soc. Agric. Mach. 3(1): 104-106.
Zhang W (1998). Hatching Egg storage and management is the key to
Conclusion improve the hatching rate. Foreign Anim. Husbandry Sci. Technol.
25(06): 38-40.
This paper presents a non-destructive method on egg Zhou P, Liu J, Wang Q, Wen Y (2007). Egg Image Detection Method
and Weight Prediction Modeling. Trans. Chinese Soc. Agric. Mach.
freshness detection by computer image processing. The 38(11): 80-83.
main findings are summarized as follows: Zhu Z (1985). Egg research. Beijing. Science Press pp. 30-85.

(1) The egg yolk and air room were not obvious in the
original transmitted light images, but which can be clearly
viewed by the image processing method proposed in this

You might also like