I have 2 grid pattern images.
image1: reference image
image2: sensed image
I want to find the translation and rotation between these 2 images such that the overlap area is maximizing.
I believe this question is related to image registration and I followed the example from this website
https://www.sicara.ai/blog/2019-07-16-image-registration-deep-learning
but the result is not satisfactory
Here is my code
import numpy as np
import cv2
img1 = cv2.imread('image1.png', cv2.IMREAD_GRAYSCALE)
img2 = cv2.imread('image2.png', cv2.IMREAD_GRAYSCALE)
akaze = cv2.AKAZE_create()
kp1, des1 = akaze.detectAndCompute(img1, None)
kp2, des2 = akaze.detectAndCompute(img2, None)
bf = cv2.BFMatcher()
matches = bf.knnMatch(des1, des2, k=2)
good_matches = []
for m, n in matches:
if m.distance < 0.75*n.distance:
good_matches.append([m])
output = cv2.drawMatchesKnn(img1, kp1, img2, kp2, good_matches, None, flags=cv2.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)
cv2.imwrite('output.png', output)
Here is the output output.png
Any ideas or suggestions would be great, thank you!