How do I visualize a 4D matrix as a pointcloud like plot?
Show older comments
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
Answers (2)
Walter Roberson
on 31 Jan 2018
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
on 31 Jan 2018
0 votes
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.
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!