Figure out scale and rotation of template image based on matched keypoints

asked 2019-07-30 13:40:09 -0500

eric_engineer gravatar image

I was able to use ORB matching to match my template image in my camera feed. Then I was able to extract the matching keypoints in both the feed and the template. Now I really want to find what would be the center of my template image but in my camera feed. I was thinking if I could figure out how to rotate, then scale the template image to fit the matched keypoints then I would know where the center was.

Does anyone have any advice on how to do something like that?

Thank you.

edit retag flag offensive close merge delete


you're probably already very close.

can you look at the homography tutorial ?

(it sounds like you already have the 1st half going, and all you need is the part from "//-- Localize the object" down)

berak gravatar imageberak ( 2019-07-30 15:14:25 -0500 )edit

Yes :) I have been pouring over that for the last two hours. I'm curious if this section in the tutorial has the queryIdx and trainIdx swapped? When I try this way I always get an array out of bounds error, but swapping them is fine.

        //-- Get the keypoints from the good matches
eric_engineer gravatar imageeric_engineer ( 2019-07-30 16:08:17 -0500 )edit

Finally got it to work thanks for the tips.

eric_engineer gravatar imageeric_engineer ( 2019-07-31 11:40:41 -0500 )edit