【MATLAB】将图像投影到三维物体上

场景 1 : 投影到 Sphere 上

转载自 jsgaobiao

代码

function test()
clear;
clc;
clf;
A = imread('a.jpg');
[x,y,z]=sphere(50);

% Use Sphere or semi-sphere
% z(z>0)=nan;
% z(x<0)=nan;

h=surface(x,y,z);
set(h,'CData',A,'FaceColor','texturemap');%texturemap纹理贴图
%colormap(map);
axis equal;
set(gca,'CameraViewAngleMode','manual');
view(3);
end

效果

  • 球面投影
    Sphere

  • 半球面投影
    semi Sphere

猜你喜欢

转载自blog.csdn.net/baishuo8/article/details/80983727