The superpixel segmentation is an important pre-processing step in computer image processing. Thetraditional superpixel segmentation algorithm based on density clustering is better for boundary processing,but the resulting superpixel shape is irregular. In view of its disadvantages,a new algorithm of superpixel segmentation combining k-means and DBSCAN clustering with spatial constraints is proposed. We first spread the seed point evenly on the image,and then gradually expand the density cluster centered on the seed point using spatial constraints until the entire image is spread,the initial superpixels are obtained,and the seed point is updated iteratively through the k-means method. Finally we traverse the seed point to clean up unaccessed pixels. In order to verify the effectiveness of the algorithm ,experiments were conducted in the BSDS500 dataset and qualitative and quantitative comparisons were made with the most advanced algorithms . When the number of superpixels is about 300,the compact density of this method is 0. 45,which is significantly better than the 0. 40 of the traditional superpixel segmentation algorithm based on density clustering. In this paper, the algorithm of superpixel segmentation is presented to increase the compact density by the uniform distribution of seed points and spatial constraints.