Hello,
Basically, I have 3D coordinates points (xyzPoints) and I want to display 3 histograms of x, y and z coordinates values in order to visualize the density of data cloud.
xyzPoints = reconstructScene(disparityMap, stereoParamsTEST);
xyzPoints = xyzPoints./1000;
ptCloud = pointCloud(xyzPoints);
figure(4);
pcshow(ptCloud);
title('Point cloud');
How do I create variables for x, y and z coordinates values to do this :
subplot(2,2,1);
hist(x);
subplot(2,2,2);
hist(y);
subplot(2,2,3);
hist(z);
Thanks

 Réponse acceptée

Rik
Rik le 9 Juil 2019

0 votes

It looks like you can use the columns from xyzPoints, because they seem to store the coordinates. Otherwise you could also use the location property of your point cloud object.

3 commentaires

Théodore Keller
Théodore Keller le 9 Juil 2019
Modifié(e) : Théodore Keller le 9 Juil 2019
It seems I can't because 'x' variable doesn't exist. The size of xyzPoints is 2019x4063x3.
What is the location proprety of the point cloud ?
Rik
Rik le 9 Juil 2019
You need to save the data to that variable first. The property I was referring to can be found in the documentation for the pointCloud function.
But as Steven points out: you can simply do something like this.
xyzPoints = reconstructScene(disparityMap, stereoParamsTEST);
xyzPoints = xyzPoints./1000;
figure(1),clf(1)%create a clean window (bring to focus and clear if it already exists)
for dim=1:3
subplot(2,2,dim);
temp=xyzPoints(:,:,dim);
hist(temp(:));
title(char('x'-1+dim))%use a trick to map {1 2 3} to {'x' 'y' 'z'}
end
Théodore Keller
Théodore Keller le 15 Juil 2019
Thank you !

Connectez-vous pour commenter.

Plus de réponses (1)

Steven Lord
Steven Lord le 9 Juil 2019

1 vote

You said in your comment to Rik's answer that xyzPoints is size [2019 4063 3]. I assume therefore that the x data is the first page of that data xyzPoints(:, :, 1), the y data is the second page xyzPoints(:, :, 2), and the z data is the third page xyzPoints(:, :, 3)? If so, call histogram on each of those pages of data.
Alternately you could plot them using scatter3 or perhaps make a trio of heatmap plots: one for x versus y, one for x versus z, and one for y versus z.

Community Treasure Hunt

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

Start Hunting!

Translated by