opencv如何与arduino通信

本文介绍了一个简单的教程,演示了如何在安装好OpenCV后,通过串口实现OpenCV与Arduino之间的通信。内容包括如何进行串口通信,并指出其他通信方式可通过更改数据发送接收格式来实现。
摘要由CSDN通过智能技术生成

分享一个最简单的方法

安装好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
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值