MATLAB File Help: cv.phaseCorrelate | Index |
Detect translational shifts that occur between two images
pshift = cv.phaseCorrelate(src1, src2)
[pshift,response] = cv.phaseCorrelate(src1, src2)
[...] = cv.phaseCorrelate(..., 'OptionName',optionValue, ...)
single
or
double
).single
or
double
), of same size and type as src1
.[x,y]
The function is used to detect translational shifts that occur between two images.
The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain. It can be used for fast image registration as well as motion estimation. For more information please see http://en.wikipedia.org/wiki/Phase_correlation
Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with cv.getOptimalDFTSize.
The function performs the following equations:
First it applies a Hanning window (see http://en.wikipedia.org/wiki/Hann_function) to each image to remove possible edge effects. This window is cached until the array size changes to speed up processing time.
Next it computes the forward DFTs of each source array:
Ga = F{src1}, Gb = F{src2}
where F
is the forward DFT.
It then computes the cross-power spectrum of each frequency domain array:
R = Ga * Gb^(*) / |Ga * Gb^(*)|
Next the cross-correlation is converted back into the time domain via the inverse DFT:
r = F^(-1){R}
Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to achieve sub-pixel accuracy.
(\Delta{x}, \Delta{y}) = weightedCentroid{argmax_(x,y){r}}
If non-zero, the response parameter is computed as the sum of the elements
of r
within the 5x5 centroid around the peak location. It is normalized
to a maximum of 1 (meaning there is a single peak) and will be smaller
when there are multiple peaks.