Binocular stereo vision uses two cameras of the same specification instead of human eyes for measurement and judgment. The basic principle of binocular vision ranging is to simultaneously capture the image of the measured object by using two left and right cameras. The objectmeasuredisdifferent, andthe positions under the different camera screensaredifferent, this difference in position is called disparity. The three-dimensional information of the object is obtained according to the principle of disparity. The binocular stereo vision ranging system, which combines the advantages of high efficiency and high precision, is ideal for non-contact detection and quality control. This paper proposes a method combining MATLAB calibration and OpenCV matching to achieve binocular stereo vision. Using the MATLAB calibration tool to perform stereo calibration of the camera, combined with OpenCV for stereo rectification and stereo matching, the disparity value is obtained, and the distance from the target to the camera is calculated by disparity. Simulations show that this method can satisfy the distance measurement.