## 4 Experimental Methods
### Adaptive Mean-Shift Algorithm  
Wildlife monitoring images of different species have different backgrounds and different light intensities. Therefore, after the color and texture parameters were received, we utilized the adaptive mean-shift algorithm to adaptively select the bandwidth according to the pixel characteristics of the wildlife images, which guarantees the extraction quality of the foreground region.  
The kernel density estimated with a fixed bandwidth for a set of data points \(\{x_{i},i=1,2,\ldots n\}\)[35; 36] in the mean-shift algorithm is defined as  
\[p(x)=\frac{1}{nh}{\sum}_{i=1}^{n}K\Big{(}\frac{x-x_{i}}{h}\Big{)} \tag{10}\]  
where \(K(x)\) is a symmetric kernel function with respect to the origin, and the integration of its domain is 1 [37]. The mean shift algorithm usually uses a Gaussian function as a kernel function in which \(h\) represents the fixed bandwidth of the core.  
In this study, the adaptive mean-shift algorithm was used to cluster pixel data, which means that different sampling data \(x_{i}\) adopted different bandwidths \(h=h(x_{i})\). The variable bandwidth kernel function density estimate [38] is defined as  
\[p(x_{i})=\frac{1}{n}{\sum}_{i=1}^{n}\frac{1}{h(x_{i})}K\bigg{(}\frac{x-x_{i}}{ h(x_{i})}\bigg{)} \tag{11}\]  
\[h(x_{i})=h_{0}\times\sqrt{\frac{r}{f(x_{i})}} \tag{12}\]  
In the above function, the pixel point at the center of the grayscale image was taken as the initial center point, and the bandwidth \(h(x_{1})\) was calculated from this point.  
\[h_{0}=\frac{1}{n\times n}{\sum}_{x=1}^{n}{\sum}_{y=1}^{n}\left|M-I(x,y)\right| \tag{13}\]  
where \(h_{0}\) is the average offset of all pixel values and median \(M\) in the image. The probability that a pixel has a gray level of \(x_{i}\) is \(f(x_{i})\). Then, the scale factor \(r\) is defined as  
\[logr=\frac{1}{m}{\sum}\,log(f(x_{i})) \tag{14}\]  
where \(m\) is the number of gray levels of the image. The center point iteration of the kernel function is given in Figure 9, where two-dimensional Gaussian data was randomly generated as coordinates of the data points. The mean-shift vector shifts to where the sample point changes most, and is also the direction of the density gradient.  
Figure 8: Texture parameters extraction; (**a**) Input image; (**b**) texture image.  
Segmentation and extraction results with different mean-shift algorithms are given in Figure 10. The first column of Figure 10 represents the original image. Figure 10b,\(f\) are the best segmentation results obtained by multiple experiments for Figure 10a,e using the traditional mean-shift algorithm, while Figure 10c,g, and Figure 10d,h show the segmentation result and extracted foreground area of the proposed algorithm, respectively. As shown in Figure 10, the results of the proposed algorithm are very close to the best segmentation results obtained by the traditional mean-shift algorithm. The proposed method can control over-segmentation to a small extent and reduce the mean-shift algorithm debugging time. The algorithm comparison parameters are shown in Table 2.  
Time complexity of the mean-shift is defined as \(O\big{(}Tn^{2}\big{)}\), where \(T\) is the iterations number of the data sets, and \(n\) is the number of all sample data points [39]. The larger the value of the bandwidth parameter is, the less number of iterations required to traverse all the data sets, which means that the time complexity \(O\big{(}Tn^{2}\big{)}\) is reduced. Choosing a larger bandwidth value means ignoring the detail information of the image, which can directly affect the quality of segmentation. The parameters of the algorithm proposed by this study are larger than the parameters of the best results in the comparison experiments, which means the proposed method reduces the debugging time and time complexity for image segmentation.