An automatic threshold color factor algorithm for green vegetation image segmentation
Through the automatic threshold color factor algorithm, the ExG and Otsu algorithm combined with the change law of g-channel data is used to achieve efficient and accurate segmentation of green vegetation images, and solve the problems of inaccurate segmentation and complex calculations in the existing technology.
Patent Information
- Application Number
- CN202210975926.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-08-15
AI Technical Summary
The existing color factor algorithms have problems of inaccurate segmentation and complex calculations in vegetation image segmentation, especially in the automatic thresholding method, which makes it difficult to quickly and effectively distinguish vegetation from background.
An automatic threshold color factor algorithm is used to normalize the color images in RGB space, and the ExG color factor is used to perform grayscale and initial segmentation of Otsu algorithms, count the number of green plant pixels, select appropriate pixel rows, intercept g channel data, search for the dividing point of the rising edge of the g value, automatically determine the threshold, and efficient segmentation of vegetation images.
Adaptive vegetation segmentation without artificially setting parameters is realized, the accuracy and efficiency of segmentation are improved, the operation process is simplified, and the shortcomings of inaccurate segmentation and complex calculations in the prior art are overcome.
Smart Images

Figure CN115294164B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of color factor algorithms, in particular to an automatic threshold color factor algorithm for green vegetation image segmentation. Background Art
[0002] Since the 1990s, monitoring of crop growth information has been an important part of the development of smart agriculture. Timely, accurate and rapid acquisition of crop growth status and trends can provide reliable decision-making support information for agricultural management, provide prior knowledge and estimation parameters for crop yield estimation, and play an important role in agricultural management and optimization of production methods.
[0003] Computer vision technology can effectively detect vegetation for crop growth monitoring. Vegetation detection based on computer vision requires a series of image processing operations, starting with vegetation segmentation, which separates the pixels in the image into two categories: plant (crops and weeds) and background (soil and residue). Vegetation segmentation is a necessary step and must be performed using appropriate methods, as the quality of segmentation directly affects the accuracy of vegetation detection.
[0004] Color factor is a common method for image segmentation that utilizes the inherent color characteristics of green vegetation. Typically, color factors convert RGB images into grayscale images that enhance vegetation information, such as the Super Green Index (ExG), Green Leaf Index (GLI), Normalized Green-Red Difference Index (NGRDI), Super Green-Red Index (ExGR), Vegetation Index (VEG), and Color Factor for Vegetation Extraction (CIVE).
[0005] All vegetation image segmentation methods based on color factors require a threshold segmentation method to generate a vegetation mask image. The choice of threshold directly impacts the quality of vegetation image segmentation. Threshold determination methods can be categorized into fixed thresholding and automatic thresholding. Fixed thresholding methods typically use grayscale images generated by color factors, and the appropriate threshold is selected through repeated manual experimentation. Unlike fixed thresholding methods, automatic thresholding methods are highly adaptable to different images and highly efficient, not relying on empirical knowledge to determine the threshold. A commonly used automatic thresholding method is the Otsu method, which has been widely used. However, it can still lead to inadequate segmentation, where some green pixels are not identified. Other automatic thresholding methods exist, but they are computationally complex and require multiple steps. For example, in the paper "Estimation of leaf area index incereal crops using red–green images. Biosyst" (Eng. 104, 308–317, 2009), Kirk's algorithm, based on greenness and intensity pixel values, requires constructing two Gaussian distribution functions of intensity to automatically determine the threshold, resulting in low efficiency.
[0006] In summary, the use of image processing techniques in computer vision for vegetation detection currently plays a vital role in monitoring crop growth. Vegetation segmentation, a key component, is used for tasks such as weed detection, crop growth monitoring, pest and disease diagnosis, and automated navigation. Color index methods have been developed for vegetation segmentation. However, current color index methods suffer from limitations such as reliance on selecting appropriate coefficients and formulas, and the need to determine the appropriate threshold for segmentation. Furthermore, commonly used automatic thresholding methods face challenges such as inaccurate segmentation and computational complexity. Summary of the Invention
[0007] The purpose of the present invention is to overcome the deficiencies of the prior art and provide an automatic threshold color factor algorithm for green vegetation image segmentation.
[0008] The present invention solves the technical problem by adopting the following technical solutions:
[0009] An automatic threshold color factor algorithm for green vegetation image segmentation is characterized by the following specific steps:
[0010] Step 1: First, normalize the color image in RGB space to obtain image data in RGB space;
[0011] Step 2, screening feature pixel rows, includes the following steps:
[0012] (1) Grayscale the RGB image using the ExG color factor to obtain a grayscale image with enhanced vegetation features;
[0013] (2) Then, the threshold of the grayscale image is obtained using the Otsu algorithm, and binarization is performed to initially segment the pixels into vegetation and background.
[0014] (3) Count the number of green plant pixels in each row, and then roughly extract vegetation information based on the binary image;
[0015] (4) Select the appropriate pixel row with the largest percentage of green plant pixels but less than 100%;
[0016] (5) In this pixel row, from left to right, intercept the g channel data from the first pixel to the right edge of the green leaf in this row as the input of the subsequent automatic threshold segmentation process;
[0017] Step 3: In the automatic threshold segmentation algorithm, the threshold is automatically determined by searching for the dividing point in the rising segment of the g value in the g channel data to complete the vegetation image segmentation in the entire image.
[0018] Moreover, the automatic threshold segmentation in step 3 includes the following steps:
[0019] (1) Taking the starting point of the intercepted g channel data as the dividing point, the data set is divided into two groups, A and B;
[0020] (2) Determine whether the g value at the dividing point is greater than all values in A and less than all values in B. If this condition is not met, the dividing point is updated to the next point and the judgment continues;
[0021] (3) If the conditions of the previous step are met, the point that meets the conditions is recorded as i, the g value of the point is selected as the threshold, and the entire g channel image is binarized using the determined threshold;
[0022] (4) Filter and fill holes in the binary image obtained in the previous step to form a mask image;
[0023] (5) Through the AND operation between the mask image and the original color image, it is converted to RGB format and finally the vegetation segmentation image is extracted.
[0024] Moreover, in step 3, automatic threshold segmentation of vegetation is performed based on the change pattern of the intercepted g channel data. At the junction of the soil and vegetation, the g value changes significantly. There is a dividing point i on the rising edge. By obtaining the point value Ti, the pixels in the vegetation area can be automatically distinguished from the pixels in the background area.
[0025] Moreover, the criterion formula for automatically determining Ti is as follows:
[0026] g1=max{g(t)|1<t<i}<T i <g2=min{g(u)|i<u<n}
[0027] For n pixels in a pixel row, the array g(t) represents all pixel values before point i, and the array g(u) represents all pixel values after point i. g1 is the maximum value in g(t), and g2 is the minimum value in g(u). By determining the threshold, the vegetation area is automatically segmented: where the g value is greater than T i The pixels are vegetation area pixels, otherwise they are background area pixels.
[0028] Moreover, in step 2, after obtaining the g channel data, a g channel information curve is drawn, and then the threshold is automatically determined by searching for the dividing point in the rising edge of the g value curve.
[0029] The advantages and positive effects of the present invention are:
[0030] 1. This paper proposes a new color factor to provide an adaptive segmentation strategy: by leveraging the variation of the normalized g threshold, it automatically determines the threshold for vegetation segmentation. This method requires no manual parameter setting and is fully automated, replacing the traditional segmentation strategy of selecting the appropriate color factor and threshold through repeated experimentation. Experimental results demonstrate that this method outperforms previous color factor segmentation methods, enabling simple and efficient automatic segmentation.
[0031] 2. The present invention is different from the previous segmentation ideas of selecting appropriate color factors. This method does not rely on changing the color factor formula of variables and coefficients. Secondly, by analyzing the changing rules of normalized green channel information, an automatic threshold determination method is designed to replace the fixed threshold segmentation idea of repeatedly conducting experiments to select a reasonable threshold. At the same time, it makes up for the shortcomings of inaccurate segmentation and complex calculation in the currently commonly used automatic threshold method, and can quickly and stably realize the automatic segmentation of vegetation. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is the execution process of the adaptive threshold segmentation algorithm;
[0033] Figure 2 These are the curves of each component change in the normalized space. (a) r component change curve; (b) g component change curve; (c) b component change curve;
[0034] Figure 3 It is a flowchart for screening feature pixel rows;
[0035] Figure 4 It is the flow chart of automatic threshold segmentation algorithm;
[0036] Figure 5There are three groups of intuitive comparison results, each group contains 8 types of results and local magnification images: (a) original image; (b) true value benchmark image; (c) algorithm in this paper; (d) ExG+Otsu; (e) GLI+Otsu; (f) NDI+Otsu; (g) ExGR+Otsu; (h) VEG+Otsu. DETAILED DESCRIPTION
[0037] The present invention will be further described in detail below with reference to the accompanying drawings and through specific embodiments. The following embodiments are merely illustrative and non-restrictive, and the scope of protection of the present invention cannot be limited thereto.
[0038] An automatic threshold color factor algorithm for green vegetation image segmentation. The automatic threshold color factor based on normalized green channel (g channel) information developed by this method mainly includes two steps: screening feature pixel rows and automatic threshold segmentation. The execution order is as follows: Figure 1 shown.
[0039] Color Factor
[0040] Color factors are mostly generated in the RGB color space. In the RGB color space, the red, green, and blue components are separated and used in the color factors in an independent manner. The general format of the color factor can be derived:
[0041] color index = c1R + c2G + c3B + k
[0042] Where c1, c2, c3, and k are coefficients. Different coefficients are determined to deal with specific segmentation situations, thereby generating these color factors. Commonly used color factors in vegetation segmentation research include the super green index (ExG), green leaf index (GLI), normalized green-red difference index (NGRDI), super green-red index (ExGR), vegetation index (VEG), and vegetation extraction color factor (CIVE). Their formulas are as follows:
[0043] ExG=2G-RB (1)
[0044] GLI=(2G-RB) / (2G+R+B)
[0045] NGRDI=(GR) / (G+R)
[0046] ExGR=4G-1.4R-1
[0047] VEG=G / (R 0.667 B 0.333 )
[0048] CIVE=-0.811G+0.441R+0.385B+18.78745
[0049] Step 1: First, normalize the color image in RGB space to obtain image data in RGB space;
[0050] Source of color images in this embodiment: The images used for vegetation segmentation input are from the data set published by the University of Bonn, which aims to provide assistance to researchers engaged in agricultural work and is mainly used for plant classification, positioning and mapping. The images used are all collected against the background of a beet field, and the image content mainly consists of three parts: beets, weeds and soil. Cropping is performed on the original image to obtain 13 intercepted images as the experimental input source. In order to subsequently verify the segmentation performance of the algorithm, the beet image is manually segmented to create a benchmark (i.e., reference) image. The adaptive segmentation method in this article is compared with its corresponding benchmark image and the segmented image after color factor processing to evaluate the image segmentation performance.
[0051] Step 2, as described in step 1, filters the feature pixel rows, including the following steps:
[0052] (1) Grayscale the RGB image using the ExG color factor to obtain a grayscale image with enhanced vegetation features;
[0053] (2) Then, the threshold of the grayscale image is obtained using the Otsu algorithm, and binarization is performed to initially segment the pixels into vegetation and background.
[0054] (3) Count the number of green plant pixels in each row, and then roughly extract vegetation information based on the binary image;
[0055] Before performing automatic threshold segmentation, it is necessary to ensure that the proportion of vegetation exceeds the soil background. However, the ratio of green plants to soil background in most images is significantly different. Manually setting a fixed ratio is not universal. Therefore, it is necessary to count the number of green plant pixels in each row.
[0056] (4) Select the appropriate pixel row with the largest percentage of green plant pixels but less than 100%;
[0057] (5) In this pixel row, from left to right, intercept the g channel data from the first pixel to the right edge of the green leaf in this row as the input of the subsequent automatic threshold segmentation process;
[0058] (6) The g channel information curve can be drawn;
[0059] Step 3: In the automatic threshold segmentation algorithm, the threshold is automatically determined by searching for the dividing point on the rising edge of the g value curve or by searching for the dividing point in the rising segment of the g value in the g channel data, thereby completing the vegetation image segmentation in the entire image.
[0060] The execution process is as follows, see Figure 4As shown in Figure 2, based on the change pattern of the intercepted g channel data, the automatic threshold segmentation of vegetation is performed. At the junction of soil (background) and vegetation (foreground), the g value changes significantly, as shown in Figure 2. Figure 2 In the rising edge shown in (a), there is a dividing point i in the rising edge. By obtaining the value Ti of this point, the pixels in the vegetation area and the pixels in the background area can be automatically distinguished. The criterion formula for automatically determining Ti is as follows:
[0061] g1=max{g(t)|1<t<i}<T i <g2=min{g(u)|i<u<n}
[0062] For n pixels in a pixel row, the array g(t) represents all pixel values before point i, and the array g(u) represents all pixel values after point i. g1 is the maximum value in g(t), and g2 is the minimum value in g(u). By determining the threshold, the vegetation area is automatically segmented: where the g value is greater than T i The pixels are vegetation area pixels, otherwise they are background area pixels. Automatic threshold segmentation includes the following steps:
[0063] (1) Taking the starting point of the intercepted g channel data as the dividing point, the data set is divided into two groups, A and B;
[0064] (2) Determine whether the g value at the dividing point is greater than all values in A and less than all values in B. If this condition is not met, the dividing point is updated to the next point and the judgment continues;
[0065] (3) If the conditions of the previous step are met, the point that meets the conditions is recorded as i, the g value of the point is selected as the threshold, and the entire g channel image is binarized using the determined threshold;
[0066] (4) Filter and fill holes in the binary image obtained in the previous step to form a mask image;
[0067] (5) Through the AND operation between the mask image and the original color image, it is converted to RGB format and finally the vegetation segmentation image is extracted.
[0068] Table 1
[0069] Performance evaluation of different methods
[0070]
[0071] Five methods combining Otsu's famous color factor were used as comparison methods for visual comparison, providing a qualitative evaluation of the algorithms. Furthermore, for quantitative evaluation, a quality factor, λ, was introduced, and its mean and standard deviation were calculated to evaluate the segmentation performance of all methods. These experimental results demonstrate that this method outperforms previous color factor segmentation methods and enables simple and efficient automatic segmentation.
[0072] Although the embodiments and drawings of the present invention are disclosed for illustrative purposes, those skilled in the art will understand that various substitutions, changes and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the scope of the present invention is not limited to the contents disclosed in the embodiments and drawings.
Claims
1. An automatic threshold color factor algorithm for green vegetation image segmentation, characterized by: The specific steps include: Step 1: First, the color image in the RGB space is normalized to obtain image data in the RGB space; Step 2, screening feature pixel rows, includes the following steps: (1) Grayscale the RGB image using the ExG color factor to obtain a grayscale image with enhanced vegetation features; (2) Then, the threshold of the grayscale image is obtained using the Otsu algorithm, and binarization is performed to initially segment the pixels into vegetation and background. (3) Count the number of green plant pixels in each row, and then roughly extract vegetation information based on the binary image; (4) Select the pixel row with the largest percentage of green plant pixels but less than 100%; (5) In this pixel row, from left to right, intercept the g channel data from the first pixel to the right edge of the green leaf in this row as the input of the subsequent automatic threshold segmentation process; Step 3: In the automatic threshold segmentation algorithm, the threshold is automatically determined by searching for the dividing point in the rising segment of the g channel value in the g channel data to complete the vegetation image segmentation in the entire image; The dividing point is based on the change pattern of the intercepted g channel data to perform automatic threshold segmentation of vegetation. At the junction of soil and vegetation, the g channel value undergoes a more obvious difference change. There is a dividing point i on the rising edge. By obtaining the point value Ti, the pixels in the vegetation area and the background area can be automatically distinguished.
2. The automatic threshold color factor algorithm for green vegetation image segmentation according to claim 1, characterized in that: The automatic threshold segmentation in step 3 includes the following steps: (1) Taking the starting point of the intercepted g channel data as the dividing point, the data set is divided into two groups, A and B; (2) Determine whether the g channel value at the dividing point is greater than all values in A and less than all values in B. If this condition is not met, the dividing point is updated to the next point and the judgment continues; (3) If the conditions of the previous step are met, the point that meets the conditions is recorded as i, the g channel value of the point is selected as the threshold, and the entire g channel image is binarized using the determined threshold; (4) Filter and fill holes in the binary image obtained in the previous step to form a mask image; (5) Through the AND operation between the mask image and the original color image, it is converted to RGB format and finally the vegetation segmentation image is extracted.
3. The automatic threshold color factor algorithm for green vegetation image segmentation according to claim 1, characterized in that: The criterion formula for automatically determining Ti is as follows: g1=max{g(t)|1<t<i}<T i <g2=min{g(u)|i<u<n} For n pixels in a pixel row, the array g(t) represents all pixel values before point i, and the array g(u) represents all pixel values after point i. g1 is the maximum value in g(t), and g2 is the minimum value in g(u). By determining the threshold, the vegetation area is automatically segmented: where the g value is greater than T i The pixels are vegetation area pixels, otherwise they are background area pixels.
4. The automatic threshold color factor algorithm for green vegetation image segmentation according to claim 1, characterized in that: In step 2, after obtaining the g channel data, a g channel information curve is drawn, and then the threshold is automatically determined by searching for the dividing point on the rising edge of the g channel value curve.