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!