1

I have a set of images of a scene at different angles and the camera intrinsic parameters. I was able to generate the 3D points using point correspondences and triangulation. Is there a built-in method or a way to produce 3D images in MATLAB? From the given set of images, a 3D image as such? By 3D image, I mean a 3D view of the scene based on the colors, depth, etc.?

Dima
  • 38,860
  • 14
  • 75
  • 115
Lakshmi Narayanan
  • 5,220
  • 13
  • 50
  • 92
  • So you already have a depth map, you just need to display the image + depth? – benathon Dec 03 '13 at 02:13
  • 1
    @Lakshmi Narayanan Have you checked this out? http://stackoverflow.com/questions/6891154/creating-3d-volume-from-2d-slice-set-of-grayscale-images/6894938#6894938 – Gary Tsui Dec 03 '13 at 03:30
  • @portforwardpodcast I obtained the 3d points and displayed them, but they weren't anywhere close, due to no.of inliers and outliers from matching. If you mean the 3d points as depth, yes I have. But i wanted a 3D sort of effect, which I think are explained in the answers below – Lakshmi Narayanan Dec 03 '13 at 11:30

3 Answers3

3

There was a recent MathWorks blog post on 3D surface rendering, which showed methods using built-in functions and using contributed code.

The built-in method uses isosurface and patch. To display multiple surfaces, the trick is to set the 'FaceAlpha' patch property to get transparency.

The post also highlighted the "vol_3d v2" File Exchange submission, which provides the vol3d function to render the surface. It allows explicit definition of voxel colors and alpha values.

chappjc
  • 30,359
  • 6
  • 75
  • 132
1

Some file exchange from mathworks: 3D CT/MRI images interactive sliding viewer, 3D imshow, image3, and viewer3D.

If your images matrix I has the dimension of x*y*z, you can try surface as well:

[X,Y] = meshgrid(1:size(I,2), 1:size(I,1));
Z = ones(size(I,1),size(I,2));
for z=1:size(I,3)
   k=z*sliceInterval;
   surface('XData',X, 'YData',Y, 'ZData',Z*k,'CData',I(:,:,z), 'CDataMapping','direct', 'EdgeColor','none', 'FaceColor','texturemap')
end
lennon310
  • 12,503
  • 11
  • 43
  • 61
1

The Computer Vision System Toolbox for MATLAB includes a function called estimateUncalibratedRectification, which you can use to rectify a pair of stereo images. Check out this example of how to create a 3-D image, which can be viewed with a pair of red-cyan stereo glasses.

Dima
  • 38,860
  • 14
  • 75
  • 115