01.linux下搭建opencv并在qt中使用
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
linux下搭建opencv并在qt中使用
作者:vmezr
由于最近要着手做pcduino上的视频聊天的项目,从未接触过pcduino,经过讨论决定使用qt来实现。其实qt和opencv 我都没有接触过,也打算趁机学习一下。言归正传,首先得搭建好需要的环境,第一步是安装配置opencv,然后在qt中使用opencv的库。
(opencv的安装方法部分参考雷雨同鞋哒~)
首先,在官网/中下载opencv原码,选择linux版本进行下载。
以opencv2.4.8为例:(我用的是opencv2.4.13)
1.将压缩包解压到/usr/local/
2.直接使用sudo apt-get install cmake下载并安装cmake
3.为了方便后续摄像头捕捉等功能还需要下载opencv依赖的一些包:
apt-cache search opencv
使用此命令可以直接查到需要下载的依赖包
leo@leo-virtual-machine:/usr/local/opencv/release$ apt-cache search opencv
libcv-dev - Translation package for libcv-dev
libcv2.3 - computer vision library - libcv* translation package
libcvaux-dev - Translation package for libcvaux-dev
libcvaux2.3 - computer vision library - libcvaux translation package
libhighgui-dev - Translation package for libhighgui-dev
libhighgui2.3 - computer vision library - libhighgui translation package
libopencv-calib3d-dev - development files for libopencv-calib3d
libopencv-calib3d2.3 - computer vision Camera Calibration library
libopencv-contrib-dev - development files for libopencv-contrib
libopencv-contrib2.3 - computer vision contrib library
libopencv-core-dev - development files for libopencv-core
libopencv-core2.3 - computer vision core library
libopencv-dev - development files for opencv
libopencv-features2d-dev - development files for libopencv-features2d
libopencv-features2d2.3 - computer vision Feature Detection and Descriptor Extraction library libopencv-flann-dev - development files for libopencv-flann
libopencv-flann2.3 - computer vision Clustering and Search in Multi-Dimensional spaces library libopencv-gpu-dev - development files for libopencv-gpu
libopencv-gpu2.3 - computer vision GPU Processing library
libopencv-highgui-dev - development files for libopencv-highgui
libopencv-highgui2.3 - computer vision High-level GUI and Media I/O library
libopencv-imgproc-dev - development files for libopencv-imgproc
libopencv-imgproc2.3 - computer vision Image Processing library
libopencv-legacy-dev - development files for libopencv-legacy
libopencv-legacy2.3 - computer vision legacy library
libopencv-ml-dev - development files for libopencv-ml
libopencv-ml2.3 - computer vision Machine Learning library
libopencv-objdetect-dev - development files for libopencv-objdetect
libopencv-objdetect2.3 - computer vision Object Detection library
libopencv-video-dev - development files for libopencv-video
libopencv-video2.3 - computer vision Video analysis library
opencv-doc - OpenCV documentation and examples
python-opencv - Python bindings for the computer vision library
4.安装上述所依赖的包(sudo apt-get install xxx就ok)
5.接着就要编译opencv的原码并安装:
执行以下命令:
sudo mv opencv-2.4.8 opencv
cd opencv
mkdir release
cd release
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_TBB=ON -D BUILD_opencv_python2=ON -D