#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <getopt.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <signal.h>
#include <asm/types.h>
#include <linux/videodev2.h>
#include <time.h>
#include <linux/fb.h>
#include <linux/input.h>
#include <pthread.h>
#include <opencv2/opencv.hpp>
struct buffer {
void *start;
size_t length;
};
struct size {
int width;
int height;
};
struct options_t {
char *devpath;
int video_width;
int video_height;
//int video_format;
int debug;
int x;
int y;
int screen_width;
int screen_height;
int zorder;
int layer;
int interval_time;
int fps;
};
static struct options_t option = {
.devpath = "/dev/video4",
.video_width = 720,
.video_height = 576,
//.video_format = DISP_FORMAT_YUV420_SP_VUVU,
.debug = 1,
.x = 0,
.y = 0,
.screen_width = 720,//511,//400,
.screen_height = 576,//299,//576,
.zorder = 2,
.layer = 0,
.interval_time = 66,
//.fps = 30,
.fps =25,
};
static struct size disp_size;
static int fd;
static struct buffer *buffers = NULL;
static int nbuffers = 0;
//写入framebuffer fbp:帧缓冲首地址 fbfd:帧缓冲fd img_buf:采集到的图片首地址 width:用户的宽 height:用户的高 bits:帧缓冲的位深
//初始化framebuffer
using namespace cv;
typedef unsigned char uint_8;
//rgb结构
typedef struct {
uint_8 r; // 红色分量
uint_8 g; // 绿色分量
uint_8 b; // 蓝色分量
uint_8 rgbReserved; // 保留字节(用作Alpha通道或忽略)
} rgb32;
//帧缓冲中的rgb结构
typedef struct {
uint_8 b; // 蓝色分量
uint_8 g; // 绿色分量
uint_8 r; // 红色分量
uint_8 rgbReserved; // 保留字节(用作Alpha通道或忽略)
} rgb32_frame;
struct info
{
int Frame_fd;
int screensi
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <getopt.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <signal.h>
#include <asm/types.h>
#include <linux/videodev2.h>
#include <time.h>
#include <linux/fb.h>
#include <linux/input.h>
#include <pthread.h>
#include <opencv2/opencv.hpp>
struct buffer {
void *start;
size_t length;
};
struct size {
int width;
int height;
};
struct options_t {
char *devpath;
int video_width;
int video_height;
//int video_format;
int debug;
int x;
int y;
int screen_width;
int screen_height;
int zorder;
int layer;
int interval_time;
int fps;
};
static struct options_t option = {
.devpath = "/dev/video4",
.video_width = 720,
.video_height = 576,
//.video_format = DISP_FORMAT_YUV420_SP_VUVU,
.debug = 1,
.x = 0,
.y = 0,
.screen_width = 720,//511,//400,
.screen_height = 576,//299,//576,
.zorder = 2,
.layer = 0,
.interval_time = 66,
//.fps = 30,
.fps =25,
};
static struct size disp_size;
static int fd;
static struct buffer *buffers = NULL;
static int nbuffers = 0;
//写入framebuffer fbp:帧缓冲首地址 fbfd:帧缓冲fd img_buf:采集到的图片首地址 width:用户的宽 height:用户的高 bits:帧缓冲的位深
//初始化framebuffer
using namespace cv;
typedef unsigned char uint_8;
//rgb结构
typedef struct {
uint_8 r; // 红色分量
uint_8 g; // 绿色分量
uint_8 b; // 蓝色分量
uint_8 rgbReserved; // 保留字节(用作Alpha通道或忽略)
} rgb32;
//帧缓冲中的rgb结构
typedef struct {
uint_8 b; // 蓝色分量
uint_8 g; // 绿色分量
uint_8 r; // 红色分量
uint_8 rgbReserved; // 保留字节(用作Alpha通道或忽略)
} rgb32_frame;
struct info
{
int Frame_fd;
int screensi