The invention discloses an OpenCV-based high-reflection 
bottle cap defect detection method, which comprises 
bottle cap end 
face detection and 
bottle cap side 
face detection, and specifically comprises the following steps of: firstly, photographing the end part of a high-reflection 
bottle cap by adopting a camera to obtain an end face image, extracting a 
bottle cap boundary curve by utilizing 
edge detection and fitting, and searching defects in the boundary curve by utilizing function threshold segmentation in an OpenCV 
library; if the defect exists, displaying the defect on the image through a function in the OpenCV 
library; taking pictures of the side surface of a high-reflection 
bottle cap in at least four directions to obtain a side surface image, extracting a target area of the side surface of the bottle cap in the image by using a known template image, performing image preprocessing on the target area, performing threshold segmentation on the side surface image by using a function in an OpenCV 
library to identify defects, and displaying the defects on the side surface image. According to the method, the calculation efficiency is high, the required calculation force is small, the defects such as scratches and pits on the 
plastic bottle caps can be automatically recognized, the positions of the defects are effectively positioned, and the production efficiency is greatly improved.