因为囊中羞涩,所以想把手机转换成摄像头和屏幕作为嵌入式的数据采集模块和终端显示界面;
首先PC端需要安装opencv,自行百度~~~
Android 手机需要安装APP链接:https://pan.baidu.com/s/1sGyTYv5AJkCDBjMpi8nL8A 密码:ymfp
然后首先在嵌入式端尝试链接局域网的手机监控摄像头的画面;
之后在进行c++代码编写;
#include<opencv2/core/core.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<iostream>
#include<string>
using namespace std;
using namespace cv;
int main ()
{
VideoCapture capture("http://admin:admin@IP Address:port");
if(!capture.isOpened())
return -1;
Mat edges;
while(1)
{
Mat frame;
capture>>frame;//从相机读取新一帧
cvtColor(frame,edges,CV_BGR2GRAY);//变为灰度图
blur(edges,edges,Size(3,3));//均值滤波降噪
Canny(edges,edges, 5 , 38 , 3);//canny算子
imshow("被canny后的视频", edges);//显示
waitKey(30);
}
return 0;
}
然后进行g++编译;
g++ `pkg-config opencv --cflags` b.cpp -o b `pkg-config opencv --libs`
然后手机摄像头的画面将映射在嵌入式终端的画面上~
标签:17,Python,frame,嵌入式,opencv,edges,include,摄像头 From: https://blog.51cto.com/u_12504263/5719119