#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
#define MAX_KERNEL_LENTH (19)
#define MEAN_THRESH_VAL (1) //平均阈值
int fd;
int fps = 100; //帧率
char buf[1024] = "temp text";
Mat org_image, blurred_image, binary_image, edge_image;
//串口设置
int setupSerial()
{
struct termios toptions;
//打开串口
fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY);
printf("fd opened as %i\n", fd);
//等待Arduino启动
usleep(150000);
//获得当前串口设置
tcgetattr(fd, &toptions);
//设置波特率
cfsetispeed(&toptions, B9600);
智能小车项目源码
最新推荐文章于 2024-05-18 21:25:06 发布