Wed 22 August 2012

Using SURFmex with Octave

Posted by ankur in Tech (243 words, approximately a 1 minute read)

This isn't so much as for others as it's a "note to self".

I've recently begun actual work at my research course. Obviously, I prefer to use Octave to Matlab. Here's how to use the SURFmex toolkit for Matlab with Octave:

Download the source and unzip it someplace. You can get rid of the mexw{32,64} directories, since they're binaries for Windoz.

Create a folder called mex, just to keep all our output mex files together.

Install the opencv-devel package. On fedora:

$ su -c 'yum install opencv-devel'

Then, compile the cpp files into mex files:

$ mkoctfile-3.6.2 --mex -v `pkg-config --libs --cflags opencv` surfpoints.cpp
$ mkoctfile-3.6.2 --mex -v `pkg-config --libs --cflags opencv` surfmatch.cpp
# Move them to your mex folder:
$ mv *.mex mex/ -v

You should now have two mex files generated:

[ankur@ankur SURFmex-v2(master *%)]$ cd mex/
[ankur@ankur mex(master *%)]$ ll
total 484
rwxrwxr-x. 1 ankur ankur 219400 Aug 22 11:20 surfmatch.mex
rwxrwxr-x. 1 ankur ankur 273339 Aug 22 11:20 surfpoints.mex

That's pretty much it. All the hints were in the make.m file really.

To run one of the examples:

Copy an image to the examples folder and name it peppers.png. This appears to be one of the default images that matlab provides.

$ cd examples/
octave> addpath ../mex  % add the mex files to path
octave> addpath ../common  % add the common functions to the path
octave> path % check your path
octave> small_example

Your screenshot won't look like this. I've modified the example a little to use different images.

SURFmex example image