Need Help Regarding Log-Map of Images
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear Every one!
I have to simulate image log-polar Mapping, I also have seen some sample programs on file exchange .also the logsample
If i go for coordinate conversions using the Transform expressions(formula) i get the theta and r. But I cant figure out how to plot the value at f(x,y) at (r,Theta) coordinates as they are in floating type .
if i go the reverse way from polar to Cartesian when i convert back i still don't get Real Numbers
Please help me out i have to take this simulation to FPGA ,Working in RAW (using lesser Matlab function) is required
1 Kommentar
Walter Roberson
am 2 Jul. 2013
polar plots require that the radius start from 0 at the center of the plot, but log of the radius would be log of 0 which would be -infinity. log polar therefore requires infinite plots, which is seldom practical.
Akzeptierte Antwort
Alex Taylor
am 2 Jul. 2013
Bearbeitet: Alex Taylor
am 2 Jul. 2013
The following link is a good starting point for an example of a log-polar image resampler in MATLAB. You appear to have already come across it.
It uses the rings/wedges rule to ensure that neighboring pixels are consistently spaced as you move out radially. As you point out, the function forces you to choose a non-zero minimum radius from the center where you will begin sampling. This is practically necessary when defining a log-polar resampler to avoid log(r) from tending toward -Inf.
I don't understand the problem you are describing with plotting floating point numbers. The default datatype in MATLAB is double precision floating point, and the MATLAB plot function is very happy to accept doubles. Are you trying to do something like this?
a = imread('example.tif');
a = rgb2gray(a);
xc = 0.5 + size(a,2)/2;
yc = 0.5 + size(a,1)/2;
nr = min(size(a,2),size(a,1));
rmin = 0.1;
rmax = min(xc,yc);
nw = -2*pi*(nr-1) / log(rmin/rmax);
rmin = 0.1;
rmax = min([xc-0.5,yc-0.5]);
logRho = linspace(log(rmin),log(rmax),nr);
rho = exp(logRho);
deltaTheta = 2*pi / nw;
theta = linspace(0,2*pi-deltaTheta,nw);
[rho,theta] = meshgrid(rho,theta);
[X,Y] = pol2cart(theta,rho);
X = X+xc;
Y = Y+yc;
figure, imagesc(a); colormap gray; hold on
plot(X,Y,'.');
logPolarImage = interp2(double(a),X,Y);
figure, imagesc(logPolarImage); colormap gray
0 Kommentare
Weitere Antworten (1)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!