Igor Dalavechia
Igor Dalavechia

Reputation: 29

If I resize an image to find keypoints descriptors, should I somehow adapt my matrix before passing it into warpAffine with the original-sized image?

So, I'm working with SuperGlue, and if I resize my image, I start getting poor results, as one would expect. I wanted to know if I need to take any steps before applying my M matrix to warpAffine. I'm working with a large image, approximately 5k x 3k.

img0 = cv2.imread(img0)
img1 = cv2.imread(img1)
image0 = cv2.resize(img0, (1080, 720))
image1 = cv2.resize(img1, (1080, 720))
inp0 = image2tensor(image0, device)
inp1 = image2tensor(image1, device)

M, status = cv2.estimateAffinePartial2D(np.float32(mkpts0),
                               np.float32(mkpts1), cv2.RANSAC)

result = cv2.warpAffine(img0, M, (img1.shape[1],img1.shape[0]),cv2.INTER_NEAREST_EXACT)

Upvotes: 0

Views: 39

Answers (0)

Related Questions