| The defect detection is an important application in the field of computer image and visual。 Defect detection mainly refers to the face of objects detection, including the gap, scratches, stains and other surface defects. Now the defect detection techniques can be applied to the actual production, and detection software can be designed according to the production requirements, which can automatically detect and isolate substandard products according to the requirements of the target product quality instead of artificial recognition. it improves productivity.Machine vision instead of human vision can improve efficiency, higher accuracy can be obtained even in some respects. This detection system mainly using digital image processing in machine vision technology. The method common used in the image processing include image restoration, image enhancement, compression coding and so on. As technology continues to mature, the digital image processing has been widely used in many fields. As technology continues to mature, the digital image processing has been widely used in many fields, such as biomedical engineering, robot vision, industrial inspection, military guidance. It makes image processing to become a booming and prospects discipline. OpenCV is a cross-platform computer vision library, which implements many common digital image processing and computer vision algorithm. It encapsulate a series of digital image processing operations, such as the image extraction, segmentation, edge detection, expansion, corrosion, binarization etc. On the basis of these operations, we design algorithms, to achieve the detection of the corresponding target.The target of this paper is to design a capsule defect detection systems, and integrate it in the capsule detector. When capsule production is completed, we make them go across the machine. Detection software that controls the machine to take pictures of the capsule and determine whether they contain defects, what the type of defect is and if they can eventually meet the requirements by the algorithm that we designed. As far as failure capsules, the machine will start the separation procedure to separate them with the qualified capsules, in order to protect the quality of the product.Compared with other surface inspection, this capsules detection system has the following characteristics. First, we use two cameras, one of which is the color high-definition camera, and the other is an infrared camera. With two cameras we can not only detect subtle surface flaws, but also found the internal defects of the capsule fitting zone. Second, since the capsule is a cylindrical object, the direction of360degrees is all necessary to be detected. and the volume is small, the quantities of production is large. based on the above situation, we use a multiple detection methods to improve the efficiency. |