Aiming at the defects of the pipeline, this paper proposes an improved kmeans clustering algorithm for image segmentation. First of all, according to the characteristics of image processing, the original image were divided into blocks and the sub block variance is greater than 10% of the original variance. Then, image segmentation is performed on this sub block by using Otsu, and the two kind of mean value is obtained as the initial clustering center of kmeans; At last, Experiments show that using quick Otsu-Kmeans for image segmentation is more suitable for the segmentation of pipeline defect images than Otsu and region growing, and its running speed is faster than kmeans, meanshift.