Log-polar coordinates have several interesting properties::..
First, when optical flow is computed as the camera moves along the optical axis (as is common in robotics), the optical flow vectors are radial from the image center. However, in log-polar coordinates, the flow vectors are vertical. This can make the detection of moving objects more efficient computationally.
Second, the log polar transform converts an image to a form that is rotation and scale invariant. This can be very helpful for object detection. Finally, the log-polar transform emulates how images appear on the back of the human retina. (The brain then transforms the image to the Cartesian-like way we perceive it.)
In Matlab (http://www.mathworks.com/matlabcentral/newsreader/view_thread/108599):
function [pim,zoff] = PolarTransform(img,zcenter,rs,thetas)
% function [pim,zoff] = PolarTransform(img,zcenter,rs,thetas)
% extract the polar transform of a section of img
% polar transform origin at zcenter(x+iy)
% rs(pixels),thetas(radians) are sets of radii and angles to sample
% if they are scalars, then the radii are 1:r
% and thetas is taken to be dtheta in
% thetas = linspace(0, 2*pi , round(2*pi/dtheta) ); thetas =
thetas(1:end-1)
% zoff are the coordinates of the sample points in the original image
(x+iy)
% REA 4/15-6/1/05
if isscalar(rs)
rs = 1:round(rs);
end
if isscalar(thetas)
thetas = linspace(0, 2*pi , round(2*pi/thetas) );
thetas = thetas(1: (end-1) );
end
[thetas_img,rs_img] = meshgrid(thetas,rs);
[xs,ys] = pol2cart(thetas_img,rs_img);
% offset the x,y coords to the appropriate location
zoff = complex(xs,ys) + zcenter;
% and extract the image data
pim = interp2(img,real(zoff),imag(zoff),'nearest');
Furthermore:
Cartesian Coordinate System Conversion
cart2pol | Transform Cartesian coordinates to polar or cylindrical |
cart2sph | Transform Cartesian coordinates to spherical |
pol2cart | Transform polar or cylindrical coordinates to Cartesian |
sph2cart | Transform spherical coordinates to Cartesian |
Log-polar is how the images appear in V1, not the retina.
ReplyDelete