Microsoft Word - 1murphy.docx CHEMICAL ENGINEERING TRANSACTIONS VOL. 58, 2017 A publication of The Italian Association of Chemical Engineering Online at www.aidic.it/cet Guest Editors: Remigio Berruto, Pietro Catania, Mariangela Vallone Copyright © 2017, AIDIC Servizi S.r.l. ISBN 978-88-95608-52-5; ISSN 2283-9216 Looking for the Ideal Conditions for Corn Kernel Image Acquisition Yuchen Jiaa*, Bin Zhengb, Yan Zhanga aCollege of Information Science & Technology, Agricultural University of Hebei, Baoding 071001, China bCollege of Information Engineering, Zhengzhou 450003, China jiayuchen1981@163.com Corn is one of the most important grains in the world, and it is wide cultivation. Corn varieties are numerous, but how to quickly identify the varieties is a problem. With the development of machine vision, automatic identification technology is gradually applied to the analysis of corn varieties. This article introduces an image acquisition system which collects and processes the pictures of corn grain. It contains an experiment box for collecting pictures and a computer which processes the pictures with Matlab. The experiment box includes main light source, auxiliary light source, a lifter that could adjust the distance of the object and the camera lens and a stage which held the corn grain. Pictures of corn grain were collected by digital camera. Taking the characteristics of shape and colour as the research object, this paper researches how to place the auxiliary light source and how to set the light intensity when the lifter was fixed, and how to set the distance when determining the light source. Experimental results show that, the light spot which came from camera flash affected feature extraction, the auxiliary light source should be placed in the form of parallel or vertical, and the distance of object to the camera lens within the scope of twenty-six to thirty-one centimetres is better. Keywords: Corn grains; Image acquisition; Illumination; Objective distance 1. Introduction The important parameters of species identification and quality evaluation to corn grain are the shape characteristic and colour characteristic. Therefore, those characteristics should be easily extracted from the images of corn grain. Image acquisition method is the importantly influence on the accuracy of feature extraction (B Ni, M R Paulsen, J F Reid, 1998). The setting of acquisition device as light source, object stage, lens, etc can affect the extraction of image characteristics. This paper analyzes the image features in different acquisition environment, and researches the standard of environment for collecting pictures of corn grain. 2. Design the experiment box The experiment box for collecting corn grain was shown in figure 1. It contains location for camera, the main light source, the auxiliary light source, a lifter and a table for putting object. The data parameter of experiment devices are as follow: the diameter of the hole for putting camera is 6.5cm; the scope of lifting is 23 ~ 45 cm; the size of auxiliary light source circuit board which is full of LED lights is 15 cm * 7 cm; the size of objective table is 50 cm * 30 cm. Processes the picture with Matlab and analyzes the characteristics in order to verify good or bad for the environment of collecting pictures. Take pictures of corn grain with digital cameras, and use the flash as the main light source. It can leave shadow when shooting because of the height of corn grain even flatways on the objective table. Therefore set up auxiliary light source to reduce the error brought by the shadow. Make a 4 * 8 LED array as the auxiliary light source (Yuqiu Dan, Naiwen Cao, Bo Hu, 2011).It controls by four switches in the form of one switch to two columns light, which the height and angle can be adjusted. It needs to remove the background when process the pictures, so it is necessary to select the background colour. Threshold segmentation method is used to remove the background (Yuqiu Dan, Naiwen Cao, Bo Hu, 2011), this study tests the red, white, blue, black and other background colour, and the results show that the pure black background colour is best, so choose black as the object stage background colour. DOI: 10.3303/CET1758095 Please cite this article as: Jia Y., Zheng B., Zhang Y., 2017, Looking for the ideal conditions for corn kernel image acquisition, Chemical Engineering Transactions, 58, 565-570 DOI: 10.3303/CET1758095 565 1. A hole for camera; 2. A lifter; 3. Auxiliary light source; 4. Objective table Figure 1 Experiment box for taking pictures 3. The influence of light source Light intensity is the important factor influencing the image acquisition (Ke Wang, 2015). The characteristics of shape and colour are different with different light intensity. More grain of corn lined up to the object stage, and the distance of object to the camera lens was 27cm when taking pictures. Take pictures in two kinds of conditions that opened and closed the flash of digital camera. Meanwhile, the LED lights of auxiliary light source were two-column, four-column, six-column and eight-column. 3.1 Place the auxiliary light source for gathering lights Adjusts the angle of the auxiliary light source in order to gather the light covering the corn grain, and uses a digital camera to collect images. And then cut out a picture which contained all the corn grain on the objective table with the size of 600 * 600 pixels. Convert colour image to gray with Matlab, and then 3 x 3 median filters to gray image, after that enhance image with histogram equalization and linear transformation, and finally convert to binary image. When performing binary image segmentation,it is found that it cannot extract the corn kernel image at spot which left by flash regardless of which segmentation algorithm is application, and in the case of the absence of auxiliary light, it cannot divide a complete corn kernel form the image. The following conclusions are found based on the results above. (1) The glitter which left by digital camera flash cannot be removed, but its existence seriously impacts the shape feature extraction because it was unable to identify the edge of the corn grain in binary image of the light place. Thus, it cannot use the digital camera flash when collecting images. (2) When auxiliary illuminant focusing on both sides, the stronger of the lights the more obvious of the spot, and it is the more unfavorable to shape feature extraction. (3) Under the condition of no auxiliary illuminant, binary image cannot clearly reflect the characteristics of the shape of the corn grain. Binary images that collect with all sorts of methods above are shown in figure 2. It gets a conclusion through the above analysis: Can't open the camera flash light when extracting the shape characteristics of the corn grain; it is best when two-column auxiliary light LED lighting with the method of auxiliary light condenser; Auxiliary light source cannot be shut down. Two-column auxiliary Two-column auxiliary Six-column auxiliary light Six-column auxiliary light light source light source source and without flash source and without flash Figure 2 Binary images when gathering auxiliary light source condition 3.2 Place the auxiliary light source with the methods of vertically or horizontally Change the placement of auxiliary light source, in the cases of digital camera flash light opened and closed when collecting images of corn grain and then process the digital image. (1) Auxiliary light source is placed perpendicular to the object stage and make a parallel light exposure; thus, the light can be full of the experiment box rather than on one point. 1 2 3 3 4 566 (2) Auxiliary light source is placed parallel to the objective table and made the light vertical illuminate. There is no reflection spot to slide on the stage because the top of experiment box is opaque board. Do the same process to the colour image using the method in two point one, and analyze binary images. The results show that: (1) The effect of the glitter which left by digital camera flash is weakened. (2) The results are the same at the conditions of the auxiliary light source placed perpendicular to the object stage or parallel to the objective table, and they are better than the condition which the auxiliary light source gathers lights. (3) It needs higher light intensity when placing the auxiliary light source perpendicular to the object stage or parallel to the objective table, four-column or six-column LED is better, and there is no difference between two kinds of conditions. Six-column auxiliary light Six-column auxiliary light Two-column auxiliary light Four-column auxiliary light source placed vertically source placed parallel source placed vertically source placed parallel Figure 3 Binary images when auxiliary light source placed vertically and parallel Binary images are shown in figure 3 which collected at the conditions of the auxiliary light source placing perpendicular to the object stage and parallel to the objective table. In order to verify the validity of the conclusions in two point one and two point two, analyze the binary images processed with the method of simple gradient sharpening, and get the same conclusions. Therefore, it is proved the scientific and credible of the above conclusion. 3.3 Analysis of image color feature Corn grain can be divided into three regions: stalk, embryo and crown. Stalk Embryo Crown The front of corn grain The back of corn grain Figure 4 The shape of corn grain The stalk and the embryo of corn grain is generally white, crown with white, yellow and other colours. Depending on the colour of the crown can be divided corn into three categories as yellow corn, white corn and hybrid corn. The crown of yellow corn is yellow or reddish, and the crown of white corn is white or slightly yellowish or pinkish, and corn mixed with more than 5.0% outside the class called hybrid maize (Shuqin Yang, 2011). Therefore, colour is another standard to identify maize varieties and judge the merits, whether the colour feature of crown can be extracted from image acquisition clearly or not is another important indicator of the merits of the acquisition environment. Both sides of the corn grain characteristics are different. The embryo and crown have obvious colour boundaries in front image, but the back have not, and uneven colour on the back. If using colour of back as a feature of the whole corn grain, the test results are not reliable. Therefore, it must distinguish between corn grain in the image is positive or back firstly, the methods of researching are still image segmentation. However, if the light is not ideal, it is not easy to distinguish between embryo and crown from original image. It will be considered on the back if not split the results. So, the first thing which should do is verify the merits of various acquisition environments from the correct rate of segmentation results identified the front and back. The experimental procedure for contrasting the accuracy in all conditions is as follows. 567 (1) Place thirty corn grains on the stage, while the front is fifteen and the back is fifteen. And then collect pictures in all of those lighting conditions above mentioned. (2) Carve up the corn grains one by one from the picture using image segmentation method (Sun Pengpeng Qiao Yue Wang Lin Xue Kai Su Boqun, 2014). (3) Since the stalk is a cutting-edge of image, its characteristic is unique. However, the impact at the division of embryo and crown cannot be ignored, so it should be removed. Because of the complex light conditions, Harris corner detection algorithm was applied in the experiment (Zhongzhi Han, Zhaoyou Gang, Yang Jinzhong, 2010). (4) At last, iterative threshold method is applied on the characteristics of image segmentation, and then found the crown image. Due to the impact of the flash reflector point, regardless of how to set up an auxiliary light source, the correct rate is very low, so the situation of opening flash is no longer included in the table. When the flash is close and the distance of object to the camera lens was 27cm, the correct rate measured under different light conditions is shown in Table 1. Table 1 Embryo and crown segmentation results analyzed under different light conditions The way of auxiliary light source placed Number of auxiliary light source (column) The correct number of front The correct number of back The total correct number of dividing Correct rate( )% Condenser 2 10 11 21 70 4 6 7 13 43 6 4 5 9 30 8 4 4 8 27 Vertical 2 8 12 20 67 4 12 14 26 87 6 13 14 27 90 8 9 10 19 63 Parallel 2 9 12 21 70 4 11 14 25 83 6 14 14 28 93 Correct segmentation is a prerequisite for extraction the colour characteristics of crown in corn grain. Analysis of the data in Table 1, when the auxiliary light source is placed perpendicular and parallel and the four-column and six-column, it has a higher accuracy rate. Therefore, when using the auxiliary light source, take parallel or perpendicular placement. HIS colour model is used to calculate colour characteristic value for the extraction of corn grain crown. Place in vertical and parallel to the auxiliary light source and the number of light four-column and six-column, Chroma H was about 60, saturation S normalized data of about 0.5, I luminance about 0.6, calculation result is not significantly bias. Because the test was not applied white corn, and therefore it cannot determine whether the conclusions above coved white corn. 4. The effect of objective distance to image acquisition Distance between the object and the lens is another key factor affecting imaging. The adjustable range is twenty-three to forty-five centimetres of the objective distance in the experiment box. Change the objective distance, and study the diversification in the characteristics of shape and colour. When the auxiliary light source places parallel and six-column, collect images as the conditions of the objective being 23,25,27,29,31,33,35,37,39,41,43,45cm, which increase the objective distance 2cm from the minimum value for each picture. 4.1 The influence for shape characteristic The methods to research the influence of objective distance in shape characteristic is similar as to the influence of light. However, there are some more analyses for the binary images as follow. Extract a set of parameters to reflect maize grain shape, including grain perimeter, area, and shaft length and calculate the axial ratio and eccentricity. The definition of perimeter is P, area is A, long axis is L, short axis is S, axial ratio is AR and eccentricity is E. Perimeter (P) is defined as the edge length of the binary image of the target area, calculated as follows: 568 (1) Where: ----the coordinates of adjacent pixels in the target area. Eccentricity (E) refers to the same second moment of eccentricity of the ellipse for target area. The calculation method is length ratio between the focal length to its long axis of the ellipse, and the value is between [0, 1]. The ellipse whose eccentricity is zero is actually a circle, and whose eccentricity is one is defined by a line segment. From the perspective of the moment, the area A is zero-order moments of the target area. Meanwhile, according to the centric, calculate second central origin moment of the target area, as: (2) The form of second moment is: (3) The formula of (3-7) can be used to represent an ellipse, the ratio of long axis with its focal length is eccentricity in the target area. At different distances of the objective lens captured images were analyzed and found that in addition to the area, changes in the perimeter, without any other changes. Therefore, it is said that the objective distance does not cause changes in shape, only to change the size of the corn grain from. The binary image, factors to consider when analyzing the shape feature are roundness, axial ratio, and eccentricity and so on, they are nothing to do with size, and it can be considered that the objective distance had no effect or little effect to shape characteristics. 4.2 The influence for color characteristic To research colour characteristics, analyze HIS model of images in various objective distance. Do tip removed and divide embryo and crown so as to get the HIS model of processed image. The results show that: (1) It cannot complete the division to embryo and crown of images in the condition of the objective distance above forty-one cm. (2) Segmentation correct rate is low in the objective distance above thirty-three cm, and the values of H are higher what the correct image segmentation. (3) The value of I is higher than other conditions when images are collected in the objective distance at the twenty-three and twenty-five. The reason is that when the distance of the objective lens is too low, the auxiliary light source is placed vertically moved down, resulting in increased intensity of the ambient light. For the auxiliary light source is placed in parallel, the upper panel down, also led to enhance light. (4) For the images of collecting in the objective distance at the twenty-seven centimetres, twenty-nine and thirty-one, H is consistent and S and I value with increasing distance from the objective lens are slightly reduced. (5) To verify the distance twenty-seven to thirty-one centimetres are preferred, additional analysis of the images at the distance from the objective lens of twenty-six, twenty-eight and thirty centimetres, the result is consistent with the above conclusion. Therefore, it is in favour of characteristic value extraction when the objective distance between twenty-six to thirty-one centimetres. Below this range, the light intensity impacts image acquisition. Above this range, the colour characteristics error of corn grain is too large. 5. Conclusions (1) It needs to turn off the flash when collecting pictures, because the reflex points which left by digital camera flash will affect the feature extraction. (2) It can adjust the angle of the auxiliary light source gathered to the corn grain, if only extracting the shape feature of corn grain. In order to avoid the impact of spot, the light intensity should be reduced. It is two- column LED lights for the best under the current experimental conditions. (3) It can extract the shape characteristics of maize grain, the colour characteristics of the embryo, when auxiliary light source is placed parallel or perpendicular to capture images, but the light intensity should be  −− −+−= 2121 )()( iiii yyxxP 2 20 )( −= D i xxμ 2 02 )( −= D i yyμ ))((11 yyxx i D i −−= μ       = 2011 1120 μμ μμ Cov ),(),,( 11 iiii yxyx −− 569 increased. There are four-column or six-column LED lights for the best under the current experimental conditions. (4) The distance of object to the camera lens within the scope of twenty-six to thirty-one centimetres is better. In that range, it has suitable values of colour feature calculated by the HIS model. Acknowledgment (1) This work is supported by Hebei Provincial Municipal Natural Science Foundation of “Research on morphological characteristics of maize grain varieties based on multi-source image information fusion.”(F2015204130). (2)This work is supported by Baoding Science Technology Research and Development Guidance Program (15ZG023). References B Ni, M R Paulsen, J F Reid, 1998, Size grading of corn kernels with machine vision,Trans of the ASAE, 14(5),567-571. Yuqiu Dan, Naiwen Cao, Bo Hu, 2011, Research the background color and light intensity on peanuts image acquisition, Anhui Agricultural Sciences, 39(33),20901-20922. Ke Wang, 2015,Key research on digital extraction technology for corn kernel phenotypic traits , Huazhong Agricultural University. Shuqin Yang, 2011, Research of image processing and recognition method to grain crops, Xi'an: Northwest Agriculture and Forestry University. Sun Pengpeng Qiao Yue Wang Lin Xue Kai Su Boqun, 2014, Maize Mass Prediction Based on Matlab Image Processing Technology ,Electronics Design & Application, 08. Zhongzhi Han, Zhaoyou Gang, Yang Jinzhong, 2010, feature detection based on grain corn embryo independent component of the RGB image, Agricultural Engineering,3 (26),222. Cao, Mingming, Gan, Zongliang; Cui, Ziguan; Guo Quanzhan; Zhu Xiuchang, 2014, Single image super resolution through neighbor embedding with non-local means and field of experts , Journal of Computational Information Systems, v 10, n 5, p 1973-1981. Zhenmin Zhu, Xinghua Qu, Chao Bi, 2012 (7), Research on chromaticity characteristics color visual inspection light based on the LED array, Physics. Piotr Zapotoczny, 2011, Discrimination of wheat grain varieties using image analysis and neural networks. Part I. Single kernel texture,Journal of Cereal Science, 54,60-80. Maloney, Peter V; Petersen, Stine; Navarro, Rene A; Marshall, David;McKendry, Anne L; Costa, Jose M; Murphy, J Paul, 2014, Digital Image Analysis Method for Estimation of Fusarium-Damaged Kernelsin Wheat, Crop Science 54.5 , 2077-2083. 570