In order to improve the automation and intelligence level of tobacco packet distribution and to automatically complete the stacking flow operation of tobacco packet, a set of automatic stacking robot systems based on machine vision were designed. This system includes the visual system and sorting palletizing system. In the visual system shape area, k-means clustering is adopted to establish the standard template library. A fast matching algorithm based on the shape of template was put forward, which could identify smoke a few shapes and cigarette package fast and accurately. Then the upper machine data information was sent to the palletizing system to finish the tobacco package, cigarette package group pile, and pallet cigarette packet scheduling algorithm of automatic palletizing homework. The field test results showed that the shape recognition rate of cigarette packs was over 99.90%, the shape matching time of cigarette packs was less than 80ms, the stacking efficiency was 5.04-5.14s per packet, the stacking tilt value was less than 3cm, the packing void rate was less than 5%, and the stacking error rate was less than 0.10%, which met the requirements of cigarette packing stacking. The system can provide technical support for improving tobacco logistics automation.