- About this Journal
- Abstracting and Indexing
- Aims and Scope
- Annual Issues
- Article Processing Charges
- Articles in Press
- Author Guidelines
- Bibliographic Information
- Citations to this Journal
- Contact Information
- Editorial Board
- Editorial Workflow
- Free eTOC Alerts
- Publication Ethics
- Reviewers Acknowledgment
- Submit a Manuscript
- Subscription Information
- Table of Contents
Advances in Mechanical Engineering
Volume 2013 (2013), Article ID 268046, 7 pages
Extended-Maxima Transform Watershed Segmentation Algorithm for Touching Corn Kernels
1School of Electrical and Electronic Engineering, Shandong University of Technology, Zibo 255049, China
2College of Engineering, China Agricultural University, Beijing 100083, China
Received 22 March 2013; Accepted 4 June 2013
Academic Editor: Yong Tao
Copyright © 2013 Yibo Qin et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Touching corn kernels are usually oversegmented by the traditional watershed algorithm. This paper proposes a modified watershed segmentation algorithm based on the extended-maxima transform. Firstly, a distance-transformed image is processed by the extended-maxima transform in the range of the optimized threshold value. Secondly, the binary image obtained by the preceding process is run through the watershed segmentation algorithm, and watershed ridge lines are superimposed on the original image, so that touching corn kernels are separated into segments. Fifty images which all contain 400 corn kernels were tested. Experimental results showed that the effect of segmentation is satisfactory by the improved algorithm, and the accuracy of segmentation is as high as 99.87%.
1,000-kernel weight is an important indicator of seed vitality. This parameter used to be measured by hand, but the process is inefficient, and the result is inaccurate. Using digital image processing to automatically measure 1,000-kernel weight is a fast and effective method being developed for future use with corn seed . As the kernels being imaged are usually touching each other, the counting accuracy by digital image processing is not as high as required, hence the need to develop an improved algorithm for the segmentation of the touching corn kernels.
Most of the literature about digital image segmentation of large quantities of seed focuses on round-shaped grains, such as rice and wheat [2–4]. For corn kernels, which have various sizes and irregular shapes, it is more difficult to segment the image, and there are few segmentation algorithms for corn kernels. Yaqiu et al.  proposed a watershed transform with gradually changing threshold for the segmentation of corn seed in digital images. That method is based on the area and the average width of the corn kernels, its main shortcoming is the large amount of calculation required. Xun et al.  presented an approach based on intersection areas and contours of touching kernels to search for segmentation points. This algorithm is most effective for two touching kernels. However, when the images show a large number of seeds with complicated connections, the authors report that the effect of segmentation is unsatisfactory.
Present cereal image segmentation methods include mathematical morphology , the concave point detection algorithm [6, 7], elliptic curve fitting [8, 9], the distance transform and watershed segmentation algorithm , the kernels’ contour curvature , and the active contour algorithm . As the watershed transform method has a good response to weak edges and smooth segmentation curves, it has widespread applications.
The watershed transform is a segmentation algorithm which is based on the topological structure of an image and can divide the image into a plurality of regions. The algorithm originated in the field of geodesy, specifically the study of watershed areas. The watershed area is digitally imaged and rendered into grayscale, with darker colors indicating lower altitudes. A water basin is thus constituted by a group of pixels surrounding a local grayscale minimum, including the minimum itself. With increasing water level, the region surrounding each local grayscale minimum gradually expands outwards, eventually forming a junction between neighboring water basins, called a watershed boundary [13, 14]. Corn kernels also have indentations due to their irregular shape, which function analogously to the water basins in the algorithm, allowing the “watershed boundaries” in the image, each surrounding a single kernel, to be computed.
Because of the irregular shape of corn kernels, the traditional watershed transform method always leads to oversegmentation. In this paper, by isolating the reason for the oversegmentation, we propose an improved watershed segmentation algorithm based on the extended-maxima transform that solves the problem of oversegmentation of touching corn kernels.
2. Segmentation Algorithm
2.1. Watershed Segmentation Transform
In this paper, all transformations are based on binary images. Before applying the watershed transform, we need to first carry out the distance transform. The distance transform (DT) labels each pixel of the image with the distance to the nearest boundary pixel in a binary image . This transform correctly segregates round and simple touching objects, but for kernels with irregular shapes, the images usually show several maxima after the distance transform, which leads to oversegmentation.
Image segmentation processing is shown in Figure 1, where image (a) represents the original image in grayscale. The image is converted to binary image (b) by morphologically opening  to smooth the edges. The image is subjected to a distance transform as shown in image (c). The grayscale image is equivalent to a topological map, with the maxima as peaks and the minima as valleys. The watershed algorithm obtains the watershed ridge lines shown in image (d). For ease of comparison, image (e) combines image (b) and (d). Finally, image (f) is obtained by overlaying images (b) with the complement of image (d). The black lines running through some of the kernels are watershed lines that cross an individual kernel.
Inspection of Figures 1(e) and 1(f) shows that many corn grains appear oversegmented, due to the fact that many corn kernels have more than one local maximum. Figure 2(a) shows the corn seed contours along with the local maxima obtained from the distance-transformed image in Figure 1(c). Figure 2(b) is an enlarged section of the same image clearly showing multiple local maxima on several seeds.
2.2. Extended-Maxima Transform
The -maxima transform in mathematical morphology , used to suppress pixels above a certain intensity, can extract local maxima related to target objects from the gray image. The extended-maxima transform can calculate the regional maximum, and constitute a binary image. The -maxima transformation suppresses all maxima whose depth is below or equal to a given threshold . This is achieved by performing the reconstruction by dilation of from , as shown in the following: where is the grayscale of original grayscale image, and is the threshold value. The extended-maxima EMAX are defined as the regional minima of the corresponding -maxima transformation, as shown in the following:
2.3. Watershed Segmentation Algorithm Based on the Extended-Maxima Transform
In this paper, the extended-maxima transform is used to eliminate oversegmentation. The algorithm is as follows: first, we perform a distance transformation on the original grayscale image. Next, we need to look for an appropriate value for the threshold parameter ; then, the -maxima transformation and extended-maxima transformation are applied sequentially to the distance-transformed grayscale image. After these transformations, we obtain a binary image. Watershed transform on this binary image yields watershed ridge lines. These ridge lines are then superimposed on the original binary image. Experimental data show that touching corn kernels can be segmented well by these watershed ridge lines, provided that is selected properly.
The key point of the algorithm is how to select the optimal threshold value , which can segment the original binary image correctly. In order to improve the calculation precision, firstly, the transformed image is normalized. That means that the grayscale will be in the range of after the distance transformation. We then repeat the entire algorithm after increasing by an increment until we obtain the optimum value for . If is greater than the optimum value range, it will not eliminate the oversegmentation. However, if is less than this range, “segmentation debris” (spurious bright or dark pixels that were not cleared out by the processing) will appear after segmentation, making subsequent image analysis processing unnecessarily difficult.
This paper uses the connected component labeling method  to count the region number of kernel images and determine the optimal range of the threshold value . Firstly, the number of kernels in the binary image created by the extended-maxima transform is calculated, and the results are recorded as . The watershed segmentation ridge lines based on the extended-maxima transform are superimposed to the original binary image; the segments results are recorded and counted as . When an allowable range of the threshold parameter is decreased, kernels in the binary image from the extended-maxima transform can be separated because the kernel edges are brighter than the main kernel. Unlike erosion operations, the extended-maxima transform can avoid discarding small objects as spurious, so it will not lose small particles through improper selection of structural elements in the erosion operations. Experimental data show that it can accurately predict the number of kernels when a small enough threshold is selected. Taking the collection of corn kernels in Figure 1 as an example, setting different values of gives different values of both and as shown in Figure 4. The data represent a stepwise change to with the increase of the threshold . When threshold is small, is constant and equal to the actual numbers of kernels in the image. We choose as the selection criterion the first value of where is equal to .
In conclusion, the steps of extended-maxima transform/watershed separation algorithm are as follows.(1)Convert the original grayscale image to binary and distance transform it. Then, normalize the obtained grayscale image. We call the resulting image .(2)Guess an initial threshold value , and perform an extended-maxima transform on . We call the new binary image .(3)Count the number of kernels in , which is based on connected components labeling; statistical number is obtained.(4)From a watershed segmentation transform on , we obtain watershed ridge lines and superimpose them onto the original binary image, obtaining a segmented image with each segment corresponding to a single kernel.(5)Count the number of kernels in segmented image, which is based on connected components labeling; statistical number is obtained.(6)If , (here take ), repeat steps , , , and , until .
3. Experiment and Analysis
3.1. Oversegmentation and “Segmentation Debris”
An extended-maxima transform and watershed segment transform are performed on the original image (Figure 1(a)) using different threshold values and . For ease of comparison, the binary image based on the extended-maxima transform is subtracted from the original binary image, and the centroid of the connected regions (kernels) are marked with “*.” When , oversegmentation occurs with the result , , as shown in Figure 5. On the other hand, when , there is some “segmentation debris” (the small particles cutting from the kernel region by watershed segmented ridge lines), and the result , is shown in Figure 6.
By analyzing Figures 5 and 6, we conclude that the value of the threshold parameter has great influence on the segmentation effect. When is too large, as shown in Figure 5, touching kernels cannot be effectively segmented. Figure 5(b) shows the result of subtracting the transformed image from the original binary image. The extended-maxima transform result as shown in Figure 5(a) is similar to the original image, but with less white space per kernel. It is this “similar scaling” that enables the extended-maxima transform watershed segmentation algorithm to correctly segment touching seeds. Due to the irregularity of the size and shape of corn kernels, the higher the similarity between extended-maxima transformed image and original binary image is, the more likely some kernels have been lost. Figure 5(c) is an example of oversegmentation. However, when is relatively small, Figure 6(b) shows that although every single kernel on the extended-maxima transformed binary image has shrunk the small kernels do not reflect the outlines of the original binary image very well. After the watershed segmentation, the segmented image shows “segmentation debris” at the border of touching kernels, shown in Figure 6(c). The number of kernels obtained by this process is often greater than the real number, but “segmentation debris” is often difficult to observe, so the miscount can easily go unnoticed.
3.2. Correct Segmentation
Observation and analysis of Figure 4: within the range of before has undergone its first step change, the points on curve intersect the curve giving the optimized segmentation threshold value . The optimal range of the threshold parameter can be obtained from Figure 4; in this case, there are two ranges, namely (0.21, 0.22) and (0.26, 0.36). Correct segmentation results are obtained in these threshold ranges. For example, taking gives the extended-maxima transform image, subtraction image, and segmented labeled image shown in Figure 7.
3.3. Experiment Results
We calculate the accuracy of the algorithm by segmenting 50 images, each of which contained 400 corn kernels. The results are shown in Table 1. The average number of segments is 399.46, the standard deviation is 1.05 segments, and the average segmentation accuracy rate is as high as 99.87%.
To observe the smoothness of the segmentation curve, we get boundaries of segmented regions which are labeling separately by different color, as is shown in Figure 8. By observing and analyzing the boundaries of the labeling region below, what can be concluded is that the majority of split curve is smooth between the adhesion of the particles. As for the closer and complicated adhesion phenomenon for some kernels, it can be seen from the segmented figure that few split curves show distortion phenomenon.
From the previous theoretical analysis and experimental results, we have shown that irregularly shaped corn kernels usually are oversegmented by the traditional watershed segmentation algorithm, which is harmful to subsequent image processing. This paper proposes an improved watershed algorithm based on the extended-maxima transform in which the threshold value parameter is gradually increased. By comparing the statistical number of connected regions between an image transformed with the extended-maxima transform and that transformed with the watershed segment algorithm, the optimal range of threshold value can be obtained. Experimental data shows that, within the optimal range of the threshold value, touching kernels can be effectively segmented by the proposed algorithm, and the correct number of kernels can be obtained. The accuracy of segmentation is as high as 99.87%.
The authors gratefully acknowledge assistance from Professor Mike Hey from the University of Nottingham, Dr. John S. Hyatt from the Georgia Institute of Technology, and also give thanks to the China National Science and Technology Support Program (Grant no. 2012BAK08B04) and the Natural Science Foundation of Shandong Province (Grant no. ZR2012FL22).
- Z. Yaqiu, W. Wenfu, and W. Gang, “Separation of corn seeds images based on threshold changed gradually,” Transactions of the Chinese Society of Agricultural Engineering, vol. 27, no. 7, pp. 200–204, 2011 (Chinese).
- P. Shatadal, D. S. Jayas, and N. R. Bulley, “Digital image analysis for software separation and classification of touching grains: I. Disconnect algorithm,” Transactions of the American Society of Agricultural Engineers, vol. 38, no. 2, pp. 635–643, 1995.
- W. Wang and J. Paliwal, “Separation and identification of touching kernels and dockage components in digital images,” Canadian Biosystems Engineering, vol. 48, pp. 1–7, 2006.
- L. Yan, C.-W. Park, S.-R. Lee, and C.-Y. Lee, “New separation algorithm for touching grain kernels based on contour segments and ellipse fitting,” Journal of Zhejiang University Science C, vol. 12, no. 1, pp. 54–61, 2010.
- Y. Xun, G. Bao, Q. Yang, F. Gao, and W. Li, “Automatic segmentation of touching corn kernels in digital image,” Transactions of the Chinese Society of Agricultural Machinery, vol. 41, no. 4, pp. 163–167, 2010 (Chinese).
- N. S. Visen, N. S. Shashidhar, J. Paliwal, and D. S. Jayas, “Identification and segmentation of occluding groups of grain kernels in a grain sample image,” Journal of Agricultural Engineering Research, vol. 79, no. 2, pp. 159–166, 2001.
- G. Hua, W. Yaqin, and G. Pingju, “Research on segmentation algorithm of adhesive plant grain image,” in Proceedings of the 8th International Conference on Electronic Measurement and Instruments (ICEMI '07), pp. 2927–2930, August 2007.
- G. Zhang, D. S. Jayas, and N. D. G. White, “Separation of touching grain kernels in an image by ellipse fitting algorithm,” Biosystems Engineering, vol. 92, no. 2, pp. 135–142, 2005.
- G. Zhang, J. Deng, and D. S. Jayas, “Separation touching grain kernel in machine vision application with Hough Transform and morphological transform,” in Proceedings of the Canadian Society of Agricultural Engineering (CSAE/SCGR '05), Paper no. 05-006, June 2005.
- W. Wang and J. Paliwal, “Separation and identification of touching kernels and dockage components in digital images,” Canadian Biosystems Engineering, vol. 48, pp. 7.1–7.7, 2006.
- E. H. Van den Berg, A. G. C. A. Meesters, J. A. M. Kenter, and W. Schlager, “Automated separation of touching grains in digital images of thin sections,” Computers and Geosciences, vol. 28, no. 2, pp. 179–190, 2002.
- Y.-C. Wang and J.-J. Chou, “Automatic segmentation of touching rice kernels with an active contour model,” Transactions of the American Society of Agricultural Engineers, vol. 47, no. 5, pp. 1803–1811, 2004.
- R. C. Gonzalez, Digital Image Processing, Prentice Hall, Upper Saddle River, NJ, USA, 2002.
- L. Vincent and P. Soille, “Watersheds in digital spaces: an efficient algorithm based on immersion simulations,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 13, no. 6, pp. 583–598, 1991.
- A. Rosenfeld and J. L. Pfaltz, “Sequential operations in digital picture processing,” Journal of the ACM, vol. 13, no. 4, pp. 471–494, 1966.
- P. Soille, Morphological Image Analysis: Principles and Applications, Springer, New York, NY, USA, 2003.
- S. Halkiotis, T. Botsis, and M. Rangoussi, “Automatic detection of clustered microcalcifications in digital mammograms using mathematical morphology and neural networks,” Signal Processing, vol. 87, no. 7, pp. 1559–1568, 2007.
- K. Suzuki, I. Horiba, and N. Sugie, “Linear-time connected-component labeling based on sequential local operations,” Computer Vision and Image Understanding, vol. 89, no. 1, pp. 1–23, 2003.