1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Speed up a image alignment function using FFT

  1. Jun 30, 2009 #1

    CNX

    User Avatar

    1. The problem statement, all variables and given/known data

    I need to speed up a image alignment function using FFT

    2. Relevant equations

    FFT, correlation coefficient (for deciding best alignment)

    3. The attempt at a solution

    This function works but a fail to see how it is any better that a naive evaluation of the correlation coefficient.

    Code (Text):

    function [a, b] = Align(f, g)

        [h, w] = size(f);
       
        a = 0;
        b = 0;
        cmax = 0;
       
        G = fft2(g);
        G = conj(G);
       
        for j=1:h-1
            for k=1:w-1
                fs = circshift(f, [j,k]);
                F = fft2(fs);

                c = sum(F(:).*G(:));
               
                if c > cmax
                    cmax = c;
                    a = j;
                    b = k;
                end
            end
        end
       
        return
       
     
     
  2. jcsd
  3. Jul 6, 2009 #2
    Re: Fft

    i thought fft was fast fourier transform
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Speed up a image alignment function using FFT
Loading...