| Industrial automation is the gospel of industrial production.It uses equipment to replace manual labor,which greatly improves the production quality and production efficiency of enterprises.Machine vision technology plays a pivotal role in the industry.Based on machine vision technology,this paper analyzes and experimentally researches mahjong with complex and diverse pattern features,and develops a mahjong recognition and positioning glue vision system to assist the coloring process and the inspection process of mahjong packaging.The main work of this paper is as follows:Starting from the actual project,this paper will introduce how to carry out hardware selection and layout,how to choose reasonable vision system hardware from the perspective of economy and feasibility.The main hardware includes camera,lens,light source and so on.This paper will complete the hardware installation and equipment debugging according to the production characteristics.This paper will in traduce how to calibrate the camera,the mean of camera model.Camera distortion and coordinate conversion knowledge are analyzed and discussed,and the vision system calibration is completed using Zhang Zhengyou’s calibration method.The system can generate trajectory according to the mahjong pattern and plan the trajectory movement.After obtaining the center position of the mahjong outline from the image,this system uses the relevant knowledge of image preprocessing to obtain the ROI area of the mahjong outline,analyzes the mahjong pattern and extracts the skeleton.By comparing with the effects of multiple thinning algorithms,Z-S algorithm and Rosenfeld algorithm are selected for thinning processing.Then the chain code algorithm is combined to improve the algorithm of trajectory point planning and sorting.Finally,the ordered point trajectory of mahjong pattern coloring processing is obtained through the method of color reprinting.The track points are attached with corresponding color numbers,and the CNC system can select needles of different colors for processing.During the processing,the mahjong will have a random angle deviation.After obtaining the center of mahjong contour,the trajectory point is converted and mapped based on the mahjong center to deal with the angle deviation problem,and the trajectory point is saved as a file for the system to choose.The template matching algorithm and the YOLOv4 algorithm are used to identify mahjong.But the experiment shows that two methods have their own advantages and disadvantages.Among them,the template matching algorithm has high recognition accuracy,but it takes a long time;the YOLOv4 algorithm has a fast recognition speed,but its accuracy is low.During the research process,it is discovered that due to the similarities and differences in the shape and color of mahjong patterns,it is difficult to ensure the recognition accuracy by the template matching algorithm,and there are many problems of serious mismatches and missed matches.In order to meet the requirements of the project,it is proposed to use template matching with geometric feature screening to identify and classify mahjong.This method can meet the requirements of the project.Integrating the above functional modules into software,this paper completed the equipment testing in combination with software and hardware.The system in this paper can meet the requirements of the project.The glued needle can be colored according to the mahjong pattern trajectory.The processing time is 2 seconds faster than the original process,and the production cost is saved. |