How to create custom descriptor to use with Bag of words?

asked 2015-03-11 10:31:32 -0500

PaoloPoli gravatar image

Hi, is it possible to create a custom descriptor from features compiled with own feature extractor (not SIFT,SURF...) to use with a Bag of words and SVM implementation in OpenCV? So how to set up the Mat descriptor? Thanks in advance.

edit retag flag offensive close merge delete



you will have to initialize the BOWImgDescriptorExtractor with FeatureExtractor / Matcher interfaces.

if you can supply that, and your features ae suitable (non-binary!) - why not ?

berak gravatar imageberak ( 2015-03-11 10:44:30 -0500 )edit

Sure, I have a set of features computed with a "Dense trajectory" algorithm but I don't know how to properly set up the "const Mat& descriptors" to be passed to the functions.

PaoloPoli gravatar imagePaoloPoli ( 2015-03-11 10:56:21 -0500 )edit

show, what you've got so far !

berak gravatar imageberak ( 2015-03-11 11:09:02 -0500 )edit

I'm using the "Dense trajectory" algorithm shown here The features are computed one by one, and each one in a single line, with the following format: frameNum mean_x mean_y var_x var_y length scale x_pos y_pos t_pos Trajectory HOG HOF MBHx MBHy You can see more details at "The format of the computed features" paragraph in the above link. I need to create a Mat descriptor with these features.

PaoloPoli gravatar imagePaoloPoli ( 2015-03-11 11:23:03 -0500 )edit

creating a Mat from the numbers will be quite simple.

again, unfortunately, opencv's BOW classes require you to implement a DescriptorExtractor interface.

i'm not sure, if your data/control flow matches the assumptions here.

berak gravatar imageberak ( 2015-03-12 02:33:32 -0500 )edit

I am struggling with the same problem here... berak please can you specify the assumptions you are talking about... ( Is it about having no separate vector representing keypoints? ) PaoloPoli please update what you've got so far!

Bhatt gravatar imageBhatt ( 2015-07-12 09:35:12 -0500 )edit

@Bhatt , again, opecv's BOW clases are tailored for SIFT or SURF feature descriptors.

berak gravatar imageberak ( 2015-07-12 10:07:52 -0500 )edit

Hi all,

I'm facing exactly the same problem PaoloPoli. I'm able to create a Mat with all the data and to make the vocabulary with this data, but no way to create the DescriptorExtractor.

Could anyone "iluminate" us.

Thanks in advance

P.D. Wich structure is necesary to create the DescriptorExtractor interface?


ErCmos gravatar imageErCmos ( 2016-02-23 12:29:05 -0500 )edit