center_get.cpp
877 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include "./center_get.h"
#include <unistd.h>
#include "../opcv_Interface.h"
#include <iostream>
#include "version_choose.h"
#if ALLWINNER_CEDAR == VERSION_SWITCH_ON
#include "../opencv2/opencv.hpp"
extern "C" {
//using namespace cv;
static int center_get_num = 0;
int center_GetY(unsigned char* frame_data, int width, int height)
{
// cv::Mat frame(height + height / 2, width, CV_8UC1, const_cast<unsigned char*>(frame_data));
// cv::cvtColor(frame, frame, cv::COLOR_YUV2BGR_NV21); // 转换为BGR格式
// int y = get_center_y(frame);
// // 保存帧为图像文件
// // center_get_num++;
// // if (center_get_num%5==0)
// // {
// // std::string filename = "/root/sdcard/frame" + std::to_string(center_get_num) + ".jpg";
// // cv::imwrite(filename, frame);
// // }
// return y;
}
}
#endif