Abstract:Needle roller bearings are important components of automotive gearboxes. Aiming at the need of missing needle detection after assembly of needle roller bearings in gearbox, an online leak detection method was proposed. OpenCV open source visual library and C++ language were used to develop detection software. Machine vision related theory was used to make graying, filtering, threshold segmentation and other preprocessing for the image. Mask method was used to extract the detection area, morphological processing for the detection area was performed to eliminate small areas. Finally, the connected area counting method was to used calculate the exact number of needles.Using the method, the efficiency of actual production is improved, the false detection rate of workers is effectively reduced, and the automation rate of the production line is improved.