Abstract:To resolve the problem of Mahjong Card misplacement, deficit, and reversal for Mahjong packaging production line, a visual processing system of Mahjong package recognition is designed based on machine vision and DM6437 processor. The hardware system contains the sensor board, DSP board and interface board, and coordinates with mechanical transmission system to transport the Mahjong package before and after the recognition. Meanwhile, the Pad is used to achieve the Mahjong package templates entering in the software system, and a background subtraction method adaptive to the environment changes of different mechanical systems is designed to complete the templates global segmentation. Besides, the separation of single objective is realized by median algorithm. Eventually, a simple and efficient mixed searching method is presented to achieve the template matching based on SAD. Experiment results on the recognition system show that the algorithm has a strong tolerability on the gaps between Mahjong cards, the tilt and reversal of Mahjong packages, and the misplacement of Mahjong cards. Furthermore, the stability and adaptability of the template matching algorithm are quite effective, and the accuracy of the identification achieves more than 95%, which can meet the detection quality on the packaging lines.