The application discloses a method and
system for detecting water stains and
drug residues of a
mask, and relates to the field of
mask defect detection, and solves the problem of insufficient detection accuracy when detecting water stains and
drug residues of a
mask. The technical scheme is as follows: image data of the mask is collected; the image data is subjected to light calibration to obtain a brightness correction image; the brightness correction image is subjected to
homomorphic filtering to compress the brightness range of the brightness correction image and enhance the contrast of the brightness correction image, thereby obtaining an enhanced image; the enhanced image is subjected to bilateral filtering to remove interference
noise of the enhanced image and retain edge characteristic values of the enhanced image, thereby obtaining a result image; a preset AOI logic
algorithm is used to perform defect determination on the result image, thereby obtaining a defect area in which water stains and
drug residues may exist; and the defect area is subjected to defect re-inspection, and a defect detection result of water stains and drug residues is output.