In this paper, we present an efficient window-based stereo matching algorithm that especially focuses on foreground objects. For decades, there are a lot of researches about the stereo matching algorithms. However, most of methods concentrate on the entire pixels, which are time consuming and meaningless in the real applications. To strength the accuracy of stereo correspondence in foreground objects, a simple locally support-weight method based on the selected prime key is proposed in our algorithm. Moreover, a background pre-detection method is also employed to get a primary background checking map, which is used to reduce the number of computed pixels in the disparity selection. After the refinement of both foreground disparity map and background checking map, our algorithm obtains accurate disparity results on the foreground and separate it with the background by the correspondence search simultaneously. The experimental results based on the Middlebury stereo datasets demonstrate that our method can achieve a better performance on foreground disparity computing than many other support-weight methods in terms of both accuracy and computational efficiency. In addition, our proposals can make foreground objects detection easier at the same time.