No BSD License  

Highlights from
3D Stereo Disparity

4.3 | 8 ratings Rate this file 101 Downloads (last 30 days) File Size: 458 KB File ID: #19406 Version: 1.0
image thumbnail

3D Stereo Disparity


Shawn Lankton (view profile)


31 Mar 2008 (Updated )

Compute 3D depth map from 2D images

| Watch this File

File Information

People can see depth because they look at the 3D world from two slightly different angles (one from each eye). Our brains then figure out how close things are by determining how far apart they are in the two images from our eyes. The idea here is to do the same thing with a computer. The algorithm is based on “Segment-Based Stereo Matching Using Belief Propogation and a Self-Adapting Dissimilarity Measure” by Klaus, Sormann, and Karner.
[ ]

(Mind that the algorithm here is *inspired* by the algorithm of Klaus et al. Theirs is much more complete)

::Getting Pixel Disparity::

The first step is to get an estimate of the disparity at each pixel in the image. A reference image is chosen, and the other image slides across it. As the two images ’slide’ over one another we subtract their intensity values. Additionally, we subtract gradient information (spatial derivatives). We record the offset at which the difference is the smallest, and call that the disparity.

::Filtering the Pixel Disparity::

Next we combine image information with the pixel disparities to clean up the disparity map. First, we segment the reference image using a technique called “Mean Shift Segmentation.” Then, for each segment, we look at the associated pixel disparities. In my simple implementation, we assign each segment to have the median disparity of all the pixels within that segment. This gives a nice final result.

::More Information::

Download, unzip, and run >>demo to see the code in action.

For more information, videos, and example images check here.

[ ]

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Other requirements Some files run in mex and may require a re-compile. Binaries for most systems are included.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (17)
13 May 2015 adong7639

the code is good for images of Middleburry website image, but Sadly , no plane fitting, in some sence the results are not good

13 May 2015 adong7639  
21 Mar 2013 charu

charu (view profile)

pls provide me the code for multi object detection and tracking by stereo system

Comment only
27 Sep 2012 Hye Soo  
18 Oct 2010 kapil raviya

3 d stereo doesnt work.i have matlab it work in?
error given below

??? Undefined command/function 'modefilt2_mex'.

Error in ==> modefilt2 at 34
f = modefilt2_mex(img,win,ignore);

Error in ==> stereo at 48
fdsp = modefilt2(dsp,[win_size,win_size],2);

Error in ==> demo at 10
[d p] = stereo(i1,i2, maxs);

plz give me solution as soon as possible

Comment only
22 Jun 2010 A K

A K (view profile)

Works right off the bat on a x64 machine with Matlab 7.8.0 R2009a.
This is a simple stereo algorithm that can serve some basic purposes. But as the author states too, it varies (I would say fundamentally) with the cited paper. For one thing, there is no Belief Propagation in this, which is the most basic element of the cited paper.

19 Apr 2010 Behamin

Has anybody actually got this to work with other pictures than the originals? I have tried with several images (rectified and calibrated) and it didn't do such a good job..

Comment only
15 Apr 2010 Bonolo

Bonolo (view profile)

anybody gotten this to work on MAC OSX (Leopard)? Are the dependencies on Edison?

Comment only
23 Feb 2010 Jun wan

very good

06 Jan 2010 wang alfred

dear sir,

would you please explain how to the disparity plane fitting, and how to programm?

if anyone knows , please tell me .

thank you very much

Comment only
04 Jan 2010 jacky dillon

I don't know why I cannot get the mex file to compile, the version is 2009b, and 64bit computer.

Comment only
24 Feb 2009 Martin Dale

If using an older version of matlab the *.mexw32 files should be renamed *.dll. Then the demo will run.
The demo looks good. Still have to try it on my data which has a wide baseline (500mm) and converging views but fingers crossed...

16 Sep 2008 John C

Demo doesn't run, and I can't get the mex file to compile.

Comment only
21 Aug 2008 ABDIALLAH TURK? excellent application for stereo-image analysing...

15 May 2008 abdul wahid

anyone can tell me how to run the demo

Comment only
23 Apr 2008 Vincenzo Taumaturgo

demo doesn't run, why? it says there's an error to "modefilt2_mex function not defined" or something similar...
what I have to do ?

Comment only
09 Apr 2008 Suzzane David

Does a very good job of what it says! Thanks! All you can add is, in the demo plot, add plot names for each one of them.

Contact us