As discussed in previous sections, the vegetation segmentation process is an initial and vital step for different agriculture applications such as weed detection and crop row detection, especially, when working with RGB images. Due to the importance of this step, different solutions and approaches have been proposed to perform the vegetation segmentation as accurate and fast as possible. The main motivation for targeting higher accuracy vegetation segmentation process is to enhance the targeted agriculture application results. On the other hand, the fast performance is essential due to the importance of time for the different PA applications. The proposed vegetation segmentation technique targets the RGB images, as they are the main output from low-cost UAV imagery systems. The proposed methodology follows the procedure of threshold index-based approaches to achieve the simplicity of implementation and the low processing time.
2.1. HSV Color Space
Generally, the acquired images from a low-cost UAV imagery system are RGB images, where the color of any object in these images is represented with the combination values of R, G, and B channels. The main problem with such color representation is the impact of changes in illumination conditions on the objects’ colors. So, there was a need to use a different color space that describes the objects’ colors independent of the illumination effect.
For such needs, the HSV as a color space of the images could be used instead of the RGB. The main difference between these color spaces is mainly the color representation. The HSV color space represents the object’s color using three different parameters which are the hue (H), saturation (S), and value (V). The H represents the color of the object while the S and V values represent the illuminance state of the object’s color. Such description provides the ability to discriminate the color from the illuminance and therefore avoids the effect of illumination changes on the object color. Therefore, the proposed vegetation segmentation technique adopts the use of HSV color space.
Hence, as shown in
Figure 1, the first step of the proposed methodology is to convert the image’s color space from the RGB into HSV. Generally, the transformation process of the pixel’s color value from RGB into HSV can be performed using the following equations [
35]:
2.2. Image Hue Histogram
After converting the image’s color space into the HSV, the hue (H) image is used to detect the suitable threshold value to discriminate between vegetation and non-vegetation objects. As discussed, the hue image provides a separate description for the color content of the objects except from the illuminance state. So, Hue image as shown in
Figure 2, provides a suitable grayscale image that can be used to classify objects based on the color content. Therefore, the following step of the proposed vegetation segmentation technique is the threshold detection using the Hue image and its histogram.
Generally, a histogram of a hue image represents a relationship between each hue value and the number of pixels that have the same hue value, as shown in
Figure 3. The use of image histogram for threshold detection was introduced by different techniques [
27,
32,
36]. These techniques generally were implemented on vegetation segmentation process with the assumption that there are two dominant classes, the vegetation and the non-vegetation, where these classes’ colors are distributed following the normal or Gaussian distribution. Based on the probability theory, the threshold value that discriminates between these two classes represents the value that discriminates between the two Gaussian distributions. Such concept is followed by many different threshold index-based techniques as well as the proposed methodology.
As shown in
Figure 4, three different images for a canola crop field at three different growth stages are presented. These images show that the existence of the vegetation and non-vegetation classes is not equal through the different growth stages, as can be shown within the Hue histogram for each image. Moreover, the color distribution of one class, either vegetation or non-vegetation, might be significantly unnoticeable in the image. Thus, following the assumption that the color of these two classes will be distributed with two separate Gaussian distribution is not always valid.
Therefore, the proposed threshold detection technique assumes that there will be at least one main class, either vegetation or non-vegetation, that its color content is distributed following Gaussian distribution. Through such assumption, the proposed threshold detection process is based on detecting the limits of the main Gaussian distribution in the image histogram. The values of these limits or borders represent the threshold values that can discriminate the dominant class, either the vegetation class or the non-vegetation class, from the other class in the image. To detect that suitable threshold, two different graphs are generated from the hue histogram of the collected field image, to discriminate the dominant class hue color distribution. These graphs are a filtered hue histogram and a fitted Gaussian curve for the hue histogram, as shown in
Figure 3.
On step two, the proposed vegetation technique filters the hue image histogram to remove any hue value that has small presence in the image. Such filtration process is performed based on the number of pixels for each hue. So, if any hue value is represented with less than 0.001% of the number of image’s pixels, the proposed process classifies it as a small presence hue, and therefore remove this hue value from the hue histogram. The main motivation for such step is to work as an outlier remover procedure that remove low importance hue values.
Then, the following step is to fit the filtered hue histogram with a normal distribution, or Gaussian curve. The basic concept for curve fitting is to find the fitting parameters (
), of Gaussian Equation (13) using the hue histogram (
) data. For such purpose, different approaches can be used to estimate these parameters as Gauss-Newton algorithm, or its modification, the Levenberg-Marquardt algorithm [
37].
where
is the amplitude,
is the centroid,
is related to peak width, and
is the targeted number of peaks. As the main assumption is the existence of two main Gaussian distribution, that represents the two main classes, therefore the number of terms (
) is selected to be 2.
2.3. Threshold Detection Process
The third step of the proposed vegetation segmentation technique aims to detect the suitable threshold value. As explained, the proposed vegetation technique assumes that the threshold value exists beyond the limits or the boarders of the dominant class’s color distribution, as shown in
Figure 5. Therefore, the proposed technique introduces an alternative to detect different possible threshold values to produce the final suitable threshold for the image binarization process. These values aim to discriminate the dominant class’s colors from the remaining colors. So, the generated two graphs of hue histogram and fitted Gaussian curve are used to detect these values. The following parts explain these steps.
The threshold detection process starts with detecting the dominant hue value in the dominant class. This hue value can be detected as the mean of the dominant class Gaussian curve (
) or the highest represented hue value from the filtered hue histogram (
). Such value is important for classifying the dominant class as vegetation or non-vegetation, and for detecting the direction of searching for the threshold values, either to the right or the left of the mean value, as shown in
Figure 5. The (
) is used for the classification process of the dominant class using 60° as a threshold value to discriminate between vegetation and non-vegetation. Such threshold value is accepted to be used for the classification of the mean value of the dominant class. Such value was chosen as the green color hue value, which is the main color of vegetation objects, ranges from yellow color at 60° till cyan color at 180° [
38]. Such range can be used to classify the main Hue value in the dominant class, but won’t be suitable to classify each hue value. This is caused as the edge that filters between yellow and green is affected with different factors, therefore using a specific value to discriminate between yellow and green is not valid for all images. Therefore, the suggested range can be used to classify the main hue value, but can’t be used to classify all the values.
After classifying the dominant class, or color, in the hue image, the threshold searching direction can be detected. Also, through detecting the number of peaks, or the Gaussian curves in the fitted Gaussian graph, the system classifies the image case into four main types. These case types are:
Case (1): the image has one Gaussian peak and the dominant class is non-vegetation.
Case (2): the image has one Gaussian peak and the dominant class is vegetation.
Case (3): the image has more than one Gaussian peak and the dominant class is non-vegetation.
Case (4): the image has more than one Gaussian peak and the dominant class is vegetation.
Then, using the two hue graphs, different suitable threshold values are detected. These values propose different potentials to describe the boarders of the dominant class, where the threshold values are assumed to be the local minima within these boarders. First, the hue Gaussian fitted graph introduces two possible threshold values, which are (
) and (
). The first threshold, (
), represents a description for the boarders of the dominant class Gaussian curve as the sum of the (
) value and the suitable confident interval value, between (σ, 2σ, or 3σ), of the Gaussian curve, as shown in
Figure 6. It is important to note that the process neglects (
) if the confident interval value is equal or larger than distance
, which represents the difference between the end of the fitted Gaussian curve, from the other side of the threshold searching direction, and the mean Hue value
. Such assumption is followed as indication that the Hue histogram is fitted with Gaussian curve correctly.
Theoretically, the Gaussian curve is symmetric around its mean value. Therefore, in the hue histogram, the difference between the mean and the confident interval can’t be a negative value, as this would be an indication that the suggested Gaussian curve didn’t fit the hue histogram correctly. Thus, if the confident interval is larger than the threshold , the first threshold value is rejected.
The second threshold value derived from the hue Gaussian fitted graph is (). This value is only detected if there is more than one Gaussian curve in the hue Gaussian fitted graph, which works for cases (3) and (4). Generally, () represents the valley point between the dominant class Gaussian curve and the following Gaussian curve, based on the detected searching direction. Such point represents a potential description for the dominant class Gaussian curve boarders, or a local minima value.
The second graph used for threshold detection is the filtered hue histogram. This graph is used to detect three potential threshold values which are (
), (
), and (
). These threshold values are providing three different approaches for describing the local minima. The proposed three approaches aim to detect the local minima value that discriminate the dominant color, or class, in the agriculture field image from the remaining colors. First, (
). represents the first valley point which is smaller than the following valley in the filtered Hue histogram, as shown in
Figure 7. Such threshold value will be referred as the first lowest valley following the mean hue value. For more description,
is detected through finding the different valleys followed the main value in the hue histogram. Then, if the number of pixels in the first valley is lower than the number of pixels of the second valley, then the first valley is considered (
). If the described condition didn’t work, then the comparison goes for the following two valleys, till the system reaches the suitable valley for (
).
The second detected threshold value in the filtered hue histogram is
which represents the first valley point followed by two successive uprising, as shown in
Figure 8. Finally, the third detected threshold is (
). This threshold value is determined through detecting the first peak point smaller than the following peak, based on the number of pixels. After detecting this peak, the following and previous valleys are compared. Then, the smallest valley, also based on the number of pixels, is considered as the (
), as shown in
Figure 9. Finally, it is important to note that the existence of the five different threshold cases is not achieved in every image, as some of these thresholds cases cannot be existing in all images. Such note is mainly derived as some the described thresholds were not detected in some cases, as will be explained through the results discussion.