Abstract:Vial size is an important quality criterion in the production process of vial. To achieve vial size detection, a program of vial size detection based on machine vision is presented. The program is based on HALCON platform, using some image processing algorithms to perform edge detection and size measurement. The results show that the detection method is fast and accurate, and the detection accuracy is 0.02mm, edge quantization accuracy can reach to the sub-pixel level, meet the requirements of the vials production accuracy of parameters measurement, provides an effective and automatic way to detect industrial production size.