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

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 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

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.

( 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 ^^

( 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 ! ;)

( 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 ..

( 2015-08-01 01:37:08 -0500 )edit

( 2015-08-01 01:56:34 -0500 )edit