分享一个最简单的方法
安装好opencv后,我先在电脑实现了opencv与arduino的通信,现在写的是通过串口与arduino,若是想用其他通信,只需根据通信协议,按照数据发送接收格式改一下即可。
#include "windows.h"
#include <conio.h>
#include <tchar.h>
#include <opencv\highgui.h>
#include <opencv\cv.h>
#include <iostream>
#include <fstream>
#include "cv.h"
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
using namespace std;
using namespace cv;
using namespace std;
//声明全局变量
Mat src; Mat src_gray;
int thresh=10;
int max_thresh=255;
RNG rng(12345);
int n=0;
int m=0;
size_t i=0;
void thresh_callback(int,void*);
void _tmain(int argc);
string intToString(int number){
std::stringstream ss;
ss << number;
return ss.str();
}
void thresh_callback(int a,void*)
{
Mat canny_output;
vecto