| With the rapid development of modern manufacturing industry,the requirement of parts quality in industrial production is getting higher and higher.Aiming at the problems of low efficiency and poor accuracy in the traditional industrial inspection,a workpiece classification and size measurement system based on machine vision was designed.The main purpose of this study is to improve the efficiency and accuracy of parts quality detection in industrial production.The main research contents are as follows:(1)During the measurement system design,the requirements of the measurement system were analyzed,the overall design scheme was proposed,the camera,lens and light source in the hardware system were selected according to the requirements,and the sorting platform was built.Finally,the camera imaging principle was analyzed,and the distortion correction and pixel equivalent calibration of the camera were carried out to ensure its accuracy and reliability.(2)This thesis takes four different kinds of workpieces as objects.Firstly,the image preprocessing algorithm is studied,and the Hu invariant moment,the rectangularity and the aspect ratio of the minimum surrounding rectangle of the workpieces are successfully extracted as feature vectors.Then,the feature vectors and the corresponding category labels constitute a complete data set.Aiming at the limitation of BP neural network,Seagull algorithm(SOA)is used to optimize BP neural network,so as to improve the classification recognition rate.Finally,the data set is trained in SOA-BP network,and the trained classifier is used to identify different workpieces.(3)In view of the workpiece measurement problem,this thesis studies a variety of edge detection methods,and uses the improved Canny edge detection algorithm to rough position the workpiece.Then,the Zernike moment method is used to extract sub-pixel edge coordinates,and the performance of the method is evaluated.Finally,the subpixel contour is segmented,and the least square method is used to fit the line and circle in the contour,so as to get the size of the workpiece.(4)The human-computer interaction interface is designed by MATLAB,and the algorithm proposed in the thesis is verified.The experimental results show that the algorithm can identify the type of workpiece accurately.In addition,50 measurements of four different specifications of the workpiece are carried out.The measurement results also meet the accuracy requirements,and the maximum absolute error is stable within 0.05 mm.Then,after the completion of detection,the mechanical arm is controlled at the end of the conveyor belt to complete the work piece sorting. |