% IMROTGAUSS - Rotation of a circular area (disc) of an image, using % Gaussian sampling % % Usage: % % function ir = imrotGauss(im,x0,y0,r,s,m,sig,deg) % % Arguments: % % im = The image. % x0,y0 = position in im. % r = Radius in pixels. % s = size of the rotated image. % m = mask size. % sig = sigma of the Gaussian funcion. % % Returns: % % ir = rotated image. % % Copyright (c) 2012-2013 Anders Hast % Uppsala University % http://www.cb.uu.se/~aht % % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the "Software"), to deal % in the Software without restriction, subject to the following conditions: % % The above copyright notice and this permission notice shall be included in % all copies or substantial portions of the Software. % % The Software is provided "as is", without warranty of any kind. % function ir = imrotGauss(im,x0,y0,r,s,m,sig,deg) ir=zeros(s,s); t=deg*(2*pi)/360; for i=1:s for j=1:s xx=(2*((i-1)/(s-1))-1); yy=(2*((j-1)/(s-1))-1); if xx^2+yy^2 <= 1 x=r*(xx*cos(t)-yy*sin(t))+x0; y=r*(xx*sin(t)+yy*cos(t))+y0; ir(i,j) = Sample2D(im,x,y,m,sig); end end end end