## 1 Introduction  
Performing segmentation operations in accordance with the desired purpose has different complexities. In principle, segmentation operations in agriculture and horticulture are more complex than other sectors. This complexity is because of crowded backgrounds with various objects. In applications such as site-specific spraying and combat weeds, segmentation is the first step in the design of machine vision systems [1; 2; 3; 4]. The segmentation involves various steps depending on the complexity of the background of the image and may include a combination of several methods. Therefore, the programmer skill is very important in this field. Generally, the conventional methods of segmentation are color index-based segmentation, threshold-based segmentation and learning-based segmentation [5] that in this research we used threshold-based segmentation method as one method that combine with other method. [PERSON] et al. [6] believed that segmentation of vegetation cover from field images is a necessary issue. For this reason, they proposed a new segmentation method based on particle swarm optimization clustering and morphological modeling in a color space of L*a*b*. In this regard, they captured images at 10, 12 and 14 o'clock. The proposed method has two stages of offline learning and online segmentation. In the offline learning process, the number of optimized clusters was determined based on the training sample set. In the second step, each pixel was classified as vegetation class or non-vegetation class. In the last step, 200 images were used to test the proposed system. The results showed that the average segmentation quality of the images was 88.1% to 91.7%. Because of the successive droughts in the world and the consequent reduction in groundwater levels, as well as due to increased population, the need for agricultural water management is quite felt. One way to deal with water shortage is to use water only in areas where the crop has been cultivated, because it will only be consumed by the product and thus the amount of waste of water will be minimized. In large-scale lands, the possibility to achieve this without the use of new technologies is almost zero. For this reason, it is possible to detect places with crops using machine vision systems. In this regard [PERSON] et al. [7] believed that in order to achieve precision agriculture goals, not only new technologies but also software development were necessary. Therefore, they provided a new application of the machine vision system in the form of an automated segmentation system of plants from background to monitor the cabbage during growth, to provide product information that is needed to estimate the amount of water required for the crop. Their proposed system consisted of three main steps: 1) imaging and cutting, 2) analyzing the image, and 3) recording information. In order to imaging, wooden frames were installed inside the farm, and then the images were taken. In order to train the proposed system, 1106 cabbage samples were used. The results showed that the proposed system had a 20% error in counting the cabbage. In another study [PERSON] et al. [8] provided a multi-inference trees segmentation method to better manage farms. The algorithm worked out based on image features and user requirements. In fact, the algorithm learns the related rules according to these two, and then applies the color space, the transformation to the gray image method, the de-noising method, the local segmentation method, and the morphology processing method after applying each rule. To train the proposed algorithm, 2082 images with a resolution of \(1932\times 2576\) were captured. A manual method was also used to evaluate intelligent results. The results showed that the intelligent processing assessment rate for more than 80 points was above 83% with an average of 75%. The processing time of each image needs about 23 seconds. [PERSON] et al. [9] developed a machine vision system for segmentation of apple fruit based on color and position information.