In order to realize the automatic detection and screening of defective caps, this paper is based on machine vision to realize the automatic detection of caps on conveyor belts running at high speed. The method of deblurring enhancement of dynamic bottle cap image is researched to reduce the image blur caused by high-speed operation. The sharpening process based on the prewitt method is applied to the dynamic image, which effectively solves the problem of virtual image of bottle cap in high-speed operation, and greatly improves the accuracy and rapidity of system detection. Based on the characteristics of the difference between the color of the bottle cap and the color of the conveyor belt, the collected color pictures are processed by gray binarization, filtering, shifting, and difference processing, and the result of whether the bottle cap to be tested is qualified is obtained, and the control function of the bottle cap is realized through the serial port interface technology. Through experimental verification, the accuracy of the design for the judgment of bottle caps is 99.56%, and the number of caps can be detected and processed in about 800 per minute.