該技術被稱爲紋理映射。這是從surface
函數(R2011b)一個代碼示例:
load clown
surface(peaks,flipud(X),...
'FaceColor','texturemap',...
'EdgeColor','none',...
'CDataMapping','direct')
colormap(map)
view(-35,45)
此示例從「peppers.png」加載RGB圖像,並將其映射到汽缸:
imgRGB = imread('peppers.png');
[imgInd,map] = rgb2ind(imgRGB,256);
[imgIndRows,imgIndCols] = size(imgInd);
[X,Y,Z] = cylinder(imgIndRows,imgIndCols);
surface(X,Y,Z,flipud(imgInd),...
'FaceColor','texturemap',...
'EdgeColor','none',...
'CDataMapping','direct')
colormap(map)
view(-35,45)
事情甚至與warp
簡單功能(自帶圖像處理工具箱)爲納坦建議:
imgRGB = imread('peppers.png');
[imgRows,imgCols,imgPlanes] = size(imgRGB);
[X,Y,Z] = cylinder(imgRows,imgCols);
warp(X,Y,Z,imgRGB);
你可以用它的圖像創建面...使用'surf(x,y,z,c);'其中'x,y,z'是圓柱體的座標(每個是相同大小的二維數組),'c'是您要映射的圖像。 – Floris 2013-05-10 04:13:07
請參閱:http://www.mathworks.com/support/solutions/en/data/1-15PCO/index.html?product=SL&solution=1-15PCO – Amro 2013-05-10 08:02:03