An algorithm used to inspect and extract crack defects from weld image is developed in this paper. In this algorithm the weld image is dealt with based on Laplacian operator with offset, and aiming at to the processed image 12 dictionary models are established with allowable structure. Effective searching method is provided based on the application of dictionary and more and more context-dependent information is extracted from neighborhood context. Then noise can be reduced effectively and crack defects can be extracted. Experimental results show that longitudinal crack can gain better uninterrupted edges and better clear outline using this algorithm. This algorithm possesses better noise resistance and is a class of inspection method of faint crack.