Vision sensor for weld seam location and seam tracking is developed. It is difficult for realizing picture precise identification based on machine welding at present, the image recognition algorithm based on wavelet analysis is designed in this paper. It uses immune genetic algorithm to optimize wavelet coefficient, and extracts the edge of picture preferably. In the process of detecting edges, compared with the others, the algorithm can inhibit the interference of noises effectively and remove artifacts of edges, which make the detected edge clearly and carefully. The result shows that the wavelet analysis algorithm has better effect for weld seam recognition.