Quantcast
Channel: solem's vision blog
Viewing all articles
Browse latest Browse all 31

Another Python Interface for SIFT

$
0
0
I previously wrote about using David Lowe's SIFT code from Python here. There is a good open source alternative for those on Windows or Mac OS (Lowe's binaries are Linux only) called VLFeat. The library is written in c but has a command line interface that we can use much in the same way.

To install VLFeat, download and unpack the latest binary package from the download page (currently the latest version is 0.9.9). Add the paths to your environment or copy the binaries to a directory in your path. The binaries are in the bin/ directory, just pick the sub-directory for your platform. The use of the VLFeat command line binaries is described in the src/ sub-directory. Alternatively you can find the documentation online.

I wrote a similar Python interface as the one I had for Lowe's code. You can download it here (vlfeat.py).

Try it out like this:

from PIL import Image
from pylab import *

process_image('box.pgm','tmp.sift')
l,d = read_features_from_file('tmp.sift')

im = array(Image.open('box.pgm'))
figure()
plot_features(im,l,True)

process_image('scene.pgm','tmp2.sift')
l2,d2 = read_features_from_file('tmp2.sift')
im2 = array(Image.open('scene.pgm'))

m = match_twosided(d,d2)
figure()
plot_matches(im,im2,l,l2,m)

show()

The result looks like this.




For those who want more control, there is also the option of using the Python wrapper I wrote about before.

Viewing all articles
Browse latest Browse all 31

Trending Articles