Homography estimation when feature matching fails
Hi all,
I'm pretty new to openCV and CV in general. I want to align images of football pitches to a basic template of the pitch. I've managed to find a reasonable way of processing the full pitch images to leave me with pretty much just the pitch markings and I now have what appears to be a fairly straightforward registration problem.
I can't get it to work. I've tried orb and akaze feature matching but it doesn't work at all. Both pick up good features (mostly the curved portions like the centre circle and the D) but the matching is awful. I was using brute force matching with Hamming distance and then selecting say the top 10% of matches to estimate the homography.
What's the best approach here? I was thinking I could use a hough transform to find the centre circle in each image and match those, but the full centre circle won't always be in the target image.
Here are two example images:
Pitch template:
Processed image to align:
why does it fail ? don't make it so. most 2d features expect gradients and won't work on binary images. (ill-fated preprocessing)
to a naive human, not a machine.
all feature2d algorithms have to look at the pixel neighbourhood of a keypoint. look at your images -- it's all zero
Thanks for taking a look! No other way using ellipse/line detection? Or a regression approach where I try to minimise the l1 norm between the images or something? Feels like there must be algorithms for registering binary images...
you probably could even mark the 4 points for the transformation manually.
I can, but I need to do this for quite a few frames so I need something automatic really. I wouldn't mind manually selecting points for the first frame and then using a sensible way to update the homography matrix from frame to frame, maybe some sort of small-motion regularisation? I don't know the names of these algorithms or how to do them in opencv, but they must be pretty common right? I just don't want to end up writing my own code to do something I can do more computationally efficiently in 1 or two lines of opencv...