"Bounding" possible homography (findHomography)
I wonder if you know a way to efficiently bound the possible homography given by findHomography().
To simplify the question, just imagine that a camera is in front of a wall with many posters and I need to find a specific poster. So the main variation between the flat model and the poster on the wall is the perspective distortion form the camera for objects on the side and maybe that the camera is a little unstable (robot, head-mounted à la gopro, etc.) so again the perspective would change a little bit but not that much.
Right now, for testing and dev purpose I use rectangular objects like the posters of the previous example. I apply the perspectiveTransform() function to find the position of the four corners of the detected object. It allows me to display the outlines. Then, with some mumbo-jumbo code, I check if the angle between the lines is within a range (say 70 to 110 deg). This allow me to bound the possible homography but this is more a patch than a solution.
Actually, maybe using the homography is not necessary at all. In then end, what I need is to find the location of the poster. I use the homography because it takes all the pruned matches and, with RANSAC, only keeps the inliers (outliers will be present because there are relatively similar posters on the wall) and indirectly shows the location of the keypoints that are really part of the model image. To me, showing the outlines of the found poster is only an (albeit useful) diagnostic tool. So, as a bonus, if someone knows an alternate (and fast, this is real-time after all) method to extract the location of the object from a vector of DMatch, I am open to suggestions!