Device and method for detecting cap weld seams by means of constructing light and shadow features by aid of lateral light

The invention discloses a device and a method for detecting cap weld seams by means of constructing light and shadow features by the aid of lateral light, and belongs to the field of welding automation. The edges of the weld seams are illuminated by surface light sources, imaging elements are arranged near mirror reflection optical axes of the edges of the weld seams and avoid mirror reflection optical axes of the surfaces of base materials and the centers of the weld seams, grayscale images of the surfaces of the weld seams are acquired and are processed by the aid of a processing control unit, and then tracks of the weld seams can be accurately extracted. The device and the method have the advantages that feature information of the edges of the weld seams can be effectively highlighted under lateral illumination conditions constructed by the aid of the device and the method, grayscale of the edges of the weld seams is nearly saturated, and locations of the tracks of the weld seams can be conveniently quickly and accurately extracted; the detection precision can reach 0.04mm, the device is simple in system structure, low in cost and good in timeliness, and the device and the method are applicable to places for automatically detecting tracks of cap weld seams with low surplus heights which are lower than or equal to 1mm.