In order to obtain good welding quality, it is necessary to apply quality control because there are many influencing factors in the X-ray welding process. The key to realize welding quality control is to obtain the quality information. Automatic detection of weld defects (ADWD) is an important part of the welding quality assurance, while the extraction of weld region is the base of feature extraction and defects recognition. An algorithm which is based on gray enhancement is proposed in this paper. Experimental results show that this method can significantly suppress noise interference, improve the accuracy of edge detection in noise Sound and more blurred edge X-ray image can be achieved than active contour model and fuzzy kernel clustering better results.