what is the result of phase correlation mentioned in wikipedia

2 次查看(过去 30 天)
Any one tried phase correlation for images mentioned in wikipedia? https://en.wikipedia.org/wiki/Phase_correlation
At the site it is given translation of (30,33). I am getting a translation of (24,21). Anybody got same results?

回答(1 个)

Walter Roberson
Walter Roberson 2016-9-23
Difficult to say without seeing your code.
I speculate, though, that you might not know that in MATLAB, the x coordinate corresponds to columns (second index) and the y coordinate corresponds to rows (first index), so you might be indexing into the wrong vectors to determine the values.
But that is just speculation. Maybe you used / where you needed ./ . Maybe you are suffering from integer arithmetic saturation due to the way calculations on uint8 work. Maybe something else. The Magic 8 Ball says "Situation is hazy, try again later"
  2 个评论
aravind S
aravind S 2016-9-23
编辑:aravind S 2016-9-23
Thank you for noticing. Yes,i used./ and converted unit8 to double No,I cant do it later. Have you tried it? Can u try and get me the answer. Here's my code
clear all
clc
imtool close all
close all
im1=imread('E:\Mtech internship\Image processing\image processing 3\frames\4 new 0th.jpg');
im2=imread('E:\Mtech internship\Image processing\image processing 3\frames\4 new 120th.jpg');
im1=rgb2gray(im1);
im2=rgb2gray(im2);
i1=imcrop(im1,[296,264,17,17]);
i2=imcrop(im2,[296,264,17,17]);
ima1=double(i1);
ima2=double(i2);
[Nx, Ny]=size(ima1);
Mx=(Nx-1)/2;
My=(Ny-1)/2;
nx=-Mx:1:Mx;
ny=-My:1:My;
w=hanning(Nx);% applying hanning window
w=w*w';
image1=ima1*w;
image2=ima2*w;
f1=fft2(ima1);
f2=fft2(ima2);
n=f1.*conj(f2);
n1=n./abs(n);
n1(isnan(n1))=1;
h=fspecial('gaussian',[Nx,Ny],1.5);
n1=imfilter(n1,h);
result=ifft2(n1);
result=fftshift(abs(result));
figure;
mesh((-Mx:Mx),(-My:My),real(result));
figure;
plot((-Mx:Mx),(result'));
title('Plot of X- axis');
figure;
plot((-Mx:Mx),(result));
title('Plot of Y- axis');
rmax = max(max(result));
[x , y] = find(result == rmax);
x=x-ceil(Nx/2)
y=y-ceil(Nx/2)
Thanks
Deming Peng
Deming Peng 2020-7-29
编辑:Walter Roberson 2020-8-6
May I ask - what does this part mean after you've got the 'x' and 'y' :
x = x-ceilNx / 2
y = y-ceilNx / 2
And I noticed that the operation of these two lines of codes will always result in 'x=1,y=1'.
I suppose it is because the 'rmax' seems always at the centre of the 'result' matrix, just one pixel bigger than
Nx/2 and Ny/2. So I'm a bit confused about the shift it shows here and hope that we can discuss more on it soon. Thank u!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by