File Exchange

image thumbnail

A hybrid algorithm for disparity calculation from sparse disparity estimates based on stereo vision

version (481 KB) by Subhayan Mukherjee
Based on a rectified stereo image pair and few parameters, outputs disparity map of the left image.

1 Download

Updated 31 May 2016

View License

Please cite these papers:
[1] S. Mukherjee and R. Guddeti, "Depth-Based Selective Blurring in Stereo Images Using Accelerated Framework", Springer-Verlag Journal "3D Research", vol. 5, no. 3, 2014.
[2] S. Mukherjee and R. Guddeti, "A hybrid algorithm for disparity calculation from sparse disparity estimates based on stereo vision," IEEE 10th International Conference on Signal Processing and Communications (SPCOM), Jul. 2014.
My algorithm adopts a fast, hybrid approach (mixture of block and region based) for stereo disparity estimation from a rectified stereo image pair. It achieves error rates as low as 7.8%, 5.3% and 4.7% for three standard benchmark images (Tsukuba, Sawtooth and Venus) from the Middlebury stereo vision data-set, of sizes 384x288, 434x380 and 434x383 pixels respectively. The algorithm processes the above three image pairs within (an average of) 3 seconds on a PC having a Intel i7-2600 CPU @3.40 GHz and 8 GB RAM running Matlab 2013b on Windows 7.
In a nutshell, I first convert the stereo image pair from R,G,B to L,a,b color space. Next, I perform intensity(L)-based segmentation of only left image pixels using a fast histogram-based K-Means implementation, then refine the segment boundaries using morphological filtering and connected components analysis. Then I determine the disparities of pixels constituting the refined boundaries using a block-based SAD approach, and lastly, fill in the (missing) disparities of pixels lying inside the refined segment boundaries (based on the refined boundaries' disparities already determined) using my simple and fast reconstruction method.

Cite As

Subhayan Mukherjee (2020). A hybrid algorithm for disparity calculation from sparse disparity estimates based on stereo vision (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Banner Schafer


Thanks for your sharing and I have a problem when I use your code.I don't know how to change the parameter input when I apply the code in other stereo image pair.Looking forword your reply.

Subhayan Mukherjee

@Devraj Mandal: This is for generating the depth image by matching the captured stereo image pair.

Devraj Mandal

Can this be used for matching already captured rgb and depth images ? Thanks for the submission by the way.

Subhayan Mukherjee

@Pallawi Pallawi: You mean for non-stereo images ? Or other stereo pairs ? In the former case, it is a functionality by design, evident from the submission title. In the latter case, please provide further details as to what error messages / sample outputs you are getting.

Pallawi Pallawi

why can not we use this code for other images?please answer.

Hoang Vu Nguyen Tran


Changed to title to match our published paper.

Added paper citation details.

Clarified descriptions of two input arguments and included a real-world stereo image pair and its output depth map.

Added my research guide as 2nd author.

Changed title and tags to better reflect the functionality of my algorithm.

Added screenshot showing the output disparity map of the rectified stereo image pair included as part of this submission.

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux