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
回答 (2 件)
Walter Roberson
2018 年 1 月 31 日
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
2018 年 1 月 31 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!