Phase correlation
Phase correlation is an approach to estimate the relative translative offset between two similar images (digital image correlation) or other data sets. It is commonly used in image registration and relies on a frequency-domain representation of the data, usually calculated by fast Fourier transforms. The term is applied particularly to a subset of cross-correlation techniques that isolate the phase information from the Fourier-space representation of the cross-correlogram.
Example
The following image demonstrates the usage of phase correlation to determine relative translative movement between two images corrupted by independent Gaussian noise. The image was translated by (30,33) pixels. Accordingly, one can clearly see a peak in the phase-correlation representation at approximately (30,33).
Method
Given two input images [math]\displaystyle{ \ g_a }[/math] and [math]\displaystyle{ \ g_b }[/math]:
Apply a window function (e.g., a Hamming window) on both images to reduce edge effects (this may be optional depending on the image characteristics). Then, calculate the discrete 2D Fourier transform of both images.
- [math]\displaystyle{ \ \mathbf{G}_a = \mathcal{F}\{g_a\}, \; \mathbf{G}_b = \mathcal{F}\{g_b\} }[/math]
Calculate the cross-power spectrum by taking the complex conjugate of the second result, multiplying the Fourier transforms together elementwise, and normalizing this product elementwise.
- [math]\displaystyle{ \ R = \frac{ \mathbf{G}_a \circ \mathbf{G}_b^*}{|\mathbf{G}_a \circ \mathbf{G}_b^*|} }[/math]
Where [math]\displaystyle{ \circ }[/math] is the Hadamard product (entry-wise product) and the absolute values are taken entry-wise as well. Written out entry-wise for element index [math]\displaystyle{ (j,k) }[/math]:
- [math]\displaystyle{ \ R_{jk} = \frac{ G_{a,jk} \cdot G_{b,jk}^*}{|G_{a,jk} \cdot G_{b,jk}^* |} }[/math]
Obtain the normalized cross-correlation by applying the inverse Fourier transform.
- [math]\displaystyle{ \ r = \mathcal{F}^{-1}\{R\} }[/math]
Determine the location of the peak in [math]\displaystyle{ \ r }[/math].
- [math]\displaystyle{ \ (\Delta x, \Delta y) = \arg \max_{(x, y)}\{r\} }[/math]
Commonly, interpolation methods are used to estimate the peak location in the cross-correlogram to non-integer values, despite the fact that the data are discrete, and this procedure is often termed 'subpixel registration'. A large variety of subpixel interpolation methods are given in the technical literature. Common peak interpolation methods such as parabolic interpolation have been used, and the OpenCV computer vision package uses a centroid-based method, though these generally have inferior accuracy compared to more sophisticated methods.
Because the Fourier representation of the data has already been computed, it is especially convenient to use the Fourier shift theorem with real-valued (sub-integer) shifts for this purpose, which essentially interpolates using the sinusoidal basis functions of the Fourier transform. An especially popular FT-based estimator is given by Foroosh et al.[1] In this method, the subpixel peak location is approximated by a simple formula involving peak pixel value and the values of its nearest neighbors, where [math]\displaystyle{ r_{(0,0)} }[/math] is the peak value and [math]\displaystyle{ r_{(1,0)} }[/math] is the nearest neighbor in the x direction (assuming, as in most approaches, that the integer shift has already been found and the comparand images differ only by a subpixel shift).
- [math]\displaystyle{ \ \Delta x = \frac{ r_{(1,0)} }{r_{(1,0)} \plusmn r_{(0,0)}} }[/math][clarification needed]
The Foroosh et al. method is quite fast compared to most methods, though it is not always the most accurate. Some methods shift the peak in Fourier space and apply non-linear optimization to maximize the correlogram peak, but these tend to be very slow since they must apply an inverse Fourier transform or its equivalent in the objective function.[2]
It is also possible to infer the peak location from phase characteristics in Fourier space without the inverse transformation, as noted by Stone.[3] These methods usually use a linear least squares (LLS) fit of the phase angles to a planar model. The long latency of the phase angle computation in these methods is a disadvantage, but the speed can sometimes be comparable to the Foroosh et al. method depending on the image size. They often compare favorably in speed to the multiple iterations of extremely slow objective functions in iterative non-linear methods.
Since all subpixel shift computation methods are fundamentally interpolative, the performance of a particular method depends on how well the underlying data conform to the assumptions in the interpolator. This fact also may limit the usefulness of high numerical accuracy in an algorithm, since the uncertainty due to interpolation method choice may be larger than any numerical or approximation error in the particular method.
Subpixel methods are also particularly sensitive to noise in the images, and the utility of a particular algorithm is distinguished not only by its speed and accuracy but its resilience to the particular types of noise in the application.
Rationale
The method is based on the Fourier shift theorem.
Let the two images [math]\displaystyle{ \ g_a }[/math] and [math]\displaystyle{ \ g_b }[/math] be circularly-shifted versions of each other:
- [math]\displaystyle{ \ g_b(x,y) \ \stackrel{\mathrm{def}}{=}\ g_a((x - \Delta x) \bmod M, (y - \Delta y) \bmod N) }[/math]
(where the images are [math]\displaystyle{ \ M \times N }[/math] in size).
Then, the discrete Fourier transforms of the images will be shifted relatively in phase:
- [math]\displaystyle{ \mathbf{G}_b(u,v) = \mathbf{G}_a(u,v) e^{-2 \pi i (\frac{u \Delta x}{M} + \frac{v \Delta y}{N}) } }[/math]
One can then calculate the normalized cross-power spectrum to factor out the phase difference:
- [math]\displaystyle{ \begin{align} R(u,v) &= \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^* |} \\ &= \frac{ \mathbf{G}_a \mathbf{G}_a^* e^{2 \pi i (\frac{u \Delta x}{M} + \frac{v \Delta y}{N}) }}{|\mathbf{G}_a \mathbf{G}_a^* e^{2 \pi i (\frac{u \Delta x}{M} + \frac{v \Delta y}{N}) }|} \\ &= \frac{ \mathbf{G}_a \mathbf{G}_a^* e^{2 \pi i (\frac{u \Delta x}{M} + \frac{v \Delta y}{N}) }}{|\mathbf{G}_a \mathbf{G}_a^*|} \\ &= e^{2 \pi i (\frac{u \Delta x}{M} + \frac{v \Delta y}{N}) } \end{align} }[/math]
since the magnitude of an imaginary exponential always is one, and the phase of [math]\displaystyle{ \ \mathbf{G}_a \mathbf{G}_a^* }[/math] always is zero.
The inverse Fourier transform of a complex exponential is a Dirac delta function, i.e. a single peak:
- [math]\displaystyle{ \ r(x,y) = \delta(x + \Delta x, y + \Delta y) }[/math]
This result could have been obtained by calculating the cross correlation directly. The advantage of this method is that the discrete Fourier transform and its inverse can be performed using the fast Fourier transform, which is much faster than correlation for large images.
Benefits
Unlike many spatial-domain algorithms, the phase correlation method is resilient to noise, occlusions, and other defects typical of medical or satellite images.[4]
The method can be extended to determine rotation and scaling differences between two images by first converting the images to log-polar coordinates. Due to properties of the Fourier transform, the rotation and scaling parameters can be determined in a manner invariant to translation.[5][6]
Limitations
In practice, it is more likely that [math]\displaystyle{ \ g_b }[/math] will be a simple linear shift of [math]\displaystyle{ \ g_a }[/math], rather than a circular shift as required by the explanation above. In such cases, [math]\displaystyle{ \ r }[/math] will not be a simple delta function, which will reduce the performance of the method. In such cases, a window function (such as a Gaussian or Tukey window) should be employed during the Fourier transform to reduce edge effects, or the images should be zero padded so that the edge effects can be ignored. If the images consist of a flat background, with all detail situated away from the edges, then a linear shift will be equivalent to a circular shift, and the above derivation will hold exactly. The peak can be sharpened by using edge or vector correlation.[7]
For periodic images (such as a chessboard or picket fence), phase correlation may yield ambiguous results with several peaks in the resulting output.
Applications
Phase correlation is the preferred method for television standards conversion, as it leaves the fewest artifacts.
See also
General
- Cross correlation
- Scaled Correlation
- Phase retrieval
Television
References
- ↑ H. Foroosh (Shekarforoush), J.B. Zerubia, and M. Berthod, "Extension of Phase Correlation to Subpixel Registration," IEEE Transactions on Image Processing, V. 11, No. 3, Mar. 2002, pp. 188-200.
- ↑ E.g. M. Sjödahl and L.R. Benckert, "Electronic speckle photography: analysis of an algorithm giving the displacement with subpixel accuracy," Appl Opt. 1993 May 1;32(13):2278-84. doi:10.1364/AO.32.002278
- ↑ Harold S. Stone, "A Fast Direct Fourier-Based Algorithm for Subpixel Registration of Images", IEEE Transactions on Geoscience and Remote Sensing, V. 39, No. 10, Oct. 2001, pp.2235-2242
- ↑ S. Nithyanadam, S. Amaresan and N. Mohamed Haris "An Innovative Normalization Process by Phase Correlation Method of Iris Images for the block size of 32*32"
- ↑ E. De Castro and C. Morandi "Registration of Translated and Rotated Images Using Finite Fourier Transforms", IEEE Transactions on Pattern Analysis and Machine Intelligence, Sept. 1987
- ↑ B. S Reddy and B. N. Chatterji, “An FFT-based technique for translation, rotation, and scale-invariant image registration”, IEEE Transactions on Image Processing 5, no. 8 (1996): 1266–1271.
- ↑ Sarvaiya, Jignesh Natvarlal; Patnaik, Suprava; Kothari, Kajal (2012). "Image Registration Using Log Polar Transform and Phase Correlation to Recover Higher Scale". JPRR 7 (1): 90–105. doi:10.13176/11.355.
External links
Original source: https://en.wikipedia.org/wiki/Phase correlation.
Read more |