Is it possible to compare and match the keypoints and descriptors of an image (that we have already calculated) with a video that is running in the real time?

asked 2016-02-03 09:51:44 -0500

sunnyhith gravatar image

It is an object recognition project that I'm working on. I want to compare the keypoints and descriptors of a base image that i already have in the background, with a video that will be running in real time. So that, when there is a match, I can say that the object is found in the video, by enclosing the object in a rectangle and displaying the name of that object in one corner. Need this information real bad. Please do reply. :)

edit retag flag offensive close merge delete

Comments

Yes.

That's not too useful, so I'll ask what you have and haven't tried?

Have you tried finding the keypoints and descriptors from each frame, finding matches, and, if enough are found, drawing the rectangle? That would seem to be the obvious step.

Tetragramm gravatar imageTetragramm ( 2016-02-03 18:42:55 -0500 )edit

Thanks a lot for replying! Actually, I'm just in the initial stages of my project. Whatever I said was just the approach which I planned to follow. I'm still going through the documentation of OpenCV. I have seen how SURF and SIFT work. But I am not sure if they would fit the output which I have in my mind. Could you please tell me if this is possible - I will just point my webcam towards an object, and the algorithm should identify which object it is and display the name of that object on one corner of the rectangle. Thanks again! :)

sunnyhith gravatar imagesunnyhith ( 2016-02-04 08:43:58 -0500 )edit

What you want is almost certainly in the features2d and xfeatures2d modules. Take a look at the descriptor matchers and the bag of words trainers.

Take a look and decide which meets your requirements. It's certainly possible, although you may need to take steps to make real-time. But first start with getting it to work on static pictures, then extend to video, then work to speed it up.

Tetragramm gravatar imageTetragramm ( 2016-02-04 16:23:30 -0500 )edit

Hey Tetragramm! Thanks for replying and I'm sorry for this late reply. I started to work on my project. I am using OpenCV 3.0 configured to Visual Studio 2013. I am stuck in finding keypoints and descriptors of static images. Because SurfFeatureDetector, SurfDescriptorExtractor and BruteForceMatcher are unidentified and also the header file that used to include these identifiers, #include opencv2/nonfree/features2d.hpp is not there in version 3.0. Is there any other way of finding the keypoints and descriptors? If yes, please do share it. Thanks! :)

sunnyhith gravatar imagesunnyhith ( 2016-03-06 06:00:11 -0500 )edit

Well, BruteForceMatcher should be there, but it's been renamed to BFMatcher.

SURF is under copyright by the creator, so if you want to use that, you have to get it from them. You can use ORB instead, which is in some ways better than SURF. From THIS page, your choices are AKAZE, BRISK, KAZE, and ORB. There are other types in the xfeatures2d module, but ORB is your most likely choice to begin with.

Tetragramm gravatar imageTetragramm ( 2016-03-06 09:59:38 -0500 )edit

Cool! I am thinking of going with ORB and BFMatcher. Thanks again for the info! :) Will get back if anything pops up! :)

sunnyhith gravatar imagesunnyhith ( 2016-03-08 07:15:37 -0500 )edit

Hi Tetragramm. Could you help me with this - I'm using C++ language for the project. I'm stuck in using ORB with BFMatcher. Detection and Extraction of descriptors of a single image is done. But when I am trying to detect and extract descriptors from two or more images and tried to use BFMatcher, I'm not getting the right idea on how to use ORB with BFMatcher. There are plenty of examples of SURF and SIFT with matching techniques but none with ORB.

Could you please provide with some sort of sample code implementing ORB with BFMatcher?

sunnyhith gravatar imagesunnyhith ( 2016-04-10 08:44:19 -0500 )edit

The only thing you should need to change is switching the Norm Type to NORM_HAMMING2.

Take a look HERE and you can see someone using ORB and the FlannMatcher. And HERE is one that actually does use the BFMatcher.

Tetragramm gravatar imageTetragramm ( 2016-04-10 09:06:07 -0500 )edit

Thanks again! Will look into it! :)

sunnyhith gravatar imagesunnyhith ( 2016-04-12 11:57:30 -0500 )edit

Hey Tetragramm. So I'm in the part of finding matches between the frames in ongoing video and the images that I have in the background. Finding the keypoints and descriptors is done for the frames in video. Problem arises in how to store the keypoints and descriptors of images in the background. So my question is - 1. Does OpenCV provide support for databases (so that I can store the relevant info of the background images and perform matches)? If so, how can I link my program to the database to send and retrieve data? 2. Is there any alternative way to find the keypoints and descriptors from each frame and find matches with that of background images, instead of using a database?

Thank you! :)

sunnyhith gravatar imagesunnyhith ( 2016-04-15 09:04:55 -0500 )edit