Tuesday, March 08, 2005

How I Installed OpenCV

Thought I would start things off by recounting my installation experience. I'm running a pretty much default installation of Fedora Core 3 (I did install all the development packages, as well as gtk+2). I downloaded the Linux tar.gz from Sourceforge into my home directory and then from a shell did:

tar -xzf opencv-0.9.6.tar.gz
cd opencv-0.9.6
./configure
make
su -
make install
exit (to get out of root)

This all completed without any real trouble, and things looked good. Problem was, after this step I couldn't compile any opencv programs. One method for compiling an OpenCV program test.c is to type:

gcc test.c -o test `pkg-config --libs opencv --cflags opencv`

When I did this, pkg-config reported that it couldn't find opencv and that perhaps I should add opencv.pc to the PKG_CONFIG_PATH environment variable. I instead decided to add /usr/local/lib (the location of opencv.pc) to my /etc/ld.so.conf file and then run ldconfig (as root) to rebuild the links. You can check to see if everything is working by typing the following at the shell:

pkg-config --libs opencv --cflags opencv

which in my case returned:

-I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux

If you get this far, chances are you have everything you need to compile an opencv program except the source code.

0 Comments:

Post a Comment

<< Home