The application of machine vision to industrial robots is a hot topic in robot research nowadays. A welding robot with machine vision had been developed, which is convenient and flexible to reach the welding point with six degrees-of-freedom (DOF) manipulator, while the singularity of its movement trail is prevented, and the stability of the mechanism had been fully guaranteed. As the precise industry camera can capture the optical feature of the workpiece to reflect in the camera’s CCD lens, the workpiece is identified and located through a visual pattern recognition algorithm based on gray scale processing, on the gradient direction of edge pixel or on geometric element so that high-speed visual acquisition, image preprocessing, feature extraction and recognition, target location are integrated and hardware processing power is improved. Another task is to plan control strategy of control system, and the upper computer software is programmed in order that multi-axis motion trajectory is optimized and servo control is accomplished. Finally, prototype was developed and validation experiments show that the welding robot has high stability, high efficiency, high precision, even if welding joints are random and workpiece contour is irregular.