In nondestructive testing, in order to avoid the processing waste and repair the defects, the accurate location of the inner defects of components has been used to determine the danger of defects, which is very helpful to eliminate the workpiece as soon as possible. In the paper, the theory of binocular vision has been successfully applied to locate the inner defects accurately in the nondestructive testing field. Firstly, a simple and effective mathematical model has been built. Secondly, the simulation method has been used to verify the model. At last, the error theory has been applied to analyze the error, which would have effect on the test result. The most direct and effective method with high precision has also been proposed. It has been proved that the method has high precision and great simplicity to design. Through the X-ray image, the method could also been used to locate the depth information of the inner defects in metal casting, which would provide a good solution to the DR and CT deficiency.