The invention discloses a weld joint surface defect detection method based on machine vision, and manual detection is replaced. A CCD camera and a zero-degree auxiliary light source are arranged to achieve real-time collecting of weld joint images, the surface evenness change of a workpiece can be reflected through lighting, and collapse detection and recognition are facilitated. Meanwhile, a combined algorithm for weld joint surface defect enhancement, segmentation, extraction and recognition is provided, and classified detection of splashing and collapsing is achieved. Automatic qualification diagnosis is realized through the area and characteristics of a weld defect region, and morphological characteristics such as the number, area, perimeter and circularity of weld defects are stored.The detection mode has the characteristics of process visualization, practicability, operation safety and the like, and compared with a traditional visual detection mode, the detection mode can adaptto detection and evaluation of metal welding seams and glue welding seams of carbon steel, stainless steel, aluminum alloy and the like, such as product structures of large railway vehicles, intercityand urban motor train units, high-speed motor train units and the like.