# MATLAB - Going from a disparity map to point cloud from stereo images on HELP!

20 views (last 30 days)
Haseeb Majid on 13 May 2017
Answered: Munin on 3 Sep 2021
Hi all, I need help with my stereoscopic 3-D reconstruction project, I'm currently stuck on the reconstructing a 3-D point cloud part. I have been given a pair of stereo images of the back of an eye, and I need to produce a 3D point cloud from them, I have got up to the disparity map, not sure if its optimal?
Here is what I've done so far:
##### 1 CommentShowHide None
Hanieh Shabanian on 12 Feb 2018
could you find any solution to your problem?

Gautham Sholingar on 16 May 2017
Another possible way to approach this problem is to use the following function from the Computer Vision System Toolbox which allows you to create a real-world 3D co-ordinate model from the disparity data:
As far as being optimal, you will need to explain what optimal means and evaluate this yourself. Try comparing the derived point-cloud to an expected model and see if this helps you evaluate the result.
##### 2 CommentsShowHide 1 older comment
UBAID ULLAH on 15 Mar 2018
I am running your code but i am getting a error. can you help me to solve it.
Error using zeros Requested 55033x54541 (11.2GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in cvalgMatchFeatures>metricSSD (line 507) scores = zeros(N1, N2, outputClass);
Error in cvalgMatchFeatures>exhaustiveDistanceMetrics (line 186) scores = metricSSD(features1, features2, N1, N2, outputClass);
Error in cvalgMatchFeatures>findMatchesExhaustive (line 137) scores = exhaustiveDistanceMetrics(features1, features2, N1, N2, outputClass, metric);
Error in cvalgMatchFeatures (line 52) [indexPairs, matchMetric] = findMatchesExhaustive(features1,features2, ...
Error in matchFeatures (line 177) cvalgMatchFeatures(features1, features2, ...
Error in disparitymap (line 23) indexPairs = matchFeatures(features1, features2);
this was the error

Munin on 3 Sep 2021
@Hanieh Shabanian @Haseeb Majid the solution is simple:
disparityMap(disparityMap > 12) = 0;

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!