95 lines
2.4 KiB
C++
95 lines
2.4 KiB
C++
#ifndef _ATK_YOLOV5_OBJECT_RECOGNIZE_H
|
|
#define _ATK_YOLOV5_OBJECT_RECOGNIZE_H
|
|
|
|
#include <getopt.h>
|
|
#include <math.h>
|
|
#include <pthread.h>
|
|
#include <signal.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <malloc.h>
|
|
#include <dlfcn.h>
|
|
#include <curl/curl.h>
|
|
|
|
#define _BASETSD_H
|
|
|
|
#include "im2d.h"
|
|
#include "rga.h"
|
|
#include "drm_func.h"
|
|
#include "rga_func.h"
|
|
#include "rknn_api.h"
|
|
#include "rkmedia_api.h"
|
|
#include "rkmedia_venc.h"
|
|
#include "sample_common.h"
|
|
#include "opencv2/opencv.hpp"
|
|
|
|
#include "librtsp/rtsp_demo.h"
|
|
#include "rk_aiq_user_api_sysctl.h"
|
|
#include "rk_aiq_user_api_afec.h"
|
|
// #include "rk_aiq_uapi_afec_int.h"
|
|
|
|
#include <opencv2/core.hpp>
|
|
#include <opencv2/imgproc.hpp>
|
|
#include "opencv2/imgcodecs.hpp"
|
|
|
|
using namespace cv;
|
|
|
|
|
|
|
|
RK_U32 video_width = 1920;
|
|
RK_U32 video_height = 1072;
|
|
// RK_U32 video_height = 720;
|
|
int disp_width = 720;
|
|
int disp_height = 1280;
|
|
|
|
static bool quit = false;
|
|
rtsp_demo_handle g_rtsplive = NULL;
|
|
static rtsp_session_handle g_rtsp_session;
|
|
|
|
int rgb24_resize(unsigned char *input_rgb, unsigned char *output_rgb, int width,int height, int outwidth, int outheight);
|
|
|
|
static unsigned char *load_model(const char *filename, int *model_size);
|
|
|
|
static void printRKNNTensor(rknn_tensor_attr *attr);
|
|
|
|
void *rkmedia_rknn_thread(void *args);
|
|
void *venc_rtsp_tidp(void *args);
|
|
void *upload_message(void *args); //上传检测信息与截取的图片
|
|
void *upload_message_controller(void *args);
|
|
void *heart_beat(void *args); //上传心跳检测
|
|
void *distortion(void *args); //矫正
|
|
void *read_serial_thread(void *args); //读取串口传来的红外温度数据
|
|
|
|
struct Alarm {
|
|
int ifalarm;
|
|
int ifwarn;
|
|
std::string alarmMsg;
|
|
std::string alarmType;
|
|
std::string alarmBase64;
|
|
std::string alarmCoverage;
|
|
float alarmprop;
|
|
};
|
|
|
|
void initializeAlarm(Alarm* Alarm) {
|
|
// 初始化结构体成员
|
|
Alarm->ifalarm = 0;
|
|
Alarm->ifwarn = 0;
|
|
Alarm->alarmMsg = "无";
|
|
Alarm->alarmType = "无";
|
|
Alarm->alarmBase64 = "无";
|
|
Alarm->alarmCoverage = "无";
|
|
Alarm->alarmprop = 0.0;
|
|
}
|
|
|
|
void NV12ToRGB(int width, int height, unsigned char* nv12, Mat& rgb) {
|
|
// Step 1: Create a cv::Mat object for NV12 data
|
|
Mat nv12Mat(height + height / 2, width, CV_8UC1, nv12);
|
|
|
|
// Step 2: Convert NV12 to RGB
|
|
cvtColor(nv12Mat, rgb, COLOR_YUV2RGB_NV12);
|
|
}
|
|
|
|
#endif |