Abstract:Taking thin mechanical parts as the main measurement object, a dimension measurement system for mechanical workpieces was developed by comprehensively applying photoelectric technology, digital image processing technology and computer technology, which mainly included lighting system, image acquisition system, image processing system and dimension measurement system. According to the detection requirements, Canny algorithm was used for edge detection and rough positioning, and improved sub-pixel detection technology with 8 direction templates was used to obtain the accurate contour information of workpieces, then the contour was segmented and selected. Hough transform was used to complete the two-dimensional dimension measurement of workpieces, and the two-dimensional dimension measurement system for multi-type workpieces was realized by using Halcon and C++ joint programming. The experimental results show that the average error between Hough transform measurement value and micrometer measurement value is 0.042 mm in linear and aperture measurement,the average time is 32.543 ms.