Question

I am quite newbie on vlfeat library for computer vision and I have problems dealing with it. What i am trying to do is using the Histograms of Oriented Gradients (HOG) as feature vectors to classify in LIBSVM images with different dimensions.

The first issue i am dealing is the fact that vl_hog returns me a HOG matrix, not a vector. This is not a real issue because I can vectorize this matrix as it follows:

            hog = vl_hog(image,cellSize); 
            features=hog(:);

The second problem is what's freaking me out. Because the images have different dimensions, the feature vectors also have different dimensions, so it's impossible to feed libsvm with them, or i'm wrong? can I solve this in an easier way? did i miss something?

Was it helpful?

Solution

You need to create a global representation of your local features so that you can feed your data to SVMs. One of the most popular approaches for this task is bag-of-words(features). vlfeat has an excellent demo/example for this. You can check this code from vlfeat website.

For your particular case, you need arrange your training/testing data in Caltech-101 like data directories:

  • Letter 1
    • Image 1
    • Image 2
    • Image 3
    • Image 4
    • ...
  • Letter 2
    • ...
  • Letter 3
    • ...

Then you need to adjust following configuration settings for your case:

conf.numTrain = 15 ;

conf.numTest = 15 ;

conf.numClasses = 102 ;

This demo uses SIFT as local features, but you can change it to HOG afterwards.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top