Clear Filters
Clear Filters

plot a 3D image

1 view (last 30 days)
pemfir
pemfir on 5 Nov 2012
I have a 640*480 image in the form of a 3D matrix (it is a 640*480*6 matrix)
there are total of 6 layers
layers 1-3 represent the colors of pixels layers 4-6 represent the coordinates (x,y,z) of the pixel. for example one pixel has the following information: [red green blue x y z] is there an easy way to plot this ?

Accepted Answer

Walter Roberson
Walter Roberson on 6 Nov 2012
It is not so bad in the narrow circumstance that the coordinates together fill a planar grid. It is only easy in the even narrower circumstance that the planar grid is along the z plane.
If this condition does not hold, then you are probably not going to be able to form an "image" in the usual sense.
Does the data represent volumetric data over a completely filled cuboid grid? Or volumetric over a sparse grid? Or is it just a set of scattered point-like objects? Or is it sampled data on a surface that should be implicitly smoothly connected to the points closest to it?
  3 Comments
Walter Roberson
Walter Roberson on 6 Nov 2012
x = YourData(:,1);
y = YourData(:,2);
z = YourData(:,3);
cols = YourData(:,4:6);
pointsize = 10;
scatter3(x, y, z, pointsize, cols);
pemfir
pemfir on 6 Nov 2012
thank you very much !

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!