matlab - Mapping image into cylinder or sphere shape? -
so lets have black & white image read imread() command , saved matrix a.
i want output/graph matrix image in cylinder shape. know how draw cylinder in matlab, not have clue should if want put image on cylinder or draw image in cylinder shape. appreciated. thank you.
i found site googling. http://www.flashandmath.com/advanced/rolls/cylin.html want do, need in matlab.
the technique called texture mapping. code example surface function (r2011b):
load clown surface(peaks,flipud(x),... 'facecolor','texturemap',... 'edgecolor','none',... 'cdatamapping','direct') colormap(map) view(-35,45) this example loads rgb image "peppers.png" , maps onto cylinder:
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) things simpler warp function (comes image processing toolbox) natan suggested:
imgrgb = imread('peppers.png'); [imgrows,imgcols,imgplanes] = size(imgrgb); [x,y,z] = cylinder(imgrows,imgcols); warp(x,y,z,imgrgb);
Comments
Post a Comment