The invention relates to a
bottle cap unqualified product marking method based on
machine vision. The surface of a
bottle cap to be tested is illuminated with an LED white annular
light source, and the method includes the following steps that firstly, image information of qualified
bottle caps is collected; secondly, an image of the
bottle cap to be tested is collected; thirdly, the image preprocessed through
median filter is subjected to binarization
processing; fourthly, round locating is carried out, the edge of the
bottle cap is found and serves as a round edge, and a coordinate
system is built with the circle center as an original point; fifthly, the upper limit and the
lower limit of the number of pixels of a detection target are preset according to the number of pixels of production date sprayed codes on the qualified bottle caps, the interior of a circle is set to be a
region of interest (ROI) by means of the obtained round edge and the built coordinate
system, the production date sprayed codes in the ROI serve as detection targets, and
bottle cap detection is conducted; sixthly, unqualified products are marked. The
algorithm which is used is simple, the number of steps is small, quick detection of images is achieved, detection efficiency is high, the method is little influenced by the environment, and accuracy is high.