Next Article in Journal
Intelligent Extraction of Terracing Using the ASPP ArrU-Net Deep Learning Model for Soil and Water Conservation on the Loess Plateau
Previous Article in Journal
Risk Assessment of Maize Yield Losses in Gansu Province Based on Spatial Econometric Analysis
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Mid-Infrared Sheep Segmentation in Highland Pastures Using Multi-Level Region Fusion OTSU Algorithm

Beijing Engineering Research Center of Industrial Spectrum Imaging, School of Automation and Electrical Engineering, University of Science and Technology Beijing, Beijing 100083, China
*
Author to whom correspondence should be addressed.
Agriculture 2023, 13(7), 1281; https://doi.org/10.3390/agriculture13071281
Submission received: 3 May 2023 / Revised: 31 May 2023 / Accepted: 15 June 2023 / Published: 22 June 2023
(This article belongs to the Section Digital Agriculture)

Abstract

:
In highland pastures, grazing is a common method for managing sheep due to the abundance of grassland resources. However, it is easy for sheep to encounter situations such as stray, deviation and attacks from natural enemies; therefore, the remote monitoring of sheep in the highland pastures is an urgent problem to be solved. This paper proposes a mid-infrared sheep segmentation method based on the multi-level region fusion maximum between-class variance algorithm, i.e., OTSU algorithm, for sheep surveillance. First, a mean adjustment OTSU algorithm is designed to better distinguish the interference areas in the background. Second, the Butterworth high-pass filter is combined with the mean adjustment OTSU segmentation algorithm to remove the high-brightness interference areas in the background with slow gray intensity changes. Finally, after filtering out the large area background and small stray point, the two processed results above are fused with the AND logical operation to obtain a final segmentation result. Our algorithm is evaluated using three objective evaluation indicators: the root mean square error (RMSE), structural similarity index metric (SSIM), and peak signal to noise ratio (PSNR). The RMSE, SSIM, PSNR of highland wetland image are 0.43187, 0.99526, and 29.16353. The RMSE, SSIM, PSNR of sandy land image are 0.87472, 0.98388, and 23.87430. The RMSE, SSIM, PSNR of grassland image are 0.65307, 0.99437, and 30.33159. The results show that our algorithm can meet the requirements for the mid-infrared sheep segmentation in highland pastures.

1. Introduction

Highland pastures in Inner Mongolia are one of the most important animal husbandry production bases in China. However, due to the complex terrain and harsh climate in highland areas, coupled with the stray herders and inconvenient transportation, the traditional artificial supervision can no longer meet the demand for monitoring livestock. Precision livestock technology has shown great potential in addressing this issue, enabling the transformation of livestock management from artificial to automatic or semi-automatic regulation, which can significantly reduce labor costs and improve environmental and economic sustainability [1]. Existing technologies use a combination of low-cost time-delay cameras together with a machine learning method to monitor the position information of sheep with high accuracy and sensitivity; however, it requires that there is no background confused with the color of animals in the camera’s field of view, and the camera also cannot face to the sun [2]. Del Castillo et al. [3] designed a system that could automatically detect dangerous animals such as Iberian wolves and distinguish them from dogs and other animals in real time, with an average accuracy of 99.49%. In order to further promote the development of precision livestock technology, behavior recognition, weight estimation, and other research based on deep learning have been proposed. To reduce the interference caused by noise and occlusion, it is common to use detection and segmentation of sheep to accomplish these tasks. He et al. [4] successively used detection and semantic segmentation to obtain more effective sheep region data for sheep weight estimation. Xu et al. [5] achieved sheep behavior recognition by mask region-based convolutional neural network (R-CNN). Moreover, there are also some works that employed segmentation to accomplish the computer vision task of sheep [6,7]. In highland pastures, fog, snow, and other weather conditions will greatly affect light propagation; as a result, the remote monitoring problem is subject to many restrictions. Therefore, the use of frontier technology to achieve remote monitoring of livestock in highland pastures has become an urgent problem in the development of animal husbandry.
At present, infrared imaging technology has been widely used in military [8,9,10], biomedical [11,12], industrial [13,14,15,16], environmental protection [10,17,18], and other fields [19,20]. Compared with visible imaging, infrared imaging is less affected by light problems due to the spontaneity of infrared radiation. It does not rely on light sources and can measure the body temperature and surface temperature distribution of humans and animals, which gives it some advantages in remote monitoring of highland pastures. The commonly used near-infrared imaging has shortcomings and drawbacks in remote monitoring, such as being easily affected by environmental temperature, atmospheric humidity, or atmospheric transmittance [21]. The thermal radiant intensity stability of the mid-infrared spectrum is better than those of visible light and near-infrared spectrum, greatly improving the sensitivity and accuracy of remote monitoring. Mid-infrared sensor not only overcomes the shortcomings of relying on light source illumination in near-infrared imaging and lacking image details in far-infrared imaging but also preserves the sensitivity of near-infrared images to object surface features and far-infrared images to object temperature. The mid-infrared images can better reflect the temperature distribution of objects and have good thermal image characteristics, be capable of penetrating certain thicknesses of smoke, haze, and other meteorological conditions, with high atmospheric transmittance and good perspective effect in complex environments [22].
With the rapid development of computer vision, image segmentation has received great attention in practical applications [23]. Traditional segmentation methods include OTSU thresholding [24], region growing [25], watershed [26], etc. The new generation of image segmentation models has segmentation algorithms based on fully convolutional networks [27,28,29,30], convolutional encoder–decoder architecture [31,32], and DeepLab family [33]. In solving complex infrared image segmentation problems, many algorithms based on deep learning have also been developed, such as anti-noise robust-net (R-Net) [34], k-means clustering and variational (K-V model) [35], and adaptive algorithm based on fused simplified pulse coupled neural network (SPCNN) [36], etc. However, algorithms based on deep learning require a large amount of data, which will limit the performance of algorithms. The OTSU segmentation has been widely used due to its simplicity and effectiveness for years. Initially, only one-dimensional grayscale information is considered, which cannot achieve good results. Later, a two-dimensional OTSU is proposed, which considers the grayscale information and spatial correlation information of each pixel in the neighborhood [37]. Then, a fast OTSU [38] based on improved histograms is developed. To accelerate the computational speed further, researchers have proposed optimization algorithms such as particle swarm optimization [39,40], ant colony optimization [41,42], and the crow search algorithm [43] to optimize the OTSU algorithm.
This paper investigates the characteristics of highland pastures and mid-infrared images and designs a mid-infrared image segmentation method based on the multi-level region fusion OTSU algorithm to realize image segmentation in highland pastures. First, the classic OTSU algorithm is improved, i.e., the mean adjustment-OTSU (MA-OTSU) is designed. By using the grayscale mean, the grayscale weight of the target class is enhanced, so that the threshold can better distinguish between background and target. Second, a Butterworth high-pass filter-mean adjustment-OTSU (BHPF-MA-OTSU) is proposed. The threshold obtained by the MA-OTSU algorithm is associated with the cut-off frequency of the Butterworth high-pass filter, limiting the cut-off frequency to a small range. To ensure that the original image passes through the Butterworth high-pass filter, and then passes through the MA-OTSU, high-brightness areas in the image where the grayscale values change slowly are filtered out. Finally, after filtering out large area background and small area stray points in two segmented images, the images above are fused with the AND logical operation to obtain a complete segmentation result. The main contributions of this paper include (1) an MA-OTSU threshold segmentation algorithm is proposed that utilizes grayscale means to improve its thresholding method and increase the weight of areas with high grayscale values. (2) A BHPF-MA-OTSU threshold segmentation method is also developed, which effectively eliminates high gray values and slow-changing background areas. (3) An algorithm flow that integrates the MA-OTSU and BHPF-MA-OTSU is designed, playing a complementary role and improving the segmentation effect.
In the following sections, first, detailed introductions to algorithm flow and key techniques are presented. Second, some experiments and discussions are shown. Finally, a summary and future research works are presented.

2. Materials and Methods

2.1. Experimental Data Accumulation

The experimental site was the Xilingol Grassland, Inner Mongolia. Images were collected from multiple positions and angles. It was taken on a sunny summer day. The Hikvision’s DS-2CD5047EFWD camera with 4 million pixels and 1/1.8” progressive scan CMOS was used. The camera was produced by Hikvision in Hangzhou, China. Table 1 shows some parameters of the camera. The camera was mounted on the HY-HW17-01A pan-tilt-zoom (PTZ) platform, which controlled the camera rotation to take pictures from different angles and maintain stability. The whole of the equipment was mounted 10 m above the ground. The photographed objects were Sunit sheep, Ujimqin sheep, and Chahar sheep from Xilingol Grassland, Inner Mongolia. The mid-infrared images (in spectral bands 3.0–5.0 μm) of highland pastures were used in this paper. There were 2970 images in the dataset with an image size of 640 × 480. The images of wetland, sandy land, and grasslands were 915, 870, and 1185, respectively. Three typical examples in this dataset are shown in Figure 1. Three selected sample images in Figure 1 represent three typical scenarios. In mid-infrared images, the ground contains high-temperature substances (such as heat sources, flames, etc.) or substances with high heat capacity (such as water, wetlands, etc.) which can absorb and radiate more mid-infrared energy, thus presenting bright colors in the image. Figure 1a represents the highland wetland, with many small areas of high-brightness appearing in the image due to the water in the wetland. Figure 1b is the sandy land, where sand and gravel heated up after being exposed to the sun are reflected in the image as a large area with high brightness. Figure 1c shows the grassland, with no obvious interference areas in the image, and the biological characteristics of sheep are particularly prominent. Analyzing three typical images, it can be found that due to the imaging characteristics of mid-infrared images and highland pastures, images well preserve the thermal image features of organisms in highland pastures, presented in the form of grayscale values, and overcome the interference of meteorological conditions. However, due to the limitations of observation distance, these images also have small target areas, and most of the detailed features are seriously lost. The background is complex; under the interference of factors such as terrain characteristics and environment, the brightness of the target is generally not the highest in the image and can only be highlighted locally.
Figure 2 shows the grayscale histograms of Figure 1a–c. From the distribution of them, it can be found that the target pixel in the image has a large grayscale value, a small number, and a very low proportion. The reason for the poor performance of the classic OTSU algorithm is that the proportion of background is too large, resulting in a low segmentation threshold, retaining a large area of background, and having grayscale values that are the same or close to the target grayscale, making segmentation difficult. The calculation results of image entropy, mean, and standard deviation are also shown in Table 2. Among them, the entropy represents the information contained in the image; the mean value reflects the brightness of the image; the standard deviation indicates the dispersion of the image pixel value relative to the mean value. It can be seen from the image and numerical analysis that when the entropy value of information is larger, the image contains more interference information, which is not conducive to segmentation. When the mean value is small and the standard deviation is also small, the threshold boundary of the image background and target is clear. Taking the mean as a reference, the weight of grayscale values near the mean decreases, while the weight of grayscale values far from the mean increases, which will enhance the boundary between the background class and the target class, and stretch the differentiation between highlighted background areas and target.
In order to quantitatively evaluate the segmentation effect of the algorithm in this paper, we manually annotate the dataset and create standard segmented images corresponding to our dataset images one by one. Figure 3 gives out the corresponding segmentation results of Figure 1. In this section, we also select three evaluation indicators as quantitative references for segmentation effectiveness, i.e., the root mean square error (RMSE), structural similarity index metric (SSIM), and peak signal-to-noise ratio (PSNR).
RMSE calculates the pixel difference between a segmented image and a standard image. The smaller the RMSE is, the closer the segmented image is to standard image, and the better the segmentation effect will be.
R M S E = i = 1 M j = 1 N ( y i , j x i , j ) 2 M × N
where x and y represent the standard and segmented images, respectively; M and N are the image sizes.
SSIM is an indicator that measures the structural similarity of images, taking into account the effects of brightness, contrast, and structure. The value range of SSIM is between 0 and 1; and the closer the value is to 1, the more similar the segmented image is to the standard image, and the better the segmentation will be.
S S I M = ( 2 μ x μ y + c 1 ) ( σ x y + c 2 ) ( μ x 2 + μ y 2 + c 1 ) ( σ x 2 + σ y 2 + c 2 )
where x and y represent standard images and segmented images, respectively; μx and μy are the average grayscale values of image x and y; σx2 and σy2 are the variances of the corresponding images; σxy is covariance; c1 and c2 are constants.
PSNR is a measure of the signal-to-noise ratio of an image, which calculates the peak signal-to-noise ratio between a standard image and a segmented image. The larger the PSNR, the better the segmentation effect.
P S N R = 20 log 10 255 i = 1 M j = 1 N ( y i , j x i , j ) 2 M × N
where x and y represent standard and segmented images, respectively; M and N are the image sizes.

2.2. Algorithm Flow Design and Key Techniques

2.2.1. Proposed Computational Flow Chart

The image segmentation algorithm flow is shown in Figure 4. First, the image is input into the MA-OTSU to obtain the segmented image and threshold. After this step, the result still contains high grayscale background areas that are larger than the target areas; therefore, a large area of background filtering is performed to weaken the proportion of large background areas. Second, the threshold is associated with the cut-off frequency of the Butterworth high-pass filter, and the original image is filtered before being input into the MA-OTSU. It is found that there are a large number of high grayscale background stray points in segmented image, which are smaller than the area occupied by the target. Small area stray points are filtered to reduce the interference on subsequent processing. Compared with other filters, the passband response of the Butterworth filter is the smoothest. In the stopband, as the filter order becomes larger, the attenuation speed becomes faster, and the transition area near the cut-off frequency is smoother. Then we perform AND logical operation to fuse two images after background filtering to obtain the final segmented image. Although there are background interference areas that are difficult to completely remove in both processed images, the overlaps of these areas are small, and both images preserve the target areas intact. Therefore, the AND logical operation can further achieve the effect of background removal, while also preserving the target areas completely.

2.2.2. MA-OTSU Algorithm

The OTSU uses the principle of minimum average segmentation error to select segmentation thresholds. Variance is used to represent the difference between the grayscale mean of the foreground area, the grayscale mean of the background area, and the grayscale mean of the entire image. The larger the variance, the better the foreground and background segmentation effect of the image. Assuming the size of input infrared image F is M × N. The grayscale of the image at (i, j) are f(i, j), i, and j ∈{0, 1, 2, …, L − 1}. The symbol L represents the grayscale level of image F, nl is the number of pixels in the lth grayscale, and the probability p(l) of a certain pixel in image belonging to the lth grayscale is calculated using (4):
p ( l ) = n l M × N
If the grayscale value k is used as a threshold, the image is segmented into background C1 and target C2, where the range of grayscale values for C1 is [0, k], the grayscale range of C2 is [k + 1, L−1]. The probability of a pixel in image belonging to C1 is P1, and the probability of belonging to C2 is P2. The definitions of P1(k) and P2(k) are shown in (5) and (6), where k = 0, 1, …, 255.
P 1 k = l = 0 k p ( l )
P 2 k = l = k + 1 L 1 p ( l ) = 1 P 1 k
The grayscale mean of C1 is M1, the grayscale mean of C2 is M2, and the global grayscale mean of image is MG. The corresponding definitions of M1(k), M2(k), and MG(k) are shown in formulas (7), (8), and (9), respectively.
M 1 k = 1 P 1 k l = 0 k l × p ( l )
M 2 k = 1 P 2 k l = k + 1 L 1 l × p ( l )
M G k = l = 0 L 1 l × p ( l ) = P 1 k × M 1 k + P 2 k × M 2 k
According to the concept of variance, the expression of σ2 is defined as:
σ 2 = P 1 P 2 ( M 1 M 2 ) 2
In order to achieve the optimal segmentation effect, the class separation distances of C1 and C2 are maximized, and the optimal threshold solution k* is solved:
σ 2 k * = max 0 k L 1 σ 2 ( k )
Due to the complex factors such as terrain, environment, and shooting conditions, the use of classic OTSU for mid-infrared image segmentation in highland pastures can lead to problems such as large area of reflection in the background, insufficient contrast, or a small proportion of the target; the incomplete segmentation and large area of background being preserved can also be observed easily. In response to these above situations, we focus on the classic OTSU algorithm and improve this algorithm to obtain the grayscale mean to achieve better segmentation. We interpret a weight l in the formula for obtaining the grayscale mean in the classic OTSU algorithm. Due to the high proportion of background areas in the entire image, the high proportion of small grayscale areas result in a small grayscale mean which is close to the background category. Therefore, in order to improve the weight of areas with large grayscale values, |lMG| is used as a replacement to increase the weight of areas far from the grayscale mean, achieving a threshold that approaches the areas of the higher grayscale values, closer to the target grayscale values. The corresponding formulas are as follows. Here, the grayscale mean of C1 is M1′, the grayscale mean of C2 is M2′, and the global grayscale mean of image is MG’. The corresponding definitions of M1(k)’, M2(k)’, and MG(k)’ are shown in Formulas (12), (13), and (14), respectively.
M 1 k = 1 P 1 k l = 0 k l M G × p ( l )
M 2 k = 1 P 2 k l = k + 1 L 1 l M G × p ( l )
M G k = l = 0 L 1 l M G × p ( l )

2.2.3. BHPF-MA-OTSU Threshold Segmentation Algorithm

The Butterworth filter is commonly used in digital signal processing. It is an infinite impulse response filter. The characteristics of Butterworth filter are that it has a relatively flat amplitude frequency response in the passband, and the transition region near the cut-off frequency is relatively smooth. Therefore, the Butterworth filter is widely used in various signal processing fields, such as audio processing, image processing, biological signal processing, etc. The design of the Butterworth filter is mainly divided into two steps: determining the filter order and designing the cut-off frequency. The order of filter determines the steepness of filter and the accuracy of cut-off frequency. Typically, an integer power of 2 is chosen as the order of filter. The cut-off frequency refers to the frequency at which the frequency response of filter drops to half of its maximum value. There are many design methods for the Butterworth filter, among which the Pole-Zero design method and the frequency domain design technique are the most commonly used approach. The Pole-Zero design method is based on the transfer function of the Butterworth filter, and the filter design is realized by selecting appropriate poles and zeros. The frequency-domain design principle is to design the Butterworth filter in the frequency domain, and the most common method is based on bilinear transformation. Clearly, the advantages of the Butterworth filter are simple design, convenient implementation, and fast calculation speed; however, it also has some drawbacks, such as ripple in amplitude frequency response, phase distortion, and large group delay of filter. These problems may have some impacts on the filtering effect in some specific application scenarios. In this paper, we select a second-order Butterworth high-pass filter H(u, v), for filtering computation, where n = 1. The formula is as follows.
H u , v = 1 1 + ( D 0 D ( u , v ) ) 2 n
where n is the order of the filter, D0 is the cut-off frequency, and D(u, v) represents the distance from the center point in the frequency domain to the frequency domain plane.
The selection of cut-off frequency is related to the threshold k obtained by the MA-OTSU threshold segmentation algorithm. We use k to limit D0 to a smaller range. Finally, the computational method of the improved Butterworth high-pass filter H’(u, v) is shown below.
D 0 = k / 2
H u , v = 1 1 + ( D 0 D ( u , v ) ) 2 n
Regarding Formulas (16) and (17), as the range of threshold k is [0, 255], the range of D0 is limited to [0, 11.2]. Only the small cut-off frequency regions in the spectrum are filtered out. After filtering, a MA-OTSU is used. The results show that the segmented image can not only eliminate background areas with high gray values and slow change, but also preserve the target areas completely. Compared with the results obtained by MA-OTSU, the algorithm proposed in this section can better compensate for the segmentation effect on background areas with large and slow changing grayscale values in large areas with similar or identical target grayscale values.

2.2.4. Image Fusion after Initial Segmentations

In this paper, the background filtering operation of segmented image separates the connected areas from the binary image, and calculates some statistical information of each connected area, such as area, center point coordinates, external rectangles, etc. The mathematical principle of background filtering is based on the connected component analysis algorithm in image processing. The algorithm first traverses each pixel in the image and compares it with its neighboring pixels. If they have the same grayscale value, they are combined into the same equivalence class set. Finally, the algorithm separates all equivalence class sets and calculates some statistical information of each set. The segmented image in this paper is a binary image, and the area of each connected region is calculated using this algorithm. Based on the size of regions, it is determined whether the region needs to be filtered out. The selection of these thresholds is related to the overlap and connection of multiple targets in image, as well as the monitoring distance. The overlap and connection of multiple targets are severe, and the threshold selection for background filtering in large areas should be large. The farther the monitoring distance, the smaller the threshold selection for filtering out stray points in small areas should be.
f x , y = 255 0 T 2 < S < T 1 S T 2   o r   S T 1
where f(x, y) is the grayscale value of pixel at (x, y) in image, S is the area of the connected area in image, T1 is the threshold for filtering out large background areas, and T2 is the threshold for filtering out small stray points.
The AND operation, also known as “logical AND”, is used in our algorithm. Its operation rule is that the result is true only when both operands are true (non-zero); otherwise, the result is false (zero). In this paper, the rules of AND operation are used to stack two processed binary images. When the value of pixels at the same position of two images is 255, the result is 255; otherwise, it is 0. The purpose of performing AND operation for images is to further reduce the residual background area after background filtering operations.
f x , y = 255 0     f 1 x , y = 255 & f 2 x , y = 255 = 1 e l s e
where f(x, y) is the grayscale value of pixels at (x, y) of the fused image, f1(x, y) and f2(x, y) are the grayscale values of pixels at (x, y) corresponding to two images to be fused.

3. Results and Discussions

A series of experiments are performed to test the validity of proposed algorithm. The Python 3.7.15 programming is used for simulation experiments on our PC Intel(R) Core(TM) i9-12900H CPU @ 2.50 GHz, 16 GB RAM, NVIDIA GeForce RTX 3060).

3.1. Evaluation of MA-OTSU Algorithm

This section conducts evaluation experiments on the MA-OTSU segmentation algorithm. In this experiment, we choose five algorithms to segment three typical sample images in Figure 1 for performance evaluation. The corresponding algorithms include the classic OTSU algorithm, improved OTSU in reference [44], multi-threshold OTSU, OTSU based on genetic algorithm, and OTSU based on clustering. These segmentation results are compared with our MA-OTSU proposed in this paper as shown in Figure 5. In addition, in order to verify the impact of improved algorithm on the threshold in this paper, the thresholds obtained by each algorithm are also listed in Table 3.
From results in Figure 5, due to the large proportion of background, the threshold found by the classic OTSU algorithm is lower and closer to the background class, resulting in poor segmentation results. The improved OTSU in [44] uses function f(i) = i2 (i is the grayscale value of image) to increase the weight of high grayscale values in image, making the threshold closer to target class; however, the high-brightness background areas are not clearly segmented from target. When using multi-threshold OTSU (three classes), due to the small difference in gray values between interference of bright background and target, it is difficult to distinguish them with the algorithm. The difference between threshold boundaries of three classes is very small and its segmentation effect is poor. The OTSU based on the genetic algorithm uses the optimization method to find the threshold and determines the optimal threshold according to the maximum value of fitness function. Its effect depends on parameter adjustment. The OTSU based on clustering performs well on Figure 5o but not well on (m) and (n). The reason is Figure 5c has the highest discrimination between the background and target, and there are fewer interferences in background. If a large area of bright interference areas appears in images, it is difficult to achieve good results. From these results above, due to the characteristics of mid-infrared images in highland pastures, the classic OTSU, multi-threshold OTSU, and OTSU based on genetic algorithm have no significant difference in segmentation effect. The OTSU based on clustering only performs best when the interference area in the background is small, lacking universality. By using our MA-OTSU, the weight of gray values near the mean is reduced, and the discrimination between high-brightness background area and target is increased.
From the data in Table 2, it can be seen that the mid-infrared images acquired in highland pastures are influenced by various factors such as terrain, lighting, and shooting angle, and the mean of images change with the overall brightness. Due to the fact that the proportion of background regions in images is much larger than target regions, the mean of the images must be closer to the high-brightness background regions compared to target regions. Therefore, our proposed MA-OTSU method centers around the mean, and the larger the difference between mean and grayscale value of pixels, the larger the weight they occupy. The target regions with high-brightness have large weight and grayscale values. Low-brightness background regions have large weight but small grayscale values, while high-brightness background regions have large grayscale values but small weight. Therefore, the MA-OTSU method can effectively distinguish background and target in high-brightness regions, and optimize the segmentation effect. From results in Table 3, it can be seen that the segmentation thresholds obtained by using the classic OTSU algorithm to process three images are 109, 138, and 136, respectively. The multi-threshold OTSU and OTSU based on clustering are not numerically superior to the classic OTSU. The OTSU based on genetic algorithm only performs well on Figure 5c. The improved OTSU proposed in reference [44] achieved significant improvements in threshold selection, with thresholds of 156, 165, and 163, respectively, which to some extent reduced the area of background residue. The segmentation thresholds obtained by the MA-OTSU proposed in this paper for three images are 167, 199, and 174, respectively. The segmentation effect is further improved, minimizing the area of background residue while fully preserving the target.

3.2. Evaluation of BHPF-MA-OTSU Threshold Segmentation Algorithm

This section conducts evaluation experiments on BHPF-MA-OTSU threshold segmentation algorithm. The images in Figure 1 are selected as the test images. Based on the characteristics of these data, it is necessary to filter out low-frequency interference areas with high grayscale values in the background as much as possible while preserving the target areas. Therefore, by associating the threshold with the cut-off frequency, according to formula (16), it can be seen that due to the range of threshold values being [0, 255], the range of cut-off frequency values is limited to [0, 11.2]. Combined with the high grayscale values of target in the dataset, the segmentation threshold is generally greater than 100; therefore, the range of cut-off frequency values can be further determined at [7, 11.2]. Finally, in the comparative experiment, the cut-off frequencies are set to 5, 20, and 50. In order to verify the effectiveness of formula (16) that associates the threshold with the cut-off frequency in this paper, the second order Butterworth filter with different cut-off frequencies is designed to verify the rationality of correlating threshold and cut-off frequency. The segmentation effect is shown in Figure 6.
According to the comparative experimental results in Figure 6, as the cut-off frequency of the Butterworth high-pass filter increases, the low-frequency signals in the image are filtered more thoroughly. From Figure 6, when the cut-off frequency is 5, the complete target areas can be retained. Compared with the improved method in this paper, when the cut-off frequency is 5, the background around target is removed more thoroughly, but the removal effect of continuous large background areas is weaker. When the cut-off frequencies are 20 and 50, some target areas can be filtered out, which will seriously affect the effectiveness of subsequent algorithm processing. Moreover, the proposed algorithm controls the cut-off frequency within a specified range, achieving the best results for three types of typical images. Although there are still some stray points, it is a supplement to the problem of MA-OTSU mentioned in the previous section, effectively supplements incomplete segmentation of large areas with high gray values in wetland and sandy land, and thry can filter out large areas with high gray values and slow intensity changes to a certain extent.

3.3. Evaluation of Multi-Level Region Fusion OTSU Algorithm

The images processed by our MA-OTSU shows that, although the segmentation effect of the local areas of target is good, there are still large areas of background that have not been completely segmented. After processing by the BHPF-MA-OTSU, it can effectively reduce large areas of background areas with high gray values and slow intensity changes, but with small stray points. In the process of background filtering, statistical analysis is conducted using the area information extracted from a large number of images in our dataset. The threshold T1 for large area background filtering is set to [700, 1500], and the threshold T2 for small area stray point filtering is set to [50, 200]. Here, we select thresholds based on the overlapping and connecting multiple targets in different types of images, as well as monitoring distance. The overlap of multiple targets and the targets connection area in highland wetlands images is small, so the threshold for filtering large area of background is 700, and the threshold for filtering small stray points is 200. The image of highland sandy land has lots of overlapping targets, a large connection area, and a relatively close monitoring distance compared to the highland grassland. Therefore, the threshold for filtering large area of background is 1500, and the threshold for filtering small stray points is 200. The highland grassland type image has multiple overlapping targets, large connected areas, and relatively far monitoring distances. Therefore, the threshold for filtering large area of background is 1500, and the threshold for filtering small stray points is 50. The performances of image fusion are shown in Figure 7.
This section conducts the evaluation experiments on the multi-level region fusion OTSU algorithm. The fuzzy C-means (FCM) clustering segmentation algorithm, fuzzy thresholding (FTH) segmentation algorithm, K-means segmentation algorithm, and Wang’s segmentation algorithm in reference [45] are selected to segment three typical sample images in Figure 1. The segmentation results are compared with our algorithm. Figure 8 shows the original image and the final segmentation results. In order to make the comparative experiments meaningful, the results in Figure 8 are obtained based on the segmentations of each algorithm using filtering operations with the same parameters as the algorithm used in this paper. In Figure 8g–i,m–o are correspond to FCM method (three classes) and K-means algorithm (three classes). The class with the highest grayscale value is assigned a value of 255; and the other two classes are assigned a value of 0. This results in a good segmentation performance for (g) and (m), with relatively small background residual area while retaining the complete target areas. However, when segmenting (h) and (n), there is a situation where the target areas are missing. When segmenting (i) and (o), the background residual area is large and the segmentation results are incomplete. The FTH algorithm corresponding to (j–l) cannot perform well in all three datasets. The segmentation algorithm proposed by Wang in reference [45], corresponding to (p–r), relies on parameter adjustment and only achieves good segmentation results in (q). The (p) and (r) images cannot distinguish between background and target.
In order to verify the accuracy of segmentation algorithm in this paper, the objective evaluation indicators are calculated based on the segmentation results above. The values are shown in the Table 4. In Table 4, compared with other threshold segmentation algorithms, the algorithm proposed in this paper has significant advantages in image evaluation metrics among three typical images, with the smallest RMSE, the highest SSIM, and the highest PSNR. The optimal values for each group of indicators are labeled in bold font. This indicates that the segmented image obtained by our algorithm is closest to standard image, with complete background removal, best preservation of target areas, and the highest similarity. Therefore, it can be deduced the multi-level region fusion OTSU algorithm performs well in segmenting sheep targets in mid-infrared images under the background of highland pastures. It not only preserves the target completely, but also overcomes environmental interference factors, thoroughly segmenting the target and background. In order to evaluate algorithms processing time and computational complexity, we collect the processing times of different algorithms and use Figure 8a as an example to calculate the average of 10 processing times. The results are shown in Table 5. It can be seen that Wang’s method achieves the shortest processing time, and the FCM method achieves the longest processing time. The processing time of MA-OTSU is 0.50574 s, the processing time of BHPF-MA-OTSU is 1.20753 s, and the multi-level region fusion OTSU algorithm has a processing time of 2.68167 s. The processing time of MA-OTSU or BHPF-MA-OTSU is relatively short, but after background filtering and the AND operation, the processing time of our algorithm is greatly increased. Overall, the algorithm proposed in this paper sacrifices a certain processing speed and computational complexity, greatly improves the segmentation effect.

3.4. Discussions

Highland pastures in Inner Mongolia of China is an important livestock production base. Due to a complex geographical environment and harsh climate, the growth and health status of livestock are greatly affected. With the development of information technology, people’s requirements for husbandry production are becoming higher and higher in China, requiring more precise and efficient management methods. The traditional livestock management method mainly relies on artificial inspection and observation, but this method has problems such as high labor cost, low efficiency, and limited monitoring range. Therefore, the application of remote monitoring technology has become an effective method. The difficulty of remote monitoring research on highland pastures mainly lies in the complexity of the highland environment and the behavioral characteristics of livestock. The climate change in highland environment is irregular and the terrain is complex, making traditional monitoring equipment difficult to adapt to this environment. The behavioral characteristics of livestock also increase the difficulty of monitoring, such as their wide range of activities. The remote monitoring technique will provide a more accurate and efficient way for livestock management in highland pastures, promoting the sustainable development of husbandry. Therefore, this paper proposes a mid-infrared sheep segmentation method based on the multi-level region fusion OTSU algorithm to provide theoretical support for remote monitoring of livestock (taking sheep as an example) in highland pastures.
Most of the algorithms for sheep segmentation are for livestock farming. The study objects in livestock farming usually belong to the same category, so the instance segmentation has to be used more widely. However, the performance of instance segmentation is not ideal when there are a large number of highly overlapping instances and noisy backgrounds. Most of the current instance segmentation work is based on a two-stage pipeline of mask R-CNN [46]. Mask R-CNN is implemented by adding full convolution segmentation branches on faster R-CNN [47], which first extracts multi-scale features by backbone and feature pyramid network (FPN) [48], and then it obtains region of interest (ROI) features for the first stage to classify the target and position regression, and finally it performs the second stage of full convolution segmentation to obtain a mask. Researchers proposed a two-stage instance segmentation in reference [49], called SheepInst, based on Refine-Mask, to achieve high-performance detection and segmentation of sheep. The extensive experiments proved SheepInst outperformed the state-of-the-art models in terms of both accuracy and generalization, and the network can focus on the correct information and suppress noise, which is more suitable for the results in the sheep farm industry. In addition to methods based on deep learning, there are also many fusions and improvements to the classical segmentation algorithms. Researchers perform the segmentation process of Mongolian sheep with the combination of multi-scale watershed, Graph Cuts, and Fuzzy C-mean clustering algorithms in reference [50]. These animals are predominantly single color, in which there is difficulty in differentiating the background of the image from the animal contained in it, obtaining the best result for F-measure of 0.96. Researchers make use of the simple linear iterative clustering (SLIC) technique and the FCM technique in order to segment the animal from images and extract measurements of the animal that can help in predicting the weight of the animal in reference [51]. The above methods achieve good segmentation effect, but most of them use visible light datasets, and the monitoring distance is close and the characteristics of the sheep are intact. Although there is a situation of overlapping targets, but there are fewer other interference factors in the background.
In order to cope with the complex weather and terrain characteristics of highland pastures, we use mid-infrared imaging technology instead of visible or near-infrared imaging. The mid-infrared spectrum wavelength range is the area with the strongest thermal radiation on the object surface, and its thermal radiant intensity stability is better than the visible and near-infrared spectrum, which greatly improves the sensitivity and accuracy of remote monitoring. Mid-infrared imaging technology not only overcomes the shortcomings of near-infrared imaging relying on light source illumination and lack of image detail features in far-infrared imaging, but also preserves the sensitivity characteristics of near-infrared band images to object surface features and far-infrared band images to object temperature. However, in mid-infrared images, water in wetlands and sand exposed to sunlight can absorb and radiate more mid-infrared radiation energy, resulting in bright colors in the image. This is the main difficulty affecting mid-infrared image segmentation. Therefore, this paper designs a multi-level region fusion OTSU algorithm, which effectively filter out large areas, high grayscale background interferences. In future, more effective filtering methods can be attempted to achieve better filtering effects for low-frequency and high grayscale interference areas that are difficult to remove. In addition, the algorithm flow design in this paper for large area background filtering and small area stray points filtering can utilize more data analysis, prior knowledge to change the selection of the filtered threshold, which will further enhance the adaptive ability of our algorithm.
This paper considers three common terrains in highland pastures, including highland wetland, sandy land, and grassland. In order to further verify the scalability of algorithm, a new scene is selected as shown in Figure 9a. This scene is an ordinary village with interference factors such as people and vehicles. The segmentation results of our method are shown in Figure 9f. Compared with the algorithm mentioned in Section 3.4, the segmentation results are shown in Figure 9b–e. The fuzzy thresholding segmentation has the worst effect; and the other three algorithms are unable to effectively remove high grayscale interferences in the image. Although background filtering is performed, there are still many areas that are difficult to remove completely, and the target is submerged in interference areas. Through comparison, the segmentation effect of our algorithm is the best. Comparing the occlusion of sheep by the scenery in Figure 10, the segmentation effect and threshold of fuzzy thresholding and K-means are consistent. The FCM clustering segmentation can get a portion of sheep, while other three algorithms cannot achieve effective results. In comparison, the segmentation effect of our algorithm is still the best, but for some targets in the red and blue boxes in Figure 10a, the background also causes incorrect segmentation. The reasons are twofold: first, the sheep with small pixel area become smaller under the shelter of trees, and the area difference between them and small stray points with high grayscale values in background is smaller, making it difficult to select an appropriate area threshold for filtering. Second, because of changes in the angle and intensity of sunlight, the overall brightness of two images is also different. In Figure 10, there are more bright and large grayscale values areas on road. The sheep are located in these bright areas and have lower discrimination from background. Incorrect segmentation and missing targets are caused by the segmentation process.
The method proposed in this paper at least has three advantages. First, the algorithm considers multiple common backgrounds in highland pastures, which makes it more suitable for practical applications of remote monitoring in highland pastures. Second, adaptive selection is achieved for the threshold setting of segmentation algorithm and the cut-off frequency selection of the Butterworth high-pass filter. Third, the algorithm has good scalability. The algorithm proposed in this paper is designed according to the characteristics of mid-infrared images, and can be applied to mid-infrared image segmentation in other scenarios only with simple adjustments. Clearly, there are still some shortcomings in our proposed method, such as the presence of multiple overlapping and connected targets in the image resulting in area fluctuations in target regions. Therefore, in the background filtering operation, it is necessary to select an appropriate threshold. This can be used in future work to associate the monitored distance with the size of target pixel, and to further improve the adaptive ability of algorithm by associating the threshold with the monitored distance.

4. Conclusions

This paper designs a mid-infrared sheep segmentation method based on the multi-level region fusion OTSU algorithm, which has good segmentation performance for the mid-infrared images in highland pastures. The MA-OTSU method is designed to reduce the weight of grayscale values near the mean, increase the differentiation between high brightness background regions and targets, optimize the selection of thresholds, and significantly improve the segmentation effect. This paper also utilizes the fusion of thr Butterworth high-pass filter and MA-OTSU algorithm to reduce the background areas with high gray values but slow changes in large area. Finally, AND logic operation is performed on the image after background filtering. The final segmented image is obtained by fusing the two images after background filtering. The algorithm proposed in this paper combines and improves the two classical image processing technologies, Butterworth filter and OTSU algorithm, to improve the accuracy and efficiency of mid-infrared image segmentation. First, the algorithm in this paper is based on complete mathematical rules and has interpretability. Second, the algorithm in this paper has a low data requirement and does not require a large dataset for training to achieve better performance. Through experimental comparison and analysis, the effectiveness of this algorithm has been verified through visual effects, background removal degree, and quantitative evaluation indicators. In future, other techniques, such as distance model for mid-infrared imaging will be studied in our computational framework.

Author Contributions

Conceptualization, M.W., M.L., H.L. and Q.L.; Data curation, H.L.; Formal analysis, M.W., M.L., H.L. and Q.L.; Funding acquisition, H.L.; Investigation, M.W., H.L. and Q.L.; Methodology, M.W., M.L., H.L. and Q.L.; Project administration, H.L.; Resources, H.L.; Software, M.W. and M.L.; Supervision, H.L. and Q.L.; Validation, M.W., M.L. and H.L.; Visualization, M.W.; Writing—original draft, M.W.; Writing—review and editing, M.W. and H.L. All authors have read and agreed to the published version of the manuscript.

Funding

This work was funded by the National Natural Science Foundation of China under Grant 61975011, the Fund of Science and Technology on Near-Surface Detection Laboratory under Grant 6142414221403, the Fund of State Key Laboratory of Intense Pulsed Radiation Simulation and Effect under Grant SKLIPR2024, the Natural Science Foundation of Guangdong Province under Grant 2023A1515010275, and the Fundamental Research Fund for the China Central Universities of USTB under Grant FRF-BD-19-002A.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author Haoting Liu.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Tzanidakis, C.; Tzamaloukas, O.; Simitzis, P.; Panagakis, P. Precision livestock farming applications (PLF) for grazing animals. Agriculture 2023, 13, 288. [Google Scholar] [CrossRef]
  2. Bonneau, M.; Vayssade, J.A.; Troupe, W.; Arquet, R. Outdoor animal tracking combining neural network and time-lapse cameras. Comput. Electron. Agric. 2020, 168, 105150. [Google Scholar] [CrossRef]
  3. Riego del Castillo, V.; Sánchez-González, L.; Campazas-Vega, A.; Strisciuglio, N. Vision-based module for herding with a sheepdog robot. Sensors 2022, 22, 5321. [Google Scholar] [CrossRef] [PubMed]
  4. He, C.; Qiao, Y.; Mao, R.; Li, M.; Wang, M. Enhanced LiteHRNet based sheep weight estimation using RGB-D images. Comput. Electron. Agric. 2023, 206, 107667. [Google Scholar] [CrossRef]
  5. Xu, J.; Wu, Q.; Zhang, J.; Tait, A. Automatic sheep behaviour analysis using mask r-cnn. In Proceedings of the 2021 Digital Image Computing: Techniques and Applications, Gold Coast, Australia, 29 November–1 December 2021; pp. 1–6. [Google Scholar]
  6. Sant’Ana, D.A.; Pache, M.C.B.; Martins, J.; Astolfi, G.; Soares, W.P.; de Melo, S.L.N.; da Silva Heimbach, N.; de Moraes Weber, V.A.; Mateus, R.G.; Pistori, H. Computer vision system for superpixel classification and segmentation of sheep. Ecol. Inform. 2022, 68, 101551. [Google Scholar] [CrossRef]
  7. Sant’Ana, D.A.; Pache, M.C.B.; Martins, J.; Soares, W.P.; de Melo, S.L.N.; Garcia, V.; de Moraes Weber, V.A.; da Silva Heimbach, N.; Mateus, R.G.; Pistori, H. Weighing live sheep using computer vision techniques and regression machine learning. Mach. Learn. Appl. 2021, 5, 100076. [Google Scholar] [CrossRef]
  8. Gade, R.; Moeslund, T.B. Thermal cameras and applications: A survey. Mach. Vision. Appl. 2014, 25, 245–262. [Google Scholar] [CrossRef] [Green Version]
  9. Štumper, M.; Kraus, J.; Capousek, L. Thermal imaging in aviation. MAD-Mag. Aviat. Dev. 2015, 3, 13–16. [Google Scholar] [CrossRef] [Green Version]
  10. Bagavathiappan, S.; Lahiri, B.B.; Saravanan, T.; Jayakumar, T. Infrared thermography for condition monitoring—A review. Infrared Phys. Technol. 2013, 60, 35–55. [Google Scholar] [CrossRef]
  11. Lahiri, B.B.; Bagavathiappan, S.; Jayakumar, T.; Philip, J. Medical applications of infrared thermography: A review. Infrared Phys. Technol. 2012, 55, 221–235. [Google Scholar] [CrossRef] [PubMed]
  12. Shada, A.L.; Dengel, L.T.; Petroni, G.R.; Smolkin, M.E.; Acton, S.; Slingluff, C.L., Jr. Infrared thermography of cutaneous melanoma metastases. J. Surg. Res. 2013, 182, e9–e14. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  13. Ashish, V. Review on thermal image processing techniques for machine condition monitoring. Int. J. Wirel. Commun. Netw. Technol. 2014, 3, 49–53. [Google Scholar]
  14. Dutta, T.; Sil, J.; Chottopadhyay, P. Condition monitoring of electrical equipment using thermal image processing. In Proceedings of the 2016 IEEE First International Vonference on Control, Measurement and Instrumentation, Kolkata, India, 8–10 January 2016; pp. 311–315. [Google Scholar]
  15. Tomita, K.; Chew, M.Y.L. A review of infrared thermography for delamination detection on infrastructures and buildings. Sensors 2022, 22, 423. [Google Scholar] [CrossRef] [PubMed]
  16. Balakrishnan, G.K.; Yaw, C.T.; Koh, S.P.; Abedin, T.; Raj, A.A.; Tiong, S.K.; Chen, P.C. A review of infrared thermography for condition-based monitoring in electrical energy: Applications and recommendations. Energies 2022, 15, 6000. [Google Scholar] [CrossRef]
  17. Kluge, B.; Peters, A.; Krueger, J.; Wessolek, G. Detection of soil microbial activity by infrared thermography (IRT). Soil. Biol. Biochem. 2013, 57, 383–389. [Google Scholar] [CrossRef]
  18. Sarawade, A.A.; Charniya, N.N. Infrared thermography and its applications: A review. In Proceedings of the 2018 3rd International Conference on Communication and Electronics Systems, Coimbatore, India, 15–16 October 2018; pp. 280–285. [Google Scholar]
  19. Mohd Ali, M.; Hashim, N.; Abd Aziz, S.; Lasekan, O. Characterisation of pineapple cultivars under different storage conditions using infrared thermal imaging coupled with machine learning algorithms. Agriculture 2022, 12, 1013. [Google Scholar] [CrossRef]
  20. Wang, Z.; Wang, S.; Wang, C.; Zhang, Y.; Zong, Z.; Wang, H.; Su, L.; Du, Y. A non-contact cow estrus monitoring method based on the thermal infrared images of cows. Agriculture 2023, 13, 385. [Google Scholar] [CrossRef]
  21. Branchitta, F.; Diani, M.; Corsini, G.; Porta, A. Dynamic-range compression and contrast enhancement in infrared imaging systems. Opt. Eng. 2008, 47, 076401. [Google Scholar] [CrossRef]
  22. Usamentiaga, R.; Venegas, P.; Guerediaga, J.; Vega, L.; Molleda, J.; Bulnes, F.G. Infrared thermography for temperature measurement and non-destructive testing. Sensors 2014, 14, 12305–12348. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  23. Minaee, S.; Boykov, Y.; Porikli, F.; Plaza, A.; Kehtarnavaz, N.; Terzopoulos, D. Image segmentation using deep learning: A survey. IEEE Trans. Pattern Anal. Mach. Intell. 2021, 44, 3523–3542. [Google Scholar] [CrossRef] [PubMed]
  24. Ostu, N. A threshold selection method from gray-histogram. IEEE Trans. Syst. Man Cybern. 1979, 9, 62–66. [Google Scholar]
  25. Nock, R.; Nielsen, F. Statistical region merging. IEEE Trans. Pattern Anal. Mach. Intell. 2004, 26, 1452–1458. [Google Scholar] [CrossRef]
  26. Najman, L.; Schmitt, M. Watershed of a continuous function. Signal. Process. 1994, 38, 99–112. [Google Scholar] [CrossRef] [Green Version]
  27. Wang, G.; Li, W.; Ourselin, S.; Vercauteren, T. Automatic brain tumor segmentation using cascaded anisotropic convolutional neural networks. In Proceedings of the 3rd International Workshop on Brainlesion: Glioma, Multiple Sclerosis, Stroke and Traumatic Brain Injuries, Quebec City, QC, Canada, 14 September 2017; pp. 178–190. [Google Scholar]
  28. Li, Y.; Qi, H.; Dai, J.; Ji, X.; Wei, Y. Fully convolutional instance-aware semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 2359–2367. [Google Scholar]
  29. Yuan, Y.; Chao, M.; Lo, Y.C. Automatic skin lesion segmentation using deep fully convolutional networks with jaccard distance. IEEE Trans. Med. Imaging 2017, 36, 1876–1886. [Google Scholar] [CrossRef] [PubMed]
  30. Liu, N.; Li, H.; Zhang, M.; Liu, J.; Sun, Z.; Tan, T. Accurate iris segmentation in non-cooperative environments using fully convolutional networks. In Proceedings of the 2016 International Conference on Biometrics, Halmstad, Sweden, 13–16 June 2016; pp. 1–8. [Google Scholar]
  31. Ronneberger, O.; Fischer, P.; Brox, T. U-net: Convolutional networks for biomedical image segmentation. In Proceedings of the 18th International Conference on Medical Image Computing and Computer-assisted Intervention, Munich, Germany, 5–9 October 2015; pp. 234–241. [Google Scholar]
  32. Milletari, F.; Navab, N.; Ahmadi, S.A. V-net: Fully convolutional neural networks for volumetric medical image segmentation. In Proceedings of the 2016 4th International Conference on 3D Vision, Stanford, CA, USA, 25–28 October 2016; pp. 565–571. [Google Scholar]
  33. Chen, L.C.; Papandreou, G.; Kokkinos, I.; Murphy, K.; Yuille, A.L. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 40, 834–848. [Google Scholar] [CrossRef] [Green Version]
  34. Chen, S.; Xu, X.; Yang, N.; Chen, X.; Du, F.; Ding, S.; Gao, W. R-Net: A novel fully convolutional network–based infrared image segmentation method for intelligent human behavior analysis. Infrared Phys. Technol. 2022, 123, 104164. [Google Scholar] [CrossRef]
  35. Yang, B.; Pan, H.; He, S.; Han, K.; Zhao, X. Forest fire thermal infrared image segmentation based on K-V model. In Proceedings of the International Conference on Computer Supported Cooperative Work in Design, Dalian, China, 5–7 May 2021; pp. 1275–1280. [Google Scholar]
  36. Guo, Z.; Song, Y.; Zhao, Y.; Yang, X.; Wang, F. An adaptive infrared image segmentation method based on fusion SPCNN. Signal. Process-Image 2020, 87, 115905. [Google Scholar] [CrossRef]
  37. Liu, J.; Li, W.; Tian, Y. Automatic thresholding of gray-level pictures using two-dimension Otsu method. In Proceedings of the 1991 International Conference on Circuits and Systems, Shenzhen, China, 16–17 June 1991; pp. 325–327. [Google Scholar]
  38. Zhu, N.; Wang, G.; Yang, G.; Dai, W. A fast 2d Otsu thresholding algorithm based on improved histogram. In Proceedings of the 2009 Chinese Conference on Pattern Recognition, Nanjing, China, 4–6 November 2009; pp. 1–5. [Google Scholar]
  39. Zhang, Z.; Zhou, N. A novel image segmentation method combined Otsu and improved PSO. In Proceedings of the 2012 IEEE 5th International Conference on Advanced Computational Intelligence, Nanjing, China, 18–20 October 2012; pp. 538–586. [Google Scholar]
  40. Raja, N.S.M.; Sukanya, S.A.; Nikita, Y. Improved PSO based multi-level thresholding for cancer infected breast thermal images using Otsu. Procedia Comput. Sci. 2015, 48, 524–529. [Google Scholar] [CrossRef] [Green Version]
  41. Liang, Y.C.; Chen, A.H.L.; Chyu, C.C. Application of a hybrid ant colony optimization for the multilevel thresholding in image processing. In Proceedings of the 13th International Conference on Neural Information Processing, Hong Kong, China, 3–6 October 2006; pp. 1183–1192. [Google Scholar]
  42. Gao, K.; Dong, M.; Zhu, L.; Gao, M. Image segmentation method based upon Otsu ACO algorithm. In Proceedings of the International Symposium on Information and Automation, Guangzhou, China, 10–11 November 2010; pp. 574–580. [Google Scholar]
  43. Shahabi, F.; Pourahangarian, F.; Edalatpanah, S.A.; Beheshti, H. A multilevel image thresholding approach based on crow search algorithm and Otsu method. J. Decis. Oper. Res. 2019, 4, 33–41. [Google Scholar] [CrossRef]
  44. Wang, X.; Cai, L.; Huang, J.; Gao, W.; Ju, Y. Infrared image segmentation based on improved Otsu algorithm. Fire Control Command Control 2014, S1, 77–78. [Google Scholar]
  45. Wang, Z. A new approach for segmentation and quantification of cells or nanoparticles. IEEE Trans. Ind. Inform. 2016, 12, 962–971. [Google Scholar] [CrossRef]
  46. He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. Mask r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 2961–2969. [Google Scholar]
  47. Ren, S.; He, K.; Girshick, R.; Sun, J. Faster r-cnn: Towards real-time object detection with region proposal networks. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 39, 1137–1149. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  48. Lin, T.Y.; Dollar, P.; Girshick, R.; He, K.; Hariharan, B.; Belongie, S. Feature pyramid networks for object detection. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 936–944. [Google Scholar]
  49. Zhao, H.; Mao, R.; Li, M.; Li, B.; Wang, M. SheepInst: A high-performance instance segmentation of sheep images based on deep learning. Animals 2023, 13, 1338. [Google Scholar] [CrossRef]
  50. Zhou, Y.; Xue, H.; Jiang, X.; Gao, X.; Zhang, L.; Du, Y.; Wang, L. Sheep image segmentation and contour extraction of multi-scale watershed and fuzzy c-means based on graph cuts. Acta Technica 2017, 62, 145–156. [Google Scholar]
  51. Zhang, A.L.; Wu, B.P.; Wuyun, C.T.; Jiang, D.X.; Xuan, E.C.; Ma, F.Y. Algorithm of sheep body dimension measurement and its applications based on image analysis. Comput. Electron. Agric. 2018, 153, 33–45. [Google Scholar] [CrossRef]
Figure 1. Samples of the mid-infrared image dataset. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image.
Figure 1. Samples of the mid-infrared image dataset. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image.
Agriculture 13 01281 g001
Figure 2. Gray histograms of Figure 1. (a) The gray histogram of the highland wetland image. (b) The gray histogram of the sandy land image. (c) The gray histogram of the grassland image.
Figure 2. Gray histograms of Figure 1. (a) The gray histogram of the highland wetland image. (b) The gray histogram of the sandy land image. (c) The gray histogram of the grassland image.
Agriculture 13 01281 g002
Figure 3. Standard segmented images of sample images in Figure 1. (a) The standard segmented images of highland wetland image. (b) The standard segmented images of sandy land image. (c) The standard segmented images of grassland image.
Figure 3. Standard segmented images of sample images in Figure 1. (a) The standard segmented images of highland wetland image. (b) The standard segmented images of sandy land image. (c) The standard segmented images of grassland image.
Agriculture 13 01281 g003
Figure 4. Proposed algorithm flow chart.
Figure 4. Proposed algorithm flow chart.
Agriculture 13 01281 g004
Figure 5. Comparative experiment of MA-OTSU. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image. (d) The result of (a) using classic OTSU. (e) The result of (b) using classic OTSU. (f) The result of (c) using classic OTSU. (g) The result of (a) using OTSU in [44]. (h) The result of (b) using OTSU in [44]. (i) The result of (c) using OTSU in [44]. (j) The result of (a) using multi-threshold OTSU. (k) The result of (b) using multi-threshold OTSU. (l) The result of (c) using multi-threshold OTSU. (m) The result of (a) using OTSU based on clustering. (n) The result of (b) using OTSU based on clustering. (o) The result of (c) using OTSU based on clustering. (p) The result of (a) using OTSU based on genetic algorithm. (q) The result of (b) using OTSU based on genetic algorithm. (r) The result of (c) using OTSU based on genetic algorithm. (s) The result of (a) using our method. (t) The result of (b) using our method. (u) The result of (c) using our method.
Figure 5. Comparative experiment of MA-OTSU. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image. (d) The result of (a) using classic OTSU. (e) The result of (b) using classic OTSU. (f) The result of (c) using classic OTSU. (g) The result of (a) using OTSU in [44]. (h) The result of (b) using OTSU in [44]. (i) The result of (c) using OTSU in [44]. (j) The result of (a) using multi-threshold OTSU. (k) The result of (b) using multi-threshold OTSU. (l) The result of (c) using multi-threshold OTSU. (m) The result of (a) using OTSU based on clustering. (n) The result of (b) using OTSU based on clustering. (o) The result of (c) using OTSU based on clustering. (p) The result of (a) using OTSU based on genetic algorithm. (q) The result of (b) using OTSU based on genetic algorithm. (r) The result of (c) using OTSU based on genetic algorithm. (s) The result of (a) using our method. (t) The result of (b) using our method. (u) The result of (c) using our method.
Agriculture 13 01281 g005aAgriculture 13 01281 g005b
Figure 6. Comparative experiment of BHPF-MA-OTSU segmentation algorithm with different cut-off. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image. (d) The result of (a) using D = 5. (e) The result of (b) using D = 5. (f) The result of (c) using D = 5. (g) The result of (a) using D = 20. (h) The result of (b) using D = 20. (i) The result of (c) using D = 20. (j) The result of (a) using D = 50. (k) The result of (b) using D = 50. (l) The result of (c) using D = 50. (m) The result of (a) using D = 9.138. (n) The result of (b) using D = 9.975. (o) The result of (c) using D = 9.327.
Figure 6. Comparative experiment of BHPF-MA-OTSU segmentation algorithm with different cut-off. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image. (d) The result of (a) using D = 5. (e) The result of (b) using D = 5. (f) The result of (c) using D = 5. (g) The result of (a) using D = 20. (h) The result of (b) using D = 20. (i) The result of (c) using D = 20. (j) The result of (a) using D = 50. (k) The result of (b) using D = 50. (l) The result of (c) using D = 50. (m) The result of (a) using D = 9.138. (n) The result of (b) using D = 9.975. (o) The result of (c) using D = 9.327.
Agriculture 13 01281 g006aAgriculture 13 01281 g006b
Figure 7. Results of multi-level region fusion OTSU algorithm.
Figure 7. Results of multi-level region fusion OTSU algorithm.
Agriculture 13 01281 g007
Figure 8. Comparative experiment of multi-level region fusion OTSU algorithm. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image. (d) The standard segmentation images of (a). (e) The standard segmentation images of (b). (f) The standard segmentation images of (c). (g) The result of (a) using fuzzy C-means clustering segmentation and filtering operations. (h) The result of (b) using fuzzy C-means clustering segmentation and filtering operations. (i) The result of (c) using fuzzy C-means clustering segmentation and filtering operations. (j) The result of (a) using fuzzy thresholding segmentation and filtering operations. (k) The result of (b) using fuzzy thresholding segmentation and filtering operations. (l) The result of (c) using fuzzy thresholding segmentation and filtering operations. (m) The result of (a) using K-means segmentation and filtering operations. (n) The result of (b) using K-means segmentation and filtering operations. (o) The result of (c) using K-means segmentation and filtering operations. (p) The result of (a) using Wang’s segmentation in reference [45] and filtering operations. (q) The result of (b) using Wang’s segmentation in reference [45] and filtering operations. (r) The result of (c) using Wang’s segmentation in reference [45] and filtering operations. (s) The result of (a) using our method. (t) The result of (b) using our method. (u) The result of (c) using our method.
Figure 8. Comparative experiment of multi-level region fusion OTSU algorithm. (a) The highland wetland image. (b) The sandy land image. (c) The grassland image. (d) The standard segmentation images of (a). (e) The standard segmentation images of (b). (f) The standard segmentation images of (c). (g) The result of (a) using fuzzy C-means clustering segmentation and filtering operations. (h) The result of (b) using fuzzy C-means clustering segmentation and filtering operations. (i) The result of (c) using fuzzy C-means clustering segmentation and filtering operations. (j) The result of (a) using fuzzy thresholding segmentation and filtering operations. (k) The result of (b) using fuzzy thresholding segmentation and filtering operations. (l) The result of (c) using fuzzy thresholding segmentation and filtering operations. (m) The result of (a) using K-means segmentation and filtering operations. (n) The result of (b) using K-means segmentation and filtering operations. (o) The result of (c) using K-means segmentation and filtering operations. (p) The result of (a) using Wang’s segmentation in reference [45] and filtering operations. (q) The result of (b) using Wang’s segmentation in reference [45] and filtering operations. (r) The result of (c) using Wang’s segmentation in reference [45] and filtering operations. (s) The result of (a) using our method. (t) The result of (b) using our method. (u) The result of (c) using our method.
Agriculture 13 01281 g008
Figure 9. Comparative experiments in the village scene. (a) The village image. (b) The result of (a) using fuzzy C-means clustering segmentation algorithm. (c) The result of (a) using fuzzy thresholding segmentation algorithm. (d) The result of (a) using K-means segmentation algorithm. (e) The result of (a) using Wang’s segmentation algorithm. (f) The result of (a) using our segmentation method.
Figure 9. Comparative experiments in the village scene. (a) The village image. (b) The result of (a) using fuzzy C-means clustering segmentation algorithm. (c) The result of (a) using fuzzy thresholding segmentation algorithm. (d) The result of (a) using K-means segmentation algorithm. (e) The result of (a) using Wang’s segmentation algorithm. (f) The result of (a) using our segmentation method.
Agriculture 13 01281 g009
Figure 10. Comparative experiment on target occlusion in village scene. (a) The village image with target occlusion. (b) The result of (a) using fuzzy C-means clustering segmentation algorithm. (c) The result of (a) using fuzzy thresholding segmentation algorithm. (d) The result of (a) using K-means segmentation algorithm. (e) The result of (a) using Wang’s segmentation algorithm. (f) The result of (a) using our segmentation method.
Figure 10. Comparative experiment on target occlusion in village scene. (a) The village image with target occlusion. (b) The result of (a) using fuzzy C-means clustering segmentation algorithm. (c) The result of (a) using fuzzy thresholding segmentation algorithm. (d) The result of (a) using K-means segmentation algorithm. (e) The result of (a) using Wang’s segmentation algorithm. (f) The result of (a) using our segmentation method.
Agriculture 13 01281 g010
Table 1. Some parameters of the camera used in the experiment.
Table 1. Some parameters of the camera used in the experiment.
IndexParameter
Sensor1/1.8” Progressive Scan CMOS
Main stream resolution and frame rate50 Hz: 25 fps (2560 × 1440, 1920 × 1080, 1280 × 960, 1280 × 720)
60 Hz: 24 fps (2560 × 1440, 1920 × 1080, 1280 × 960, 1280 × 720)
Shutter1 to 1/100,000 s
Wide dynamic range120 dB
Power supplyAC 24 V ± 20%/DC 12 V ± 20%/PoE (802.3 af)
Table 2. Entropy, mean, and standard deviation of sample image in Figure 1.
Table 2. Entropy, mean, and standard deviation of sample image in Figure 1.
IndexFigure 1aFigure 1bFigure 1c
Entropy7.41127.66937.4029
Mean92.8963136.5736105.6917
Standard Deviation49.111453.025145.1848
Table 3. The thresholds of different OTSU algorithms of the comparative experiment in Figure 5.
Table 3. The thresholds of different OTSU algorithms of the comparative experiment in Figure 5.
Image NamesClassic OTSUImproved
OTSU in [44]
Multi-Threshold OTSUOTSU Based on ClusteringOTSU Based on Genetic AlgorithmOur Method
(d), (g), (j), (m), (p), and (s)109156109, 110110112167
(e), (h), (k), (n), (q), and (t)138165137, 138139134199
(f), (i), (l), (o), (r), and (u)136163106, 107105232174
Table 4. Evaluation results of RMSE, SSIM, and PSNR for image data in Figure 8.
Table 4. Evaluation results of RMSE, SSIM, and PSNR for image data in Figure 8.
Image NamesAlgorithmsRMSESSIMPSNR
(g), (j), (m), (p), and (s)FCM method0.464000.9865923.09503
FTH method0.483080.9771720.61665
K-means method0.471970.9827121.51156
Wang’s method0.492380.9744419.75355
Our method0.431870.9952629.16353
(h), (k), (n), (q), and (t)FCM method0.956810.9241114.72805
FTH method0.908150.9555917.33831
K-means method0.951330.9247514.85333
Wang’s method0.930510.9538417.69778
Our method0.874720.9838823.87430
(i), (l), (o), (r), and (u)FCM method0.784580.9249615.67881
FTH method0.721660.9536817.29876
K-means method0.818730.9069414.55417
Wang’s method0.770150.9235915.45486
Our method0.653070.9943730.33159
The optimal values for each group of indicators are labeled in bold font.
Table 5. Processing time of different algorithms (take Figure 8a as an example).
Table 5. Processing time of different algorithms (take Figure 8a as an example).
AlgorithmsFCM MethodFTH MethodK-Means MethodWang’s MethodMA-OTSUBHPF-MA-OTSUOur Method
Processing time2.71518 s0.67569 s0.37216 s0.28077 s0.50574 s1.20753 s2.68167 s
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, M.; Lv, M.; Liu, H.; Li, Q. Mid-Infrared Sheep Segmentation in Highland Pastures Using Multi-Level Region Fusion OTSU Algorithm. Agriculture 2023, 13, 1281. https://doi.org/10.3390/agriculture13071281

AMA Style

Wang M, Lv M, Liu H, Li Q. Mid-Infrared Sheep Segmentation in Highland Pastures Using Multi-Level Region Fusion OTSU Algorithm. Agriculture. 2023; 13(7):1281. https://doi.org/10.3390/agriculture13071281

Chicago/Turabian Style

Wang, Mengmeng, Meng Lv, Haoting Liu, and Qing Li. 2023. "Mid-Infrared Sheep Segmentation in Highland Pastures Using Multi-Level Region Fusion OTSU Algorithm" Agriculture 13, no. 7: 1281. https://doi.org/10.3390/agriculture13071281

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop