Disclosed is a shaft sleeve part surface defect on-line detection method based on compressed sensing. Compressed sensing description of a part surface defect image is built through a machine vision and compressed sensing method, and an optical imaging and defect detection model highlighting surface defects is built; a part sample image of typical defects is collected, after denoising and necessary image preprocessing are carried out, sampling frequency adjustment and size normalization are carried out, a sample is trained and a redundant dictionary is built; a proper orthogonal basis decomposition matrix and a random observation matrix are designed, a combined orthogonal matching pursuit algorithm is selected, solution of the minimum norm l0 is converted into the problem of solving the optimal solution to reconstruct a defect image, spare representation of the image to be detected is calculated, and defect recognition is carried out on a part to be detected according to built judgment and recognition standards. An on-line detection system with the functions of feeding, positioning and adjustment, image collection, image processing, defect detection and recognition, part separation and the like is built, and rapid detection on the surface defects of the shaft sleeve part is achieved.