How to store a 3-D surf image into a 3-D matrix?
Show older comments
I have an 'image' (2D Matrix) of size AxB. The 'surf(image)' command in Matlab generates a 3-D surface image. I would like to store the generated 3-D surface image in a single 3-D matrix say 'image3D' of size AxBxC; thus it can be used for additional operations. 'C' here is the size pertaining to the dimension in the Z direction, and it has to do with the individual pixel values in the original 'image'.
Is there a feasible way to do this in Matlab?
Answers (2)
Wayne King
on 10 May 2012
I am not sure I understand your question. If you input a 2-D matrix into surf() then the values of your matrix are the values plotted by surf. You can get the 'ZData' from the surf() plot, but that will be the same as your input matrix.
x = randn(20,20);
h = surf(x);
x1 = get(h,'ZData');
isequal(x,x1)
Khalid
on 11 May 2012
Categories
Find more on Contour Plots 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!