The article proposes an optimized SIFT algorithm to address the issue of uneven feature point distribution in the image stitching process, which leads to long feature point matching time and potential excessive overlap in the final panoramic image. After the feature points are extracted, the region of the feature points is divided by the image segmentation algorithm, make the number of feature points in the region less than the threshold value and then the feature points are matched. Additionally, the RANSAC algorithm is applied to eliminate incorrect matches. Experimental results show that the improved algorithm has significant advantages over the original method in terms of feature point matching time, accuracy, and final image quality.