Detecting a water bottle in video stream C++

asked 2015-03-04 16:18:59 -0500

luketheduke gravatar image

updated 2015-03-04 16:24:04 -0500

Hi All, I am doing a robotics competition and I need to figure out how to locate a standard water bottle in a video stream and give the location of it on the screen. I have some code for shape detection but it hasn't located the bottles when I feed it an image of it. The bottle is exactly the same as this one, 19.9 fl oz absopure brand Here Any ideas or thoughts are appreciated.

Thanks, L

edit retag flag offensive close merge delete



I think a keypoints feature detector is what you need, have a look in this official tutorial of opencv

theodore gravatar imagetheodore ( 2015-03-04 16:41:48 -0500 )edit

I got the example to work but it is not zeroing in on the object. Of the 50 odd points it find only 10 or so are on the 2 bottles. Is this normal?

luketheduke gravatar imageluketheduke ( 2015-03-04 18:39:29 -0500 )edit

How do you use the feature detection? Most examples assume flat objects so how did you integrate the radius of the bottle?

FooBar gravatar imageFooBar ( 2015-03-05 04:19:48 -0500 )edit

I didn't. I tried feeding it various 2d images of the same brand water bottle to no avail. Of all of my tests with different parts of the bottle to match, less than 10% of the matching points landed on the bottle and less than 2% on the same location of the bottle. I am still trying to figure out how to recognize it. Due to the schedule for this project, any and all ideas or thought, especially answers, are appreciated. Also could could I use a depth image from a Kinect to isolate the objects as they are the nearest things in the foreground.

luketheduke gravatar imageluketheduke ( 2015-03-05 14:27:01 -0500 )edit

Initial feature detector combined with something like a TLD tracker could do the trick for you. You will need to test several features to see which sort yields the best results on your object. Since you know the exact object, using model based classifiers is overkill since you don't have enough object class variation. You could go for an initial shape based template matching to find a possible location.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-06 02:45:16 -0500 )edit