Abstract:Abstract: Purple soil which riches in mineral nutrients and is the main farming soil in Southwest China. Purple soil color images collected by machine vision have complex background, including crops, weeds, scattered small soil blocks and surface soil because of its stochastic field scenes. In order to avoid the interference of background on further processing and recognition of purple soil with machine vision, it is a primary task to segment the purple subsoil region from its background adaptively. Clustering algorithm has achieved good results in image segmentation and is widely applied. However, the selection of parameters of some classical clustering algorithms are sensitive, which need to be manually set and cannot satisfy to the adaptive segmentation of purple soil. Thus, aiming at the problem of adaptive segmentation, a segmentation methool of purple soil color image based on adaptive density peaks clustering was proposed in this paper. The specific segmentation algorithm was as follows: firstly, in order to calculate the density peaks conveniently and increase the separability between soil region and its background, a color to gray transformation method was carried out. The entropy-based similarity matrix was constructed, then the optimization model based on maximizing the between-class variance and minimizing the within-class variance criterion was established with the similarity matrix. The optimization model was solved to obtain the gray matrix, which enhanced the separability of the gray value for clustering. Secondly, in the light of the shortcomings of density peaks algorithm, the density formula was improved and a measure was designed to determine the clustering centers adaptively, which realized the adaptive segmentation of purple soil region with the clustering algorithm based on the density peaks clustering framework, and improved the initial segmentation accuracy. Finally, post-processing algorithms of boundary extraction and region filling were designed to remove both the discrete small soil blocks in the background area and the internal voids in the soil area of the image obtained by initial segmentation. Therefore, the purple soil region image could be completely obtained and the segmentation accuracy of soil region was improved. From purple soil color images collected by machine vision in the field, 60 images with normal illumination, no surface soil and no shadows around the subsoil were randomly selected as normal test images and divided into 20 groups.we picked out randomly 60 images with the characteristics of normal illumination, then another 60 images were randomly selected as robustness test images, which were characterized by scattered subsoil and some shadows around the topsoil. These images were divided into 20 groups. The results of contrast test showed that the proposed method could automatically segment the purple soil color images of normal test and robustness test. For 60 normal test images, average segmentation accuracy of the proposed algorithm were 93.45%, which were 11.54, 7.96, 3.16 and 0.85 percentage points higher than that of FRFCM (fast and robust fuzzy C-Means) algorithm, H-threshold algorithm, DPC (density peaks clustering) algorithm and DFDPC (data field based density peaks clustering) algorithm, respectively. For 60 robustness test images, average segmentation accuracy of the proposed algorithm were 87.40%, which were 11.75, 5.2, 12.47 and 3.09 percentage points higher than that of FRFCM algorithm, H-threshold algorithm, DPC algorithm and DFDPC algorithm, respectively. The results proved that the proposed algorithm in this paper was superior to the other four comparison algorithms. Furthermore, boundary extraction algorithm and region filling algorithm further improved the average segmentation accuracy of soil region, in the post-processing stage. In the final exact segmentation results, average segmentation accuracy of normal test images were 96.30%, with average time-consuming of 0.36 s, and average segmentation accuracy of robustness test images was 91.63%, with average time-consuming of 0.35 s. In conclusion, the proposed algorithm was effective, and it can provide reference for the segmentation and extraction of purple soil region from the computer vision image.