We propose a scanline energy minimization algorithm for stereo vision. The proposed algorithm differs from conventional energy minimization techniques in that it focuses on the relationship between local match cost solution and the energy minimization solution. The local solution is transformed into energy minimization solution through the optimization of the disparity discontinuity. In this paper, disparity discontinuities are targeted during the energy minimization instead of the disparities themselves. By eliminating and relocating the disparity discontinuities, the energy can be minimized in iterations of O(n) where n is the number of pixels. Although dynamic programming has been adequate for both speed and performance in the scan-line stereo, the proposed algorithm was shown to have better performance with comparable speed.