
Using this diagram as a guide, create a function that takes in the image at a band f(x,y) and a keystone distorted version of that image g(x,y) and calculates the cross phase spectrum R(w_x, w_y) and the phase correlation r(x,y).
Once you have r(x,y), see if you can plot r(x,y) as a heatmap.
We will review this on Thursday at 5pm over discord
Insights:
- Maximum Value in 'r':
- The point with the maximum value in 'r' represents the location in the cross-phase correlation result where the phases of the two images x1 and x3 are most similar.
- In other words, it indicates the position in the 'r' array where the phase patterns of x1 and x3 align the best.
- This maximum value signifies the highest degree of similarity between the two images in terms of their phase information.
- Calculating X-Shift:
- The x-shift is the horizontal (left-right) displacement required to align the two images optimally based on their phase correlation.
- We calculate this x-shift by finding the column index of the maximum value in 'r' using
max_col
.
- The center of the image is assumed to be the reference point with no shift. So, we calculate the difference between
max_col
and the center of the image, which is r.shape[1] // 2
. This difference represents how many pixels the second image (x3) needs to be shifted horizontally to align with the first image (x1).
Heatmap and x-shift function is done too. Here is an example heatmap:
.png)