搞了一天。才发现opencv2.0、2.1、2.2的安装各不相同。我下载的是2.2然后网上搜索跟着做,一直都找不到configure等文件最后才发现版本之间的不同。
【1】首先需安装接下来这些更新
The package you will need can be installed using the following commands (on Debian Lenny):
apt-get install build-essential
apt-get install cmake
apt-get install pkg-config
apt-get install libpng12-0 libpng12-dev libpng++-dev libpng3
apt-get install libpnglite-dev libpngwriter0-dev libpngwriter0c2
apt-get install zlib1g-dbg zlib1g zlib1g-dev
apt-get install libjasper-dev libjasper-runtime libjasper1
apt-get install pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools
apt-get install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-prog
apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev
apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev
apt-get install libxine1-ffmpeg libxine-dev libxine1-bin
apt-get install libunicap2 libunicap2-dev
apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils
apt-get install swig
apt-get install libv4l-0 libv4l-dev
apt-get install python-numpy
apt-get install libpython2.6 python-dev python2.6-dev #You must install this for python support
Please note : all those packages are not needed. CMAKE will show you what you have installed. You may also want to install some other package, like gtk+ 2.X (for GUI) : in this case, refer to the InstallGuide
最好写个shell脚本,直接粘帖所有会出错。
【2】
cmake <你OpenCV文件存放的文件夹>
然后直接make
【3】
/openCV/samples/cpp# g++ `pkg-config opencv --libs --cflags opencv` drawing.cpp -o drawing
这时候你就可通过编译,但还不能执行会提示链接库有问题
./drawing: error while loading shared libraries: libopencv_core.so.2.2: cannot open shared object file: No such file or directory
执行 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
./drawing
ok!
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。