A self-contained python wrapper for vlfeat. It is based on libvl 0.9.9 (and should be adapted to run along with the current vlfeat by some kind person :-) ).
Homebrew gives you boost via
brew install boost.
setup.py should work for both a homebrew based and a
macports based system. I need to run
ARCHFLAGS="-arch x86_64" python setup.py install
for a successful build.
Depending on your system, you may need to change
setup.py. Install boost.python on Ubuntu
aptitude install libboost-python-dev.
Only the vl_sift (and
__init__.py) module was changed a bit. Assuming you
box.pgm in your working directory, then
import numpy, Image, vlfeat box = Image.open("box.pgm") box_array = numpy.array(box) [f, d] = vlfeat.vl_sift(box_array.T, first_octave=-1, verbose=True)
produces nearly identical descriptors (in
bin/sift from vlfeat. Note
- you don't need to specify
dtype=np.float32when providing the
- you need to use
- the first octave is by default 0 (in
bin/siftthis is set to
fare swapped (compared to the binary), the first number refers to row in
box_arrayand the second one to column.
The produced descriptors match those from the binary nearly perfectly (in particular,
the sequence of numbers is the same), sometimes some values are off by 1. I don't
know why that is (
vl_sift_calc_keypoint_descriptor produces two different
descriptors on seemingly identical input). If some has an idea (or, more probable,
I'm doing something stupid here), please let me know.