MATLAB: Rotating a 3D image 3dbrainrotate What code could I use in order to be able to rotate a 3d image of a brain? Im using Matlab 2007 version, thanks in advance Best Answer The simplest way is actually to texture map it onto a flat surface:img=imread('street1.jpg');surf(0:1,0:1,zeros(2),img,'FaceColor','texturemap')Those first three arguments are the X, Y, & Z coordinates. You might want to fiddle those to match the aspect ratio of your image. Related SolutionsMATLAB: Rotate image The default coloring of surf is decided by Z axis value, so MATLAB is behaving as expected. If you want to preserve the original coloring, you need to set CData.x = (0:0.1:2);y = (0:0.1:2);[X,Y] = meshgrid(x,y);Z = sin(X).*sin(Y);h = surf(X,Y,Z)rotate(h,[0,1,0],90,[2,0,0])set(h,'CData',Z) MATLAB: Image rotate Irot = imrotate(I,theta);Mrot = ~imrotate(true(size(I)),theta);Irot(Mrot&~imclearborder(Mrot)) = 255;%View 'erimtool(Irot)Edited to be more robust/simpler Related QuestionDisplaying azimuth angles around a cylinderHow to rotate
Best Answer