Abstract:Based on the traditional visual universal tool-microscope,this paper uses the optical equipment CCD to replace human eyes to capture images,and adds the grating and digital meter to replace the original projective reader,realizing that the CCD images and the grating data are collected automatically by the computer.According to the CCD images,grating data and the Cartesian coordinates theory,the paper sets up a mathematical model to measure the size of workpiece based on the grating data and image border of the workpiece.This paper applys the median filtering and threshold segmentation to preprocess the workpiece image,uses the least square method to extracte the position and direction of the workpiece edge,and then get the measured size by calculating based on the established mathematical model of the workpiece measurement.