Engine valve is the core component of the engine, and its quality determines the performance of the engine. In industrial production quality inspection, it is necessary to detect the size of the valve and whether there are defects on the surface. Usually, the quality of the valve is determined by comparing the image of the valve surface with the standard image. However, the existing surface defect detection technology cannot detect the curved surface device. In order to solve this problem, this paper designs a valve size and defect detection method based on computer vision. The experimental results show that the method can quickly and accurately detect the rod diameter, groove radius and surface defects of the valve. The method is practical, robust and real-time.