4
votes

In matlab I have this function

 function psi = encodeImage(encoder, im)

This function takes

  • im which is list of names of images

  • encoder which is bovw.mat I have this file as encoder

This function does bag of visual words encoding and returns the spatial histograms of images.

I use this histograms for training in SVM classifier.

I am doing this task in python and I don't want to implement the bag of visual words encoding as my main task is to implement SVM. Is there a built in function in python that does bag of visual words encoding and returns spatial histograms so I can train SVM classifier on histograms.

1
Have a look at this https://stackguides.com/questions/13628670/how-can-i-work-with-my-own-dataset-in-scikit-learn-for-computer-vision - Riyaz

1 Answers

-1
votes

Are you doing something similar to this?

http://www.robots.ox.ac.uk/~vgg/practicals/category-recognition/index.html

There is a computer vision library called Vlfeat. It's Matlab version is in active development state. However there exists a Python interface as well. Supports all major image processing features:

  • Scale-Invariant Feature Transform (SIFT)

  • Dense SIFT (DSIFT)

  • Integer k-means (IKM)

  • Hierarchical Integer k-means (HIKM)

  • Maximally Stable Extremal Regions (MSER)

  • Quick shift image segmentation

I am not sure whether Pyvlfeat will be sufficient or not. In fact, I was trying to do the same. Couldn't figure out. If it works, awesome, mention the trick in comment. If you have figured out some other method, please mention that too.