To find out the X, Y and Z co-ordinates from 3D point cloud.

2 views (last 30 days)
Hello I'm using Stereo Vision in MATLAB. In that i have to find out the X, Y and Z co-ordinates of region of interest(in my case white color object) from 3D point cloud. I able to create 3D scene reconstruction but how to proceed further I don't know. Can anyone suggest some code examples or method to find out these co-ordinates. I'm attaching my 3d point cloud and disparity map with this. Thanks in Advance.

Accepted Answer

Dima Lisin
Dima Lisin on 28 Dec 2015
Hi Naseeb,
If you trying to find the 3D coordinates of a particular object in the scene, then you need to be able to detect it either in the image, or in the point cloud. reconstructScene returns an M-by-N-by-3 array, where [M,N] is the size of the rectified image. So the 3D coordinates are in correspondence with image pixels. Thus, if you can find the object in image 1 of your stereo pair, then you can simply look up the [X,Y,Z] coordinates of the pixels belonging to this object in the 3D point array returned by reconstructScene.
How to detect an object in the image is a whole separate question, and the answer depends on the type of object. If the object has a distinctive color, you can try using a segmentation algorithm. Otherwise, you can use local feature matching, or a detection algorithm trained for a specific kind of object, such as vision.CascadeObjectDetector or vision.PeopleDetector.
Alternatively, if your object has a particular 3D shape, such as plane, sphere, or cylinder, you can try detecting it in the point cloud directly. There are functions for fitting primitive shapes to the point cloud: pcfitplane, pcfitshpere, and pcfitcylinder.
Uzair UlHaq
Uzair UlHaq on 28 Feb 2018
If you want to extract x,y,z values from points3D then simply use: x=points3D(:,:,1) y=points3D(:,:,2) z=points3D(:,:,3)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!