Research of segmentation method on color image of Lingwu long jujubes based on the maximum entropy
 Yutan Wang^{1}Email author,
 Yingpeng Dai^{1},
 Junrui Xue^{1},
 Bohan Liu^{1},
 Chenghao Ma^{1} and
 Yaoyao Gao^{1}
DOI: 10.1186/s1364001701825
© The Author(s). 2017
Received: 28 February 2017
Accepted: 2 May 2017
Published: 12 May 2017
Abstract
This paper researches on methods of the color image segmentation method of Lingwu long jujubes based on the maximum entropy to achieve the accuracy of image segmentation and improve accuracy of machine recognition. According to law between the color of Lingwu long jujubes and characteristic of environment, starting from the hue information, this paper is first to explore the difference between the hue of Lingwu long jujubes and the environment which it lives and then use maximum entropy to segment image. It finds optimal threshold by mathematical criterion judging the accuracy of image segmentation. The method of preprocessing of image is mean filter firstly. Then, it extracts hue information of true color image and uses maximum entropy for image segmentation, judging accuracy of image segmentation by segmentation area whether it is in accordance with the 3σ principle. Mathematical morphology is used for smoothing image and eliminating small holes. Finally, segmented image will be obtained through labeling the image by using methods of labeled image and using characteristic parameters for extracting feature. By comparing the segmentation effect with artificial method of the 30 Lingwu long jujubes images, it proves that the color image segmentation method of Lingwu long jujubes based on the maximum entropy has good effect to extract the object region. The accuracy of segmentation rate is up to 89.60%. The time that the algorithm run is 1.3132 s.
Keywords
Maximum entropy Image processing Image segmentation Adaptive threshold Lingwu long jujubes1 Introduction
Lingwu long jujubes are important economical fruits in Ningxia. To improve packing efficiency and reduce labor intensity, there is an increasing demand for automatic picking techniques. The identification of fruits plays a key role in automatic packing. Not only is image segmentation basic of image processing which effects directly the performance of image recognition but also it is a difficulty for digital image processing. Sweden, Canada, and Finland research image segmentation algorithms based on machine vision [1–7]. No algorithm, however, is aimed at Lingwu long jujubes. Existing approaches on image segmentation and feature extraction for Lingwu long jujubes have many disadvantages. Although image recognition of fruits based on machine vision starts relatively late, it develops rapidly. Professor Jiangming Kan from Beijing forestry university researches computer visionbased method of automatic measurement of trunk and branch diameters of standing trees and threedimensional reconstruction [8, 9]. Doctor Yutan Wang studies on Lingwu long jujubes’ localization and maturity recognition [10]. Algorithm should be effectiveness or high efficiency [11, 12]. This paper attempts to use improved image segmentation algorithm based on maximum entropy method in image recognition of Lingwu long jujubes, which provides more selection and comparison for image segmentation algorithm of Lingwu long jujubes in the process of automatic picking.
According to actual picking environment of Lingwu long jujubes, this paper finds the rules between hue of Lingwu long jujubes and the surrounding environment and extracts hue information of true color image. Then, it puts forward that the way of combining maximum entropy method and mathematical criterion selects adaptively optimal threshold for image segmentation by analyzing hue histogram of a set of images. Finally, aiming at disadvantages of the image after segmentation, mathematical morphology, labeling, and future selection are used for post processing to extract accurate target feature.
2 Materials and methods
2.1 Image acquisition of Lingwu long jujubes
Hardware equipment of image acquisition includes Levono mobile phone and HP PC computer. For the convenience of experiment, this paper sets the revolution of images to 340 * 300. The type of mobile phone is Lenovo P700 and eight million pixels. The parameters of PC are as follows: HP Pavilion g series, Inter(R) Core(TM) i32310M CPU @ 2.10 GHz 2.10 GHz, RAM 2.00, and Windows 7 ultimate ×32. The image is collected under environment of sunny and stored in JPG.
2.2 Preprocessing of image
Pixel neighborhood distribution
(i − 1, j − 1)  (i − 1, j)  (i − 1, j + 1) 
(i, j − 1)  (i, j)  (i, j + 1) 
(i + 1, j − 1)  (i + 1, j)  (i + 1, j + 1) 
The pixel value in the position of (i, j) is replaced with g(i, j).
The method, processing channel R, G and B by the same template, has a little effect on each channel, avoiding effectively the image distortion caused by neglecting the link among channels.
2.3 Extraction of hue
2.4 Deflection of hue
2.5 Maximum entropy method and mathematical criterion
2.5.1 Maximum entropy method [15]
In the above formula, p _{ k } ≥ 0 and \( {\displaystyle \sum_{k=0}^{L1}{p}_k}=1 \).
where \( P{\mathrm{th}}_1={\displaystyle \sum_{k=0}^T{p}_k} \), Pth_{2} = 1 − Pth_{1}.
2.5.2 Mathematical criterion
3σ criterion is also called the Lagrandian criterion. When the experimental data are normal or nearly normal distribution, it can be determined by a certain probability interval that is desired data.
In the normal distribution, σ represents standard deviation and μ represents the value of mean. x = μ is the axis of symmetry.

The probability of the numerical distribution is 0.6826 in the area (μ − σ, μ + σ).

The probability of the numerical distribution is 0.9544 in the area (μ − 2σ, μ + 2σ).

The probability of the numerical distribution is 0.9974 in the area (μ − 3σ, μ + 3σ).
It can be considered that the probability is almost entirely concentrated in the interval (μ − 3σ, μ + 3σ) beyond the possibility of this range accounted for less than 0.3%.
It can be considered that two objects can be distinguished when gray distribution meets formula (13). The value of α can be adjusted properly according to different condition. The value of α is less than 3.
2.5.3 Adaptive adjustment of threshold
It can be seen from the adjusted histogram that the gray value of the hue component is in the smallest part compared with other parts, which is convenient for the threshold adaptive adjustment to segment the target correctly.
Image segmentation is the process of distinguishing target objects from background objects. It is possible to use multiple maximum entropy method to segment the target objects correctly when more than two different regions need to be segmented in the image. Each segmentation needs to judge the position of target regions relative to the threshold. It may be found how to select the threshold that the hue of Lingwu long jujubes is located in the smallest part in hue histogram.
According to mathematical (3σ) criterion, it is considered that the two targets can be distinguished when its gray distribution satisfies formula (13). There are multiple targets in the image in the process of actual segmentation. Therefore, the image often needs to be segmented several times for segmenting the target objects. But there is a case where the target objects are not divided and the formula (13) is satisfied. In other word, whether the regions segmented are target objects or not, the formula (13) is satisfied when two regions can be distinguished.
Two objects can be distinguished in the condition J ≥ 0.
Assuming J(q) is the value of value function when image is segmented q times, when it meets the relation,
J(q) > 0 and J(q + 1) < 0 or
J(q − 1) < 0 and J(q) > 0
2.6 Post processing of image segmented
For post processing of image, there are several methods including mathematical morphology, labeling, and feature selection.
2.6.1 Mathematical morphology
Mathematical morphology contains four basic operations: dilation, erosion, open, and close.
2.6.2 Labeling and feature selection
Labeling is a method of processing an area in which the same areas are marked with the same marks and the different areas are marked with different marks.
The feature parameters include the area, perimeter, compactness, moment, and eccentricity. Different objects can be differentiated and extracted by using those feature parameters.
In this paper, the area is selected as the characteristic parameter extracting target. Firstly, the different object in the image is marked by the method of labeling, and then, the area of each object is calculated to extract the target objects through threshold set.
3 Algorithm steps

Step 1: input original image.

Step 2: preprocessing of original image.

Step 3: extract hue information.

Step 4: maximum entropy method is used to obtain threshold T in the range from 0 to G, then calculate the mean M1,M2 and standard deviation Sd1, Sd2.

Step 5: calculate J(p) by J(p) = M _{1} − M _{2} − α(Sd _{1} + Sd _{2}).

Step 6: judging whether (J(p) > 0 and J(p + 1) < 0) or (J(p1) < 0 and J(p) > 0) when cycle two or more time. If J(p) meets the criteria, go to step 7. If not, let G = T and go to step 4.

Step 7: image is segmented though the threshold which J(p) obtained is corresponding to T.

Step 8: post processing by using mathematical morphology.

Step 9: output image segmented.
4 The result of experiment and analysis
Date of segmentation of Lingwu long jujubes
Experiment number  The numbers of Lingwu long jujubes in the artificial segmentation  The numbers of wrong segmentation  Error rate (%)  Running time (s) 

1  11,294  701  5.84  1.520 
2  27,901  880  3.06  1.495 
3  22,270  3480  13.51  1.506 
4  32,451  2900  8.20  1.606 
5  5735  859  13.03  1.007 
6  7949  1471  15.62  1.584 
7  19,461  1959  9.15  1.396 
8  17,171  6740  28.19  1.580 
9  25,817  2604  9.16  1.469 
10  41,257  4579  9.99  1.560 
11  22,273  4309  16.21  1.394 
12  14,716  1757  10.67  0.732 
13  17,464  1892  9.77  1.626 
14  22,976  1659  6.73  1.447 
15  17,884  1339  6.97  1.423 
16  19,892  4110  17.12  0.726 
17  8256  2133  20.53  1.520 
18  12,704  2861  18.38  0.956 
19  21,830  3013  12.13  1.526 
20  19,365  4496  18.84  1.449 
21  17,825  1418  7.37  1.422 
22  13,662  2072  13.17  0.741 
23  26,642  2104  7.32  1.419 
24  10,434  445  4.09  1.439 
25  15,980  1189  6.93  1.395 
26  15,516  1570  9.19  1.396 
27  12,571  3641  22.46  0.779 
28  8793  675  7.13  1.576 
29  23,517  1481  5.92  1.564 
30  25,663  1769  6.45  1.562 
 1.
The image segmentation is performed by the hue information, and the more cyan region of Lingwu long jujubes is not identified.
 2.
There is the same trend of hue information among adjacent regions in target objects and background objects.
It can be learned from 14 (a), 14 (b), 14 (c) and 14 (d), both images segmented of the new algorithm and images of the artificial segmentation have the same effect of segmentation, with accurate regions of extraction except the small error in the local area.
5 Discussion and conclusions
 1.
The feature extraction depends on the red range of the image and not consider the blue part of the date.
 2.
The angle of rotation is uncertainly. If hue angle of rotation is too large, the local hue value of the date changes greatly, which is not conducive to the segmentation.
 3.
Uncertainly of parameters in mathematical criterion. It is possible that the same parameter may have a large difference in the two types of divisions with respect to the slight difference in hue.
Based on the characteristics of the growth environment of Lingwu long jujubes, this paper is first to make statistical analysis of information to find out the difference between Lingwu long jujubes and other parts in the image and then extract the color information by transforming color space from RGB and HSV. Combining the distribution characteristics of red, the hue is rotated at certain angle. By analyzing the histogram of hue information, there are many valleys and peaks and each mountain peak is approximately normal distribution. There are many valleys and peaks, and each mountain peak is approximately normal distribution by analyzing the histogram of hue information. Therefore, the maximum entropy method and mathematical criterion are adopted to adaptively select the appropriate threshold. Finally, mathematical morphology, labeling, and feature selection are used to post processing to extract accurate target objects. A set of mathematical methods such as statistical analysis, maximum entropy, mathematical criteria, and mathematical morphology are used in this paper, which can well control the adaptive threshold selection and find the optimal threshold. The correct rate of segmentation is 89.60% through the test of 30 similar images of Lingwu long jujubes. In the literature [17, 18], the segmentation of the Lingwu long jujube image is based on the L * a * b color space and the color difference fusion. The correct segmentation rate of Lingwu long jujube is over 92.6% and the running time is 2.1889s. In this paper, the average running time, which is higher than 0.8757 s, is 1.3132 s. Although it is a little lacking in the correctness of segmentation, it greatly improves the operation speed. This method can meet the requirement of image realtime processing and can provide the theoretical basis for intelligent harvesting of Lingwu jong jujubes based on the requirement of segmentation accuracy.
Declarations
Funding
This work is supported by the National Natural Science Foundation of China (31660239) and the Ningxia Natural Science Foundation of China (NZ15007).
Authors’ contributions
YTW and YPD drafted the main part of the manuscript. YPD carried out the experiments. JRX organized the experimental data. JRX, BHL, CHM, and YYG conceived of the study, participated in the design of the experiments, and helped modify the manuscript. All authors read and approved the final manuscript.
Competing interests
The authors declare that they have no competing interests.
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Open AccessThis article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
Authors’ Affiliations
References
 K Vestlund, Aspects of automation of selective cleaning. Doctoral thesis, Swedish University of Agricultural Sciences, 2005Google Scholar
 K Vestlund, T Hellström, Requirements and system design for a robot performing selective cleaning in young forest stands. J. Terramech. 43(2006), 505–525 (2006)View ArticleGoogle Scholar
 T Hellström, Autonomous navigation for forest machines. A Project Pre. 48(2), 115–130 (2002)Google Scholar
 T Østensvik, KB Veiersted, E Cuchetc, P Nilsen, JJ Hanse, C Carlzon, J Winkel, A search for risk factors of upper extremity disorders among forest machine operators: a comparison between France and Norway. Int. J. Ind. Ergon. 2008(38), 1017–1027 (2008)View ArticleGoogle Scholar
 O Ringdahl, Path tracking and obstacle avoidance for forest machines. Master’s thesis, University of Umea, 2003:31–48.Google Scholar
 NA Clark, RH Wynne, DL Schmoldt, M Winn, An assessment of the utility of a nonmetric digital camera for measuring standing trees. Master’s thesis, Virginia Polytechnic Institute and State University, 1998Google Scholar
 AD Legues, JA Ferland, CC Ribeiro, JR Vera, A Weintraub, Atabu search approach for solving a difficult forest harvesting machine location problem. Eur. J. Oper. Res. 179(2007), 788–805 (2007)View ArticleMATHGoogle Scholar
 JM Kan, Computer vision based method for 3D reconstruction of the standing trees. Doctor's thesis, Bejing Forestry University, 2008.Google Scholar
 JM Kan, WB Li, RS Sun, Computer vision based method of automatic measurement of trunk and branch diameters of standing trees. J. Bejing For. Univ. 29(4), 5–9 (2007)Google Scholar
 YT Wang, Research on methods of Lingwu long jujubes’ localization and maturity recognition based on machine vision. Doctor's thesis, Bejing Forestry University, 2014.Google Scholar
 C Yan, Y Zhang, J Xu, F Dai, L Liang, QH Dai, F Wu, A highly parallel framework for HEVC coding unit partitioning tree decision on manycore processors. IEEE Signal Process. Lett. 21(5), 573–576 (2014)View ArticleGoogle Scholar
 C Yan, Y Zhang, J Xu, F Dai, J Zhang, QH Dai, F Wu, Efficient parallel framework for HEVC motion estimation on manycore processors. IEEE Trans. Circuits Syst. Video Technol. 24(12), 2077–2089 (2014)View ArticleGoogle Scholar
 J Yang, Shuzi Tuxiang Chuli Ji MATLAB Shixian (Publishing House of Electronics Industry, Beijing, 2014)Google Scholar
 M Sun, Shuzi Tuxiang Chuli Yu Fenxi Jichu—MABLAB He VC++ Shixian (Publishing House of Electronics Industry, Beijing, 2013)Google Scholar
 T Cove, Elements of information theory (China Machine Press, Beijing, 2008)Google Scholar
 GH Wu, Gailv Lun Yu Shuli Tongji (China Renmin University Process, Beijing, 2011)Google Scholar
 YT Wang, WB Li, S Pang, JM Kan, Segmentation method of Lingwu long jujubes based on L*a*b* color space. TelkomnikaIndonesian J. Electr. Eng. 11(9), 5344–5351 (2013)Google Scholar
 YT Wang, JM Kan, WB Li, CD Zhan, Image segmentation and maturity recognition algorithm based on color features of Lingwu long jujube. Adv. J. Food Sci. Technol. 5(12), 1625–1631 (2013)Google Scholar