The effect of horizontal streaks in disparity map obtained by traditional dynamic programming based stereo matching(DPSM) algorithm mainly result from disparity smoothness constraint dependent on the boundaries in the image whose accuracy affects the constraints on disparity discontinuity regions and match correctness directly. Then a DPSM algorithm based on occlusion detection, replacing edges detection in the traditional DPSM algorithm to obtain the disparity discontinuity regions to control disparity smoothness constraint, is proposed, and the experimental result shows that the algorithm can improve the performance and has much better result than the traditional.