How to extract xyz coordinates from 3D point cloud in MATLAB -
i using kinect windows import 3d images matlab. want able find 3d co-ordinates of objects within 3d scene.
one simple way use clicka3dpoint
function found here, , click point want know co-ordinates of.
the problem clicka3dpoint
expects arguments in 3 n
matrix, x
y
, z
coordinates of n
samples. when use kinect point cloud depthtopointcloud
returns 480 * 640 * 3
matrix.
how can extract x, y, , z coordinates matrix can plot clicka3dpoint
? (or scatter3
?)
my attempt far:
depthdevice = imaq.videodevice('kinect',2) %this kinect depth sensor depthimage = step(depthdevice); %this takes depth image. (a 480 * 640 uint16 array) xyzpoints = depthtopointcloud(depthimage,depthdevice); %convert depth image point cloud clicka3dpoint(reshape(xyzpoints,[3,307200])) %i'm guessing each of 480 * 640 points (307200 points) has x,y , z coordinate, concates coordinates of these points.
but plots points along diagonal line in 3d space. how extract x, y , z coordinates point cloud in matlab?
you can use pcshow
function plot points, , take m-by-n-by-3 array directly. can turn on data tips , click on points in plot see coordinates.
if still want create 3-by-n matrix, easiest way following:
x = xyzpoints(:,:,1); y = xyzpoints(:,:,2); z = zyzpoints(:,:,3); points3d = [x(:)'; y(:)', z(:)'];
Comments
Post a Comment