Generalized Hough Transform Generalized Hough Transform Correlation In order to match a part of a model to a whole, we can use correlation to find the optimal aligning transformation: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation For each translation, compute the correlation between the target and the translated query: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation For each translation, compute the correlation between the target and the translated query: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation For each translation, compute the correlation between the target and the translated query: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation For each translation, compute the correlation between the target and the translated query: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation For each translation, compute the correlation between the target and the translated query: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation For each translation, compute the correlation between the target and the translated query: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation For each translation, compute the correlation between the target and the translated query: f ,T (g ) f (x )g T (x ) dx Generalized Hough Transform Correlation Complexity for binary nxn grids with O(n) non-zero points: – Brute Force: O(n4) – for each of O(n2) translations, compute the O(n2) dot product. Generalized Hough Transform Correlation Complexity for binary nxn grids with O(n) non-zero points: – Brute Force: O(n4) – for each of O(n2) translations, compute the O(n2) dot product. – Fast Integration: O(n3) – for each of O(n2) translations, compute the O(n) dot product. Generalized Hough Transform Correlation Complexity for binary nxn grids with O(n) non-zero points: – Brute Force: O(n4) – for each of O(n2) translations, compute the O(n2) dot product. – Fast Integration: O(n3) – for each of O(n2) translations, compute the O(n) dot product. – Fourier: O(n2 logn) – compute the FFT, multiply frequency components, compute the IFFT. Generalized Hough Transform Correlation as Voting The value of the correlation at the point (x0,y0) is: Corr (f , g , x 0 , y 0 ) f (x , y )g (x x 0 , y y 0 )dx dy This can be understood in two ways: – g(x-x0,y-y0) is the function g(x,y) translated by (x0,y0) – g(x-x0,y-y0) is the function g(x0,y0) translated by (x,y) and flipped about the origin Generalized Hough Transform Correlation as Voting Corr (f , g , x 0 , y 0 ) f (x , y )g (x x 0 , y y 0 )dx dy In the second approach, we treat the pixels as bins and for every possible translation (x,y), we: – – – – Translate g by (x,y) Flip g Scale by the value f(x,y) Update the values of all the bins by the values of the transformed g. Generalized Hough Transform Correlation as Voting Generalized Hough Transform Correlation Complexity for binary nxn grids with O(n) non-zero points: – Brute Force: O(n4) – for each of O(n2) translations, compute the O(n2) dot product. – Fast Integration: O(n3) – for each of O(n2) translations, compute the O(n) dot product. – Fourier: O(n2 logn) – compute the FFT, multiply frequency components, compute the IFFT. – Fast Voting: O(n2) – for each of O(n) points on the boundary, cast O(n) votes. Generalized Hough Transform Key Idea When we compute the correlation by voting, we spend most of the time casting bad votes. Use extra shape information (e.g. gradients) to cast fewer votes: – O(n) complexity: For each of O(n) points on the boundary, cast O(1) votes.