Today I successed in porting the Deep Matching algorithm & tools from LEAR to Ubuntu. The algorithm itself is a stand-of-art solution to mutipal questions concerning image matching, comes with a easy-understanding code. However the author did not mention the dependency request of tools he used, and the system file structure of Fedora differs a lot from Ubuntu/Debian, hence the compile&install takes me quite a long time.

First to first, using

1
apt-get
to fix dependency. Take a look into
1
Makefile
, we have (although the default
1
make
method does not call this)

1
STATICLAPACKLDFLAGS=-static -static-libstdc++ /usr/lib64/libjpeg.a /usr/lib64/libpng.a /usr/lib64/libz.a /usr/lib64/libblas.a /usr/lib/gcc/x86_64-redhat-linux/4.7.2/libgfortran.a  # statically linked version

Which briefly declares the dependecy. In the following codes I’m omitting

1
sudo
, however most steps should be executed as root.

1
2
3
apt-get install libjepg-dev
apt-get install libpng-dev
apt-get install libatlas-base-dev libatlas-dev

The following commands should add the corresponding

1
.h
file to search path. It’s just the beginning: Ubuntu itself includes
1
libjpeg
,
1
libpng
and some other tools the program uses in its kernel include path, hence a fix is taken to link such libaries to
1
/usr/lib/

1
2
3
4
5
6
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.a /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libpng.a /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libz.a /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib

Now we’ve dealt with

1
libjpeg
,
1
libpng
and
1
libz
. The part of
1
atlas
is a little unusal since the program uses machine-optimized version. We have to manually install
1
atlas
. Notice the following name of folder maynot be the same as others since the version of
1
atlas
at the time I try is 3.10.1.

1
2
3
4
5
6
sudo apt-get source atlas
cd atlas-3.10.1
sudo fakeroot debian/rules custom
cd ..
sudo dpkg -i libatlas3-base_3.10.1-4+custom1_amd64.deb
sudo dpkg -i libatlas3gf-base_3.10.1-4+custom1_all.deb

Now return to

1
Makefile
, we have some last modify here. The dynamic link may work now, only to change
1
libptf77blas.so
to
1
libptfblas.so
if you don’t have
1
libptf77blas.so
under
1
/usr/lib
.

However when I tried on another computer, such method fails in loading

1
jpeglib.h
. A more steady way can be used by calling the static link method:

In

1
STATICLAPACKLDFLAGS
, Change all
1
usr/lib64/
to
1
usr/lib/
, and change
1
x86_64-redhat-linux
in the last argument to something like
1
/x86_64-linux-gnu
which is the folder name occurs in
1
/usr/lib
. Finally change
1
all: deepmatching
to
1
all: deepmatching-static
.

Now call the static-link method by

1
make
. Happy deep-matching.