I want to track an object(for example, a moving ball) in a video. Referring to opencv tutorial - 'Features2D + Homography to find a known object', I have been able to track my object in a still image by providing a reference image. I plan to use a reference image to detect the moving object from the first frame of input video. For the next frame the object detected in previous frame should act as a reference image and so on.
But I don't know how to find back an object from its descriptor. An image having several objects in it will have several keypoints, but how to find whick keypoint or bunch of keypoints belong to which object in an image.
Supose you have a picture of your object (reference image) and you detect features and extract keypoints. In order to use homography transformation from 2D image to 3D coordinates in the scene, your object should be planar.
Now, you have to process frames, extracting keypoints from the scene. What will allow you to detect the object is the matching of the keypoints in the reference image with the keypoints in the scene.
Your object is detected, but if you you want to know its 3D position, you have to use findHomography() with the matched pairs (it will use four matches from the whole set).
So the key is the matching. Start by reading this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With