Prev: delete more equal rows
Next: Sparse Neural Networks
From: Jack Andrews on 27 Mar 2010 21:01 Hello, Can somebody please help with the above please. My Function starts like this: function [x y peak] = poc(OrImage, RefImage) % fourier transform both images fi = fftshift(OrImage); fr = fftshift(RefImage); % perform phase correlation (amplitude is normalized) fc = fi .* conj(fr); fcn = fc ./ abs(fc); ...................... end; In the above x,y denote the peak location in the phase only domain where peak shows the value at this location. Basically, the function reads in two images, original and the captured one. Finally calculates POC and display the value using mesh(). I am not sure as how to get the peak in the correlation plane. Please Advice. Thanks in Advance
From: ImageAnalyst on 27 Mar 2010 21:10 Jack Andrews: Are you aware that fftshift() DOES NOT Fourier transform the image?
From: Jack Andrews on 27 Mar 2010 21:20 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <04b58921-0df1-43f7-b830-3c28e1099a92(a)z4g2000yqa.googlegroups.com>... > Jack Andrews: > Are you aware that fftshift() DOES NOT Fourier transform the image? Oops! Thanks for the reply. It should be like this function [x y peak] = poc(OrImage, RefImage) % fourier transform both images fi = fft2(OrImage); fr = fft2(RefImage); % perform phase correlation (amplitude is normalized) fc = fi .* conj(fr); fcn = fc ./ abs(fc); ...................... end;
From: Sean on 28 Mar 2010 00:56 "Jack Andrews" <krehsi01(a)qub.ac.uk> wrote in message <homas9$7iq$1(a)fred.mathworks.com>... > ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <04b58921-0df1-43f7-b830-3c28e1099a92(a)z4g2000yqa.googlegroups.com>... > > Jack Andrews: > > Are you aware that fftshift() DOES NOT Fourier transform the image? > > Oops! Thanks for the reply. > It should be like this > > function [x y peak] = poc(OrImage, RefImage) > > % fourier transform both images > fi = fft2(OrImage); > fr = fft2(RefImage); > > % perform phase correlation (amplitude is normalized) > fc = fi .* conj(fr); > fcn = fc ./ abs(fc); > >>peak_correlation_matrix = ifft2(fcn); >>[peak, idx] = max(abs(peak_correlation_matrix)); >>[row col] = ind2sub(size(peak_correlation_matrix),idx) %If you want the peak correlation value it'll be 'peak', if you want the whole correlation matrix it'll be peak_correlation_matrix. > > end;
From: Jack Andrews on 28 Mar 2010 06:53
"Sean " <sean.dewolski(a)Idontwantspam.umit.maine.edu> wrote in message <homnh4$ln$1(a)fred.mathworks.com>... > "Jack Andrews" <krehsi01(a)qub.ac.uk> wrote in message <homas9$7iq$1(a)fred.mathworks.com>... > > ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <04b58921-0df1-43f7-b830-3c28e1099a92(a)z4g2000yqa.googlegroups.com>... > > > Jack Andrews: > > > Are you aware that fftshift() DOES NOT Fourier transform the image? > > > > Oops! Thanks for the reply. > > It should be like this > > > > function [x y peak] = poc(OrImage, RefImage) > > > > % fourier transform both images > > fi = fft2(OrImage); > > fr = fft2(RefImage); > > > > % perform phase correlation (amplitude is normalized) > > fc = fi .* conj(fr); > > fcn = fc ./ abs(fc); > > > > > >>peak_correlation_matrix = ifft2(fcn); > >>[peak, idx] = max(abs(peak_correlation_matrix)); > >>[row col] = ind2sub(size(peak_correlation_matrix),idx) > %If you want the peak correlation value it'll be 'peak', if you want the whole correlation matrix it'll be peak_correlation_matrix. > > > > > end; Sean, function [x y peak] = pruebapoc1(im1, im2) % fourier transform both images fi = fft2(im1); fr = fft2(im2); % perform phase correlation (amplitude is normalized) fc = fi .* conj(fr); fcn = fc ./ abs(fc); %c = real(ifft2(fcn)); peak_correlation_matrix = real(ifft2(fcn)); [peak, idx] = max(abs(peak_correlation_matrix)); [x y] = ind2sub(size(peak_correlation_matrix),idx); end Will it be like this? |