In image enhancement technology, there is a spatial domain method that changes a certain grayscale value or neighboring grayscale value of an image in the spatial domain to achieve the enhancement effect. This article proposes an improvement on the traditional double histogram equalization by using threshold segmentation to perform equalization processing on subgraphs. The values obtained from K-means clustering are used as thresholds to segment images according to different thresholds. After histogram equalization, the two subgraphs are merged into a new image. After simulation testing, the improved algorithm has improved the image enhancement effect, making it more convenient to observe the edge features and contrast of the image.