For the traditional machine vision, positioning algorithms are usually less efficient and more complex, the author proposes a relative threshold-based positioning algorithm for real-time machine vision. Firstly, the algorithm thresholds the template and sample images with a relative threshold. So it can not only effectively impact the influence of uniform illumination, but also reduce the volume of data. Then it uses the two-floor image pyramid method to greatly reduce the computation amount and uses the adaptive step method further to accelerate the matching speed. The algorithm nears to the object by the rough matching, and then navigates to the object center through a precise matching. While greatly improving the matching speed it ensures the accuracy. The experiments show that it can meet the real-time requirement.