The technique core of grain reserves automatical supervision and audit system which based on video is to identify the grain warehouse scene video, and accurately gets the sum of grain quantity. The key to identifying the quantity is the shape of package, and the key to identifying shape is processing and describing the boundary of package. Based on a lot of research and experiment on the edge detection operators, this article select the canny operator and chain code to process and describe the boundary of package. Aiming at the boundary is not absolute connectivity, the closure operation of Mathematical Morphology is introduced to do pretreatment on binary image of packaged grain. Finally the boundary is absolute connectivity. Experiments show that the proposed method enhances the anti-jamming and robustness of edge detection, and satisfy precision request of packaged grain quantify recognition.