Threshold Calculation
Statistical calculation of an optimal gray-level threshold separates foreground objects from their background in digital images. Standard otsu segmentation minimizes the intra-class variance of pixels to create a binary mask. This method is used in automated optical inspection to distinguish solder fillets from the surrounding circuit board laminate.
Bimodal Distribution
Logic within the algorithm assumes that the image histogram contains two distinct peaks representing the target and the environment. This bimodal distribution of otsu segmentation fails when lighting is uneven or when the surface reflectivity of the PCB varies across the field of view. It works best in controlled environments where the contrast between the shiny metallic solder and the matte green solder mask is high.
Threshold Stability
Iterative processing finds the exact point where the spread of values for both the object and the background is at its lowest. This threshold stability of otsu segmentation provides a repeatable way to measure the area of a solder deposit without manual adjustment by an operator. Reliable results depend on the absence of heavy noise or extreme shadows that might shift the calculated threshold away from the true edge of the component.
The algorithm achieves a balance between the foreground and background pixel classes by maximizing the variance between them.