| As a country with a large population,China’s aging population is becoming increasingly prominent,and the demand for medical products is also increasing.With the progress of technology,machine vision technology has been continuously applied to the field of medical testing.At present,in the detection method for the surface defect of tablets,automatic detection technology has gradually replaced the traditional manual detection mode.In the automatic detection method,machine vision has been paid more and more attention because of its non-contact,simple structure,fast detection speed and other characteristics.In the traditional method of pill defect detection based on machine vision,a camera is usually used to capture the image of the pill by shooting directly above the pill,this kind of image acquisition method is beneficial to the effective detection of the surface defects of tablets,such as scratches,stains and edge damage,but can not effectively detect the cracks between the upper and lower surface and the thickness of unqualified tablets,such defect tablets in the thickness of a certain difference from the standard tablets.For this kind of situation,this paper proposes a surface defect detection method of tablet based on parallel binocular vision,binocular camera placed in tablets directly above to pill image acquisition,the single camera detection tablets increased depth on the basis of surface defect inspection,from two dimensions of plane visual and stereo vision defect detection on tablets.In order to make the binocular camera not only perceive the depth information,but also obtain the two-dimensional plane information of the tablet clearly and completely.In this paper,the parallel binocular camera is used as the image acquisition unit of the vision system.Nine groups of black-and-white checkerboard template images are collected by the parallel binocular camera,and the camera is calibrated by the Zhang Zhengyou plane calibration method,so as to reserve the parameters for the thickness measurement of tablets.The stereo matching method based on the edge feature of the tablet is used for stereo matching of binocular image.Firstly,Canny operator is used to extract the edge information of the tablet image.Secondly,the tangent points of the horizontal and vertical tangents on the edge are extracted as candidate matching points.Then,three constraint conditions are proposed to screen the feature points based on the edge characteristics of the tablet and the line alignment properties of the parallel binocular vision,The stereo matching of binocular image is completed by the matching rules from left to right.Combined with the calibration parameters of binocular camera and the results of stereo matching,the measurement of the depth of the tablet is realized by using the principle of triangle ranging based on binocular vision.By comparing the depth of intact tablets and deeply defective tablets,the thickness of the defective tablets was measured and the three-dimensional dimension of the tablets was detected.According to the graphic visual detection technology,the existing edge broken tablets to extract edge contour,and tested by using the theory of convex hull,there surface stains and broken tablets,through image segmentation method based on local feature of image segmentation,and then through the analysis of the connected domain,to extract the defect area,realize to planar dimension detection of pills.The experimental results show that the stereo matching method based on the edge features of the tablet has better adaptability for the weak texture tablet image than the mainstream feature matching method based on the gray characteristics,the depth detection accuracy of the surface detection technology of tablet based on parallel binocular vision is 0.1 mm,and the detection accuracy increases proportionally with the increase of camera resolution,indicating that the method has good applicability and reliability. |