The invention relates to the technical field of
microlens detection, in particular to an automatic
microlens detection method and
system, and the method comprises the steps: obtaining a stripe image of a
microlens under the illumination of a stripe structure; preprocessing the stripe image to obtain a preprocessed image with a block area as a foreground; determining a rotation angle according to the boundary of the
reference block region, and rotating the corrected stripe image to align the stripe with the row direction; segmenting the rotating image, identifying a connected block, solving an external frame to generate a block
mask and a complementary set interval
mask thereof, and obtaining a block image and an interval image; performing segmentation on the block image, taking a median value according to rows to replace and generate a block
reference image, performing differential binarization to obtain a block defect candidate, and performing independent binarization and merging on an abnormal region; overlapping the interval image and the block
mask, performing closed operation to suppress line
noise, and then performing binarization inversion to obtain an interval defect candidate; and superposing the two candidate output defect mark images. According to the invention, the defect can be automatically identified and marked and output by the microlens under the stripe background.