How to combine SURF,color histogram, and Bag of features for svm classifier [closed]

asked 2015-07-31 10:37:36 -0500

ghost43 gravatar image

updated 2015-07-31 23:40:27 -0500

Hi everyone,

I am working on a project and i hope someone could help me. I need to combine Surf and color histogram to use as features for my SVM. Actually, i have to use bag-of-features with SURF and color histogram as image features and linear SVM with the one-vs-rest strategy as a classifier. I can construct Bof by combining the two vectors, but when comes the part of the SVM, i don't know what to do, because, i have to use compute function from the bof, but i think i would not have color information.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by ghost43
close date 2015-08-04 05:50:37.224687

Comments

no clue if it is a good idea to combine a Bof vector and a color histogram, but technically this is no big problem.

    Mat bowfeat;
    bow_extract->compute2(im_gr, kp, bowfeat);

    Mat colorHist;
    colorHistogram(im_col, colorHist);
    colorHist = colorHist.reshape(1,1)); //flat 1d

    Mat final_feature;
    hconcat(bowhist, colorHist, final_feature);

    svmTrainData.push_back(final_feature);

also note, that the length of each feature will act as a weight, i.e, if you got 32 Bof values, and 256 histogram bins, your color feature is 8 times more important, than your Bof features.

berak gravatar imageberak ( 2015-08-01 00:50:02 -0500 )edit

So, first of all, i construct Bof with Surf and color histogram. After that, i used surf to detect keypoints, and use this keypoint for bof compute function, and concat this result with color histogram ? But, if the bof already contains color information, i thought it coul be another way .. or i am wrong, i am newbie so this a little complicated for me ^^

ghost43 gravatar imageghost43 ( 2015-08-01 01:19:08 -0500 )edit
  • "But, if the bof already contains color information" - afaaik, it won't. surf features are gathered from grayscale images

  • "i am newbie so this a little complicated for me" - wow, you're already into fairly complex things . just don't stop being bold now ! ;)

berak gravatar imageberak ( 2015-08-01 01:32:26 -0500 )edit

This is my problem, the paper on which i am working is adopting bag-of-features with SURF and color histogram as image features, don't know how to deal with it, to create the bag of features, i used surf, and colors histogram, and concat their vectors. But, when i am doing the SVM part, for the image classification, i don't know how to use my Bof ..

ghost43 gravatar imageghost43 ( 2015-08-01 01:37:08 -0500 )edit

link to paper ;) ?

berak gravatar imageberak ( 2015-08-01 01:56:34 -0500 )edit

Yes my bad sorry :) , this is the link http://img.cs.uec.ac.jp/pub/conf12/12...

ghost43 gravatar imageghost43 ( 2015-08-01 02:00:10 -0500 )edit

after skimmimg the paper, they seem to do something different (4.1, 4.2) from my idea above, like:

  • make a lot of 64-float features from gridded histograms, and then throw them into the same pot as the SURF features (which are the same size/type) , and then do Bof clustering on that feature 'pool' . unfortunately, this idea won't work with opencv's Bow classes, which are sadly restricted to processing SIFT/SURF features only ;(
berak gravatar imageberak ( 2015-08-01 02:39:48 -0500 )edit

Oww .. oki thank you very much for your help, i will try another algorithm :)

ghost43 gravatar imageghost43 ( 2015-08-01 02:49:58 -0500 )edit