This paper proposes a dense two-frame stereo matching algorithm. To estimate disparities reliably in occlusion region, an efficient way of handling occlusion is proposed. The scene structure in an input image is modeled by a set of planar surfaces which are estimated by using a novel plane fitting based on RANSAC. The optimal disparity is estimated by using belief propagation on a pairwise Markov random field. The experimental results show that the proposed algorithm is comparable with the conventional stereo matching algorithm.