The initial threshold of the gray histogram and the pixel distribution information of its neighborhood are used together as the weight calculation factor of Otsu's formula for calculating the variance between the classes. The traversal calculation makes the final inter-class variance relatively largest, that is, the crack is improved to some extent. The probability of gravity distribution is proportional to the problem of protruding peaks.