Phase Correlation Function in OpenCV
Phase Correlation is a method to check the similarity of two images with equal size. It can be used for template matching, object tracking, motion estimation, etc.
To perform phase correlation, follow these steps:
- Load two images, f and g
- Perform FFT on each image, resulting in F and G
- Obtain the cross power spectrum using this formula:

where
is the complex conjugate of G.
- Obtain the phase correlation by performing IFFT on R
The result is a 2D array with each element has a value between 0 to 1. The location of the highest value corresponds with the object translation movement from image 1 to image 2.
Here are some results I've got when computing phase correlation:
| # | Image 1 | Image 2 | Result |
| 1. |
|
(Image 2 is identical |
Max. value = 1.0 in (0,0) |
| 2. |
|
(image 1 with some noise) |
Max. value = 0.2729 in (0,0) |
| 3. |
|
(object moved 6 pixels to |
Max. value = 0.6344 in (6,15) |
Keywords: phase only correlation, phase correlation, poc, phase correlation in opencv, phase correlation examples
Share:
Save to del.icio.us
Digg this!







Add your comment