下载2.0版本,解压
编译过程:
cd OpenCV-2.0.0/
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/opt/opencv -D BUILD_PYTHON_SUPPORT=ON ..
配置:
在.bashrc中:
export LD_LIBRARY_PATH=/opt/opencv/lib/:$LD_LIBRARY_PATH
不然会出现类似:error while loading shared libraries: libcxcore.so.2.0: cannot open shared object file: No such file or directory
这样的错误。
编译命令:
gcc -o output source.c -I/opt/opencv/include/opencv -I/opt/opencv/include -L/opt/opencv/lib/ -lcxcore -lcv -lcvaux -lhighgui -lml
这样在包含头文件的时候就需要#include <opencv/header.h>
至此就可以正常编译运行了。
reference:
安装:
http://opencv.willowgarage.com/wiki/InstallGuide
运行时错误:
http://smsoftdev-solutions.blogspot.com/2009/06/opencv-shared-libraries-error.html
wiki: