how to overlay the image on the surface?

1 次查看(过去 30 天)
i want to overlay an image on the generated surface (which we generate by algorithms)
the problem is that when we try to overlay the image on generated surface, the result is coming but when i execute it again without the surface code the result is still same. i don't understand where this generated surface is getting saved so image automatically comes in that shape.
% make dummy test data%
N = 400;
X = 1:N;
Y = 1:N;
[X, Y] = meshgrid(X,Y);
Z = (X+Y)/20;
%mesh(Z);
%colormap(red);
%surf(X,Y,Z);
%axis([0 10 0 10 0 40]);
% read jpg and make same size as grid
im = imread('cameraman.tif');
% convert image to indexed colours
[im, map] = rgb2ind(im, 256);
% make figure
figure(1),clf
% make image same size as grid
subimage = im(1:N,1:N);
colormap(map)
% plot surf and use image as texture
s = surf(X,Y,Z);
set(s, 'faceColor', 'texture',...
'edgecolor', 'none',...
'cdata', subimage)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by