使用Qmake在树莓派上开发Opencv程序

Qt 安装

PC 端  下载安装即可 https://mirrors.ustc.edu.cn/qtproject/official_releases/qt

树莓派: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的链接库和头文件目录
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt SOURCES += main.cpp INCLUDEPATH += /usr/include \
INCLUDEPATH += /usr/include/opencv # debug LIBS += -L/usr/lib \
-lopencv_calib3d \
-lopencv_contrib \
-lopencv_core \
-lopencv_features2d \
-lopencv_flann \
-lopencv_gpu \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_legacy \
-lopencv_ml \
-lopencv_objdetect \
-lopencv_video include(deployment.pri)
qtcAddDeployment()

测试程序  

#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main(int argc, char **argv)
{
Mat im = imread(argv[1]);
Mat gray;
cvtColor(im, gray, CV_RGB2GRAY);
imwrite ("gray.jpg",gray);
return 0;
}

  

qmake Rpi.pro

使用Qmake在树莓派上开发Opencv程序

make

使用Qmake在树莓派上开发Opencv程序

使用Qmake在树莓派上开发Opencv程序

使用Qmake在树莓派上开发Opencv程序

使用Qmake在树莓派上开发Opencv程序

多出了gray.jpg这幅图像。

成功

上一篇:Hadoop单机版安装,配置,运行


下一篇:搭建Pypi转发服务