树莓派+qt+opencv

树莓派:Qt开发套件和opencv安装
sudo apt-get install qt4-dev-tools libqt4-dev 不用qt core 的话,其实只要按照 qt4-qmake就行了(只做 pro 文件生成makefile文件,我们目的也仅仅如此) sudo apt-get install qt4-qmake sudo apt-get install libopencv-dev
PC上开发好后考到树莓派上,修改pro的链接库和头文件目录
 1 TEMPLATE = app
 2 CONFIG += console
 3 CONFIG -= app_bundle
 4 CONFIG -= qt
 5  
 6 SOURCES += main.cpp
 7  
 8 INCLUDEPATH += /usr/include \
 9 INCLUDEPATH += /usr/include/opencv
10  
11 # debug
12  
13 LIBS += -L/usr/lib \
14     -lopencv_calib3d \
15     -lopencv_contrib \
16     -lopencv_core \
17     -lopencv_features2d \
18     -lopencv_flann \
19     -lopencv_gpu \
20     -lopencv_highgui \
21     -lopencv_imgproc \
22     -lopencv_legacy \
23     -lopencv_ml \
24     -lopencv_objdetect \
25     -lopencv_video
26  
27  
28 include(deployment.pri)
29 qtcAddDeployment()
测试程序
 1 #include <iostream>
 2 #include <opencv2/opencv.hpp>
 3 using namespace std;
 4 using namespace cv;
 5 int main(int argc, char **argv)
 6 {
 7     Mat im = imread(argv[1]);
 8     Mat gray;
 9     cvtColor(im, gray, CV_RGB2GRAY);
10     imwrite ("gray.jpg",gray);
11     return 0;
12 }
结果截图

qmake Rpi.pro

树莓派+qt+opencv_第1张图片

make

树莓派+qt+opencv_第2张图片

树莓派+qt+opencv_第3张图片

多出了gray.jpg这幅图像。
成功
 
 
 
 
 

你可能感兴趣的:(树莓派+qt+opencv)