from Change Image Coordination by Marco Chak Yan Yu
Change image coordinate from standard image coordinate to polar coordinate, vice versa.

image2polar(IM,xCenter,yCenter,ROT,rrange,rbin,thetabin,INTERP)
%%--------------------------------------------------------------------------------------------
% Copyright (C) 2010-2013 Marco Chak-Yan YU
% All rights reserved.
% 
% Redistribution and use in source and binary forms, with or without 
% modification, are permitted provided that the following conditions are met:
%    * Redistributions of source code must retain the above copyright 
%      notice, this list of conditions and the following disclaimer.
%    * Redistributions in binary form must reproduce the above copyright 
%      notice, this list of conditions and the following disclaimer in 
%      the documentation and/or other materials provided with the distribution
%     
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS WITHOUT ANY WARRANTY;
% WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
% POSSIBILITY OF SUCH DAMAGE.
%%--------------------------------------------------------------------------------------------

function IMR = image2polar(IM,xCenter,yCenter,ROT,rrange,rbin,thetabin,INTERP)
% Transform Image Matrix from (Left-Right,Top-Down) Coordinate to (Radius,Degree) Coordinate

if nargin <4
    ROT = 'counterclockwise';
    rrange = [];
    rbin = 1;
    thetabin = pi/180/4;
    INTERP = 'nearest';
elseif nargin <5
    rrange = [];
    rbin = 1;
    thetabin = pi/180/4;
    INTERP = 'nearest';
elseif nargin <7
    rbin = 1;
    thetabin = pi/180/4;
    INTERP = 'nearest';
elseif nargin <8
    INTERP = 'nearest';
end

if strcmp(ROT,'clockwise')
    rot = -1;
else
    rot = 1;
end

IMC = tformarray(IM, maketform('affine',[1 0 0; 0 1 0;...
                     max( 0, size(IM,2)-yCenter*2),...
                     max( 0, size(IM,1)-xCenter*2)...
                     1]),...
                 makeresampler(INTERP, 'fill'), [1 2], [1 2],...
                 [round(max( yCenter, size(IM,2)-yCenter)*2) round(max( xCenter, size(IM,1)-xCenter)*2)], [], 0);

rmin = 0;
rmax = ceil(max([size(IM,1)-xCenter,size(IM,2)-yCenter,xCenter,yCenter]));
i = 1; j = 1;
if length(rrange) == 2
    rmin = rrange(1);
    rmax = rrange(2);
end
for r = rmin+rbin/2:rbin:rmax
    for theta = thetabin/2:thetabin:2*pi-thetabin/2
        [x,y] = pol2cart(theta*rot,r);
        if (round(yCenter-y)>0)&(round(yCenter-y)<=size(IM,1))&...
           (round(xCenter+x)>0)&(round(xCenter+x)<=size(IM,2))
            IMR(i,j,:) = IM(round(yCenter-y),round(xCenter+x),:);
        else
            IMR(i,j,:) = zeros(1,1,size(IM,3));
        end
        j = j+1;
    end
    j = 1;
    i = i+1;
end



end

Contact us