A developed computer vision algorithm [4] is used for dirt egg detection and determination of defected eggs size. Black and white images are used for egg defect ...
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 5, Issue 11, November 2015)
Indirect Method for Egg Weight Measurement Using Image Processing Alikhanov D.1, Penchev S.2, Georgieva Ts.3, Moldajanov A.4, Shynybaj Z.5, Daskalov P.6 1,4,5
Kazakh National Agrarian University, Department of Energy Saving and Automation , Almaty, Kazakhstan 2,3,6 University of Ruse “Angel Kanchev”, Department of Automatics and Mechatronics,Ruse, Bulgaria
Abstract— An algorithm for indirect egg weight volume measurement using image processing is proposed. Regression analysis is used for approximation of relationship between egg weight and egg geometric parameters – perimeter, area, major and minor axis, shape coefficients and volume. The values of volume for each egg sample collected by image processing and traditional method based on water displacement were compared using percent differences between data. The experimental results show that the most significant parameters are egg area and volume with the following approximation - polynomial with order 3 with a value of R2=0,9439 and exponential regression with R2= 0,9235.
The objective of the study is to propose an algorithm for indirect measurement of egg weight using machine vision system and image analysis.
Keywords—egg weight, image processing, regression analysis, geometric parameters, shape coefficients.
A. Machine Vision System The components of machine vision system for egg grading shown on Fig. 1. include: CCD camera VIDO AU CC540HDN - 1 Light source system – 2 Personal computer – 3 Work surface – 4.
II. MATERIALS AND METHODS The indirect method for egg volume measurement includes the following main steps: egg image acquisition using appropriate machine vision system, image analysis using appropriate image procedures for calculation of egg geometric parameters and statistical methods for determining the relationship between the weight of the eggs and their geometric parameters.
I. INTRODUCTION Main requirement in egg grading systems is weight eggs classification which is specified as per-egg weight ranges as shown in Table 1 [8]: TABLE 1 EGG WEIGHT RANGES
1 2 3 4
Egg Size XL-very large L-large M-medium S-small
Egg weight 73 g 63 g to 73 g 53 g to 63 g under 53 g
1 3
2
An analysis of literature for existing grading systems have shown that there are many automatic system for egg grading which are used mainly for defect detection [3,6] and for detecting internal blood spots and eggshell dirt [2,5]. Different methods such as optical, mechanical, spectral have also been used for classification of eggs using different classification criterion. In [7] near infrared spectroscopy is used for detection of blood spots in eggs. A developed computer vision algorithm [4] is used for dirt egg detection and determination of defected eggs size. Black and white images are used for egg defect detection [1].
5 4
Fig. 1. Machine vision system for egg grading
The technical data of the color CCD video camera used are the following: - Photo sensor - 1/3 "SONY Super HAD matrix with a resolution of 795 x 596 pixels;
30
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 5, Issue 11, November 2015) -
Resolution - 540 TVL; Video output - composite video with BNC connector; Electronic shutter - from 1/50 - 1/120000 sec; Spectral sensitivity - visible and infrared range (800 ÷ 1200 nm). The system provides illumination of the object in two different directions - over, to analyze the color characteristics and bottom, with the aim of radiographic object. LED lighting with white light and a color temperature of 3000K is used.
The coefficients KX and KY can be used to measure distances in a visual image, when the desired result should be in millimeters. For example, the distance between point A (XA,YA) and B (XB, YB) is obtained based on the Euclidean distance of the equation as follows:
DAB
Input RGB Egg Image
2
Convert RGB to Gray Image
3
Convert Gray Image to Black/White Image
4
Calculation of Geometric Egg Parameters
b)
c)
d)
a) input RGB egg image, b) gray egg image, c) binary image, d) geometric parameters calculation
One of the main procedures for working with visual system is calibration procedure. Determined numbers of pixels correspond to the diameter of the object in horizontal and vertical direction. Identifying two coefficients Kx and Ky (mm/pix), provide millimeters corresponding to one pixel in X and Y direction: D, D, Ky Px Py
a)
Fig. 3. Main steps of image processing algorithm
Fig. 2. Block diagram of the proposed method
Kx
(2)
For converting the images in gray and then in black/white (binary) image are used functions in MATLAB. After receiving the gray image it is converted into a binary with two types of pixels - white (object pixels) and black (background pixels). This is done by standard procedure using threshold gray image segmentation. The calculated geometric egg parameters using images of the eggs are minor and major axis, area, perimeter and two shape coefficients.
B. Image Processing Algorithm The proposed algorithm for egg image processing includes following main steps: RGB image acquisition (1), converting RGB to Gray image (2), converting Gray to Black/White image (3) and calculation of geometric egg parameters (4). The block diagram of the proposed method is shown in Fig 2. 1
X A X B K X 2 YA YB KY 2 , mm.
The geometric egg parameters are obtained as results of Matlab function regionprops. Other three parameters are also calculated – two coefficients of egg shape (K1 and K2) and egg volume.
K1
(1)
P2 S
and
Where P is egg perimeter; S – egg area; A - minor axis; B – major axis.
Where D, mm is the diameter of the standard circular object; Px, Py - the number of pixels in the directions X and Y, corresponding to this diameter.
31
K2
A , B
(3)
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 5, Issue 11, November 2015) The egg volume is calculated using the following equation:
Vc
2 AB , cm3 3
Tools used for this purpose is regression analysis of the eggs weight and their geometric parameters. For this approximation a set of analytical models is performed and for each of them the coefficient of determination R2 is calculated.
(4)
Where A is the minor axis; B – major axis.
III. RESULTS AND DISCUSSION Results for calculated geometric parameters of eggs are shown in Table 2. The second column is egg weight which is measurement using precise electronic scale.
C. Indirect Method for Weight Egg Measurement The results are analyzed to determine the relationship between the weight of the eggs and their geometric parameters. TABLE 2
EGG WEIGHT RANGES
1
54,43
15,512
18,51
5,23
4,47
13,00
0,85
48,89
2
52,36
15,567
18,38
5,42
4,28
13,18
0,79
48,51
46
5,18
3
48,66
15,344
17,62
5,43
4,09
13,36
0,75
46,41
45
3,05
4
43,70
14,625
15,97
5,12
3,98
13,39
0,78
42,67
40
6,26
5
43,68
15,089
16,79
5,51
3,86
13,56
0,70
44,54
41
7,95
6
49,14
4,13
13,26
0,77
46,69
45
3,62
7
47,81
4,15
13,11
0,79
45,51
46
1,07
8 9 10 11 12
62,56 57,49 63,73 45,61 61,09
13,44 13,20 13,04 13,07 13,11
0,70 0,75 0,81 0,83 0,81
57,32 55,43
60 56 56 42 53
4,67 1,04
13 14 15
50,67 60,28 53,52
15,408 16,274
17,99 20,13
5,37 5,72
4,21 4,45
5,69
4,18
49,79
48 50 47
1,35 6,16
18,92
0,78 0,78 0,74
47,36 53,28
15,886
13,19 13,16 13,34
16
42,75
14,548
15,83
5,10
3,93
13,37
0,77
41,92
44
4,95
17
56,55
15,836
19,02
5,51
4,34
13,17
0,79
50,09
47
6,19
18
58,83
15,832
19,15
5,36
4,54
13,09
0,85
50,84
49
3,61
19
37,22
14,208
14,91
5,17
3,65
13,54
0,71
39,53
39
1,35
20
55,67
4,61
13,03
0,92
48,14
50
3,86
21
55,64
4,36
13,13
0,80
49,80
50
0,40
22 23 24 25 26
52,81 50,52 52,60 54,80 58,75
13,00 13,03 13,20 13,09 13,06
0,87 0,85 0,81 0,86 0,84
46,72 45,69
48 47 46 51 51
2,73 2,87
15,221 15,025
Area, cm2
17,47 17,22
Major axis, cm
Minor axis, cm
K1
K2
Vc , cm3
Percent differences
VWD , cm3 45
Egg Weight, Perimeter, number g cm
5,40 5,24
17,015 16,574
21,53 20,81
6,27 5,93
4,37 4,47
16,504 14,704
20,89 16,54
5,74 5,04
4,64 4,20
16,219
20,07
5,63
4,57
15,517 15,759
18,48 18,91
4,99 5,46
15,206 14,991
17,79 17,25
5,06 5,06
4,41 4,31
15,542 15,527
18,29 18,42
5,37 5,23
4,33 4,49
15,884
19,31
5,39
4,55
32
55,68 44,29 53,80
48,63 49,09 51,28
7,96
0,57 5,17 1,49
5,61
5,40 3,90 0,54
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 5, Issue 11, November 2015) Columns from third to seventh are calculated from egg images. The last column for egg volume is obtained using water displacement method for volume measurement as a reference method for assessment the accuracy of volume calculation using equation 4. The values of volume for each egg sample collected by image processing and traditional method based on water displacement were compared. The percent difference between two data points was calculated as the ratio between the absolute value of the difference between the two values and the expected value:
70 65 y = 13,218x - 18,669 R2 = 0,3582
60
Series1
Weight, g
55
Linear (Series1)
y = 73,004Ln(x) - 70,301 R2 = 0,3582
50
Log. (Series1) Poly. (Series1) Poly. (Series1)
45 40 35
Power (Series1)
1,3842
y = 5,0756x R2 = 0,3293 y = -28,394x3 + 476,3x2 - 2641,8x + 4900 R2 = 0,3886 y = -0,9691x2 + 23,962x - 48,343 R2 = 0,3585
30 4,50
5,00
Expon. (Series1)
y = 13,528e0,2504x R2 = 0,3286
5,50
6,00
6,50
Major axis, cm
differences
Perecent
VC VWD VC
(5)
.100 ,%
Fig. 6. Approximation of the weight from the major axis 70
The results of approximation with analytical model and the values of R2 are shown on Fig. 4, 5, 6, 7, 8, 9 and 10.
65 60
75 70
Weight, g
Series1
y = 145,06Ln(x) - 345,03 R2 = 0,8692
55
Weight, g
60
2,0534
y = 2,6391x R2 = 0,8509
55
y = 9,2803x - 91,411 R2 = 0,8607
65
y = 24,461x - 52,196 R2 = 0,8254 y = 102,22Ln(x) - 95,956 R2 = 0,8247
Linear (Series1)
50
Series1 Linear (Series1)
0,4902x
y = 6,3893e R2 = 0,8474
Log. (Series1) Poly. (Series1) Poly. (Series1)
45
Power (Series1)
Log. (Series1)
Expon. (Series1)
Poly. (Series1)
50
y = -2,0957x2 + 74,604x - 599,56 R2 = 0,8931
45
y = -0,7466x3 + 32,848x2 - 469,72x + 2222,3 R2 = 0,8956
40 y = 0,0215x2,8441 R2 = 0,8543
35
14,5
15
15,5
16
16,5
y = -0,6351x2 + 29,79x - 63,335
Power (Series1)
2
R = 0,8255
35
Expon. (Series1)
y = -13,296x3 + 165,37x2 - 658,97x + 886,22 2
30 3,50
y = 3,1161e0,1816x R2 = 0,8427
30 14
40
Poly. (Series1)
R = 0,827 3,70
3,90
4,10
4,30
4,50
4,70
Minor axis, cm
17
17,5
P, cm
Fig. 7. Approximation of the weight from the minor axis
Fig. 4. Approximation of the weight from the perimeter
70,00
y = -21,556x + y337,21 = -285,21Ln(x) + 788,55 R2 = 0,2817
65,00
R2 = 0,2805
70 y = 3,9345x - 19,343 R2 = 0,9204
60,00
y = 71,881Ln(x) - 156,02 R2 = 0,9319
60
Weight, g
65
Series1
Weight,g
55
Linear (Series1)
1,4162
y = 0,8558x R2 = 0,925
50
Log. (Series1)
R2 = 0,319
55,00 50,00 45,00
y = 2E+08x -5,9576 y =2-49,859x 2 + 1300,8x - 8429,4 R = 0,313 2 R = 0,3185
Poly. (Series1)
40,00
Poly. (Series1) 45
Power (Series1)
2
y = -0,2777x + 14,102x - 111,72 2 R = 0,9394
40
3
35,00
Expon. (Series1)
2
30,00 12,90
y = -0,0775x + 3,9647x - 62,811x + 349,92 2
R = 0,9439
35
y = 36,774x 3 - 1513,7x 2 + 20723x - 94319
y = 12,718e 0,0772x
y = -2865,9x 4 + 152162x 3 - 3E+06x 2 + 3E+07x - 9E+07 R2 = 0,36 13,00
13,10
13,20
13,30
13,40
13,50
K1
2
R = 0,906 30 13
15
17
19
21
23
Fig. 8. Approximation of the weight from K1
A,cm2
Fig. 5. Approximation of the weight from the area
33
13,60
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 5, Issue 11, November 2015) 70,00
The relationship between egg weight and volume (Fig. 10) is approximated using exponential regression with R2 = 0,9235. The percent differences between data for egg volume calculated from digital egg image and the values obtained using water displacement method are less than 10%. This result shows that image analysis is appropriate for calculation of egg volume with values near to the reference.
y = 35,711x + 24,304 y = -1726,5x 3 + 4024,9x 2 - 3075,9x + 821,97 28,66Ln(x) + 59,336 R2y==0,0883 R2 = 0,0996 R2 = 0,0902
65,00
Weight, g
60,00 y = 60,43x 0,6261
55,00
R2 = 0,1101 50,00 45,00 y = 111486x 4 - 362813x 3 + 441177x 2 - 237531x + 47822 R2 = 0,138
40,00
IV. CONCLUSION
2
y = -138,37x + 256,6x - 63,45 35,00
An algorithm and procedure for indirect measurement of egg weight using egg digital images are developed and tested. The relationship between the egg weight and geometric parameters are approximated using regression analysis and coefficient of determination. The results show that perimeter, major and minor axes, shape coefficients K1 and K2 are insignificant for indirect measurement of egg weight using image analysis. Most significant parameters are area and egg volume with the following approximation - polynomial with order 3 with a value of R2 = 0,9439 and exponential regression with R2 = 0,9235.
2
R = 0,0951
30,00 0,65
0,70
0,75
0,80
0,85
0,90
0,95
K2 Fig. 9. Approximation of the weight from K2 60,00 y = 31,156Ln(x) - 74,75 R2 = 0,8903
y = 0,6224x + 15,719 R2 = 0,9085
55,00
Weight, g
Series1 Linear (Series1)
50,00 y = 3,66x 0,6522 R2 = 0,9128
y = 24,395e0,013x R2 = 0,9235
45,00
Log. (Series1)
REFERENCES
Poly. (Series1)
[1]
Poly. (Series1) Power (Series1)
y = 0,0075x 2 - 0,1489x + 35,226 R2 = 0,9165
Expon. (Series1)
40,00
[2]
y = 0,0006x 3 - 0,0844x 2 + 4,4645x - 40,829 R2 = 0,9196 35,00 30
35
40
45
50
55
60
65
70
Vc, cm3
[3] Fig. 10. Approximation of the weight from the volume
The results in Fig. 4 show that for the approximation of the dependence of weight on the perimeter, the good score were obtained by a polynomial of 4th order with a value of R2 = 0,8965. The results in Fig. 5 show that for the approximation of the dependence of weight on the area, the good score were obtained by a polynomial with order 3 with a value of R2 = 0,9439. The results in Fig. 6 show that the highest value of R2 = 0,3886 were achieved using polynomial with order 3. The relationship between the weight of the eggs and their minor axis is approximated with regression of type Power (Fig. 7) with value of R2 = 0,8509. The values of R2 for shape coefficients K1 and K2 (Fig. 8 and Fig. 9) are insignificant and do not show relationship between them and egg weight.
[4]
[5]
[6]
[7]
[8]
34
Agh khani, M. H. and A. Pourreza 2005 Egg Sorting by Machine Vision Method. Research Note.Journal of Agricultural Engineering Research. Vol. 8, No. 3. Dehrouyeh, M.H., M. Omid, H. Ahmadi, et al. 2010 Grading and quality inspection of defected eggs using machine vision International Journal of Advanced Science and Technology, pp. 23– 30 Garcia-Alegre, M.C., Ribeiro, A., Guinea, D., Cristobal, G. 1998 Eggshell defects detection based on color processing. International Workshop on Robotics and Automated Machinery for BioProductions, Spain, pp. 51–66. Mertens, K., B. De Ketelaere, B. Kamers, F. R. Bamelis, B. J. Kemps, E. M. Verhoelst, J. G. De Baerdemaeker and E. M. Decuypere 2005 Dirt Detection on Brown Eggs by Means of Color Copmuter Vision. Poultry Science Association Inc. 84: 1653-1659. Nakano, K., K. Sasaoka, Y. Ohtsuka. 1998 A study on nondestructive detection of abnormal eggs by using image processing, The Journal of the Society of Agricultural Structures, 29, pp. 17–23 Patel, V.C., R.W. Mc Clendon, W. Goodrum 1998 Color computer vision and artificial neural networks for the detection of defects in poultry eggs., Artificial Intelligence Review, 12, pp. 163–176 Usui, Y., K. Nakano and Y. Motonaga 2003 A Study on the Development of Non-Destructive Detection System for Abnormal Eggs. EFITA Conference. Debrecen. Hungary. http://www.gov.scot/Publications/2005/01/20545/50293