计算速度优化,摄像头读取逻辑改变,分类器更新。

This commit is contained in:
xinyang
2019-07-28 15:59:01 +08:00
parent a5259cbd1f
commit 5a0fdb30af
24 changed files with 17667 additions and 115529 deletions

View File

@@ -6,6 +6,7 @@
#define _ADDITIONS_H_
#include <stdint.h>
#include <sys/time.h>
#include <serial/serial.h>
struct mcu_data{
@@ -30,5 +31,6 @@ void showOrigin(const cv::Mat &gimbal_src, const cv::Mat &chassis_src);
void showOrigin(const cv::Mat &gimbal_src);
void extract(cv::Mat &gimbal_src, cv::Mat &chassis_src);
void extract(cv::Mat &gimbal_src);
double getTimeIntervalms(const timeval& now, const timeval &last);
#endif /* _ADDITIONS_H_ */

View File

@@ -9,11 +9,12 @@
#include <stdio.h>
#include <iostream>
#include <thread>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/imgproc/imgproc.hpp>
#include "camera/wrapper_head.h"
#ifdef Windows
#include "camera/CameraApi.h"
#elif defined(Linux) || defined(Darwin)
@@ -21,10 +22,13 @@
#endif
class CameraWrapper: public WrapperHead {
friend void cameraCallback(CameraHandle hCamera, BYTE *pFrameBuffer, tSdkFrameHead* pFrameHead,PVOID pContext);
private:
const std::string name;
int mode;
bool init_done;
unsigned char* rgb_buffer;
int camera_cnts;
int camera_status;
@@ -38,6 +42,11 @@ private:
IplImage* iplImage;
int channel;
cv::Mat src_queue[2];
volatile int qhead;
volatile int qtail;
std::thread *readThread;
public:
int gain;
@@ -48,6 +57,8 @@ public:
bool read(cv::Mat& src) final;
bool readRaw(cv::Mat& src);
bool readProcessed(cv::Mat& src);
bool readCallback(cv::Mat& src);
bool readWithThread(cv::Mat &src);
bool changeBrightness(int brightness);
// bool once
};

View File

@@ -146,7 +146,7 @@
gettimeofday(&ts, NULL); \
codes; \
gettimeofday(&te, NULL); \
LOGM(tag": %.1lfms", (te.tv_sec-ts.tv_sec)*1000.0+(te.tv_usec-ts.tv_usec)/1000.0); \
LOGM(tag": %.1lfms", ##__VA_ARGS__, (te.tv_sec-ts.tv_sec)*1000.0+(te.tv_usec-ts.tv_usec)/1000.0); \
}while (0)
#else
#warning "Unsupport plantform for CNT_TIME"