(a) (b)
Figure 6: Grayscale Histogram of Absolute Value Difference Grayscale
Map, Grayscale Histogram of Difference Grayscale Map
Use the Otsu algorithm to segment two grayscale images. Calculate the
maximum grayscale level K according to formula (2), which is the
threshold of Otsu.
In the formula, when the grayscale level is set as the threshold, the
probability of a pixel being classified as A is , is the grayscale value
of the entire image, and is the variance.
The two-dimensional grayscale histogram in Figure 7a presents a
multimodal distribution, and the Otsu algorithm cannot find the optimal
threshold in the multimodal distribution. Therefore, many backgrounds
are segmented, resulting in poor segmentation performance. Figure 7b is
a binary image for constructing a differential gray-scale image,
highlighting the gray-scale characteristics of the target area, so that
the gray-scale distribution of the target and the background presents a
double peak feature, and the segmentation effect is good. To remove the
influence of paint peeling on the wall surface of the crane’s grab boom,
this article adopts morphological opening operation to eliminate white
impurities in the black area, and then performs morphological closing
operation to eliminate black pixels in the white area, as shown in
Figure 7c.