How do I visualize a 4D matrix as a pointcloud like plot?

Hello,
I have a 4D matrix (X*Y*Z*Colors) which is basically a Depth Map obtained from the Stereo Disparity. Is there a way to visualize it like a pointcloud plot?
The Image I am working with is 297x199 and I have limited the depth to be between 1 to 5000 centimeters (each pixel corresponding to 1 cm). So this makes my matrix to be of size 297*199*5000*3.
Any help is appreciated.
Thanks, Shubham

Respuestas (2)

z_in_order = 1:5000;
[gX, gY, gZ] = ndgrid(x_in_order, y_in_order, z_in_order);
vX = gX(:); vY = gY(:); vZ = gZ(:);
colors = reshape(Your4DArray, [], 3);
then either
pointsize = 20;
scatter3( vX, vY, vZ, pointsize, colors );
or
pcshow( [vX, vY, vZ], colors );
Rik
Rik el 31 de En. de 2018
You could use plot3 in a loop for every unique color, but that could be extremely slow (if you have many unique colors), and depending on your actual data distribution, uninformative.

Preguntada:

el 31 de En. de 2018

Respondida:

el 31 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by