Abstract:An assembly system is built based on motion control theory and machine vision to solve the problem of automatic assembling of upper and lower lid in industrial production line. Firstly,the industrial camera takes a photo when the workpiece goes into the field of view,and the image data is acquired. Then OpenCV is used for digital image processing,including median filtering,thresholding,holes filled,edge extraction,which help gain the image feature. Secondly,by the method of the centroid and the rectangular fitting,the centroid coordinate and deflection angle can be got. Finally,the data is used to correct the coordinate values of robot arm when the 6-axis robot arm grabs workpiece by image processing. A flat checkerboard calibration plate to calibrate the industrial camera is used,and is verified online. Experimental results show that the probability of workpiece grabbing and assembly success is up to 100%,and it can meet the accuracy requirements of industrial site assembly.