How to store a 3-D surf image into a 3-D matrix?
显示 更早的评论
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?
回答(2 个)
Wayne King
2012-5-10
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)
类别
在 帮助中心 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!