ubuntu下opencv和qt的安装配置

opencv的安装配置:下载opencv最新版的zip包文件,然后参考http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html

qt下使用opencv配置:
sudo vim /etc/ld.so.conf.d/opencv.conf,输入/usr/local/lib(因该和opencv的安装位置有关)
sudo vim /etc/bash.bashrc,添加export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

还不行,就在qt project的.pro文件中添加:
INCLUDEPATH += /usr/local/include \
                /usr/local/include/opencv \
                /usr/local/include/opencv2
LIBS += /usr/local/lib/libopencv_highgui.so \
        /usr/local/lib/libopencv_core.so    \
        /usr/local/lib/libopencv_imgproc.so
(若有一些函数编译不通过,可能是libs引用的文件不对,最简单的方法是:
LIBS += /usr/local/lib/libopencv_×.so)

你可能感兴趣的:(linux,ubuntu,qt,opencv)