fix bug.
This commit is contained in:
@@ -5,14 +5,64 @@
|
||||
#ifndef _OPTIONS_H_
|
||||
#define _OPTIONS_H_
|
||||
|
||||
extern bool show_armor_box;
|
||||
extern bool show_armor_boxes;
|
||||
extern bool show_light_blobs;
|
||||
extern bool show_origin;
|
||||
extern bool save_labelled;
|
||||
extern bool run_with_camera;
|
||||
extern bool save_video;
|
||||
extern bool collect_data;
|
||||
#ifdef FIX_OPTIONS
|
||||
#ifdef SHOW_ARMOR_BOX
|
||||
#define show_armor_box true
|
||||
#else
|
||||
#define show_armor_box false
|
||||
#endif
|
||||
|
||||
#ifdef SHOW_ARMOR_BOXES
|
||||
#define show_armor_boxes true
|
||||
#else
|
||||
#define show_armor_boxes false
|
||||
#endif
|
||||
|
||||
#ifdef SHOW_LIGHT_BLOBS
|
||||
#define show_light_blobs true
|
||||
#else
|
||||
#define show_light_blobs false
|
||||
#endif
|
||||
|
||||
#ifdef SHOW_ORIGIN
|
||||
#define show_origin true
|
||||
#else
|
||||
#define show_origin false
|
||||
#endif
|
||||
|
||||
#ifdef SAVE_LABELLED
|
||||
#define save_labelled true
|
||||
#else
|
||||
#define save_labelled false
|
||||
#endif
|
||||
|
||||
#ifdef RUN_WITH_CAMERA
|
||||
#define run_with_camera true
|
||||
#else
|
||||
#define run_with_camera false
|
||||
#endif
|
||||
|
||||
#ifdef SAVE_VIDEO
|
||||
#define save_video true
|
||||
#else
|
||||
#define save_video false
|
||||
#endif
|
||||
|
||||
#ifdef COLLECT_DATA
|
||||
#define collect_data true
|
||||
#else
|
||||
#define collect_data false
|
||||
#endif
|
||||
#else /* FIX_OPTIONS */
|
||||
extern bool show_armor_box;
|
||||
extern bool show_armor_boxes;
|
||||
extern bool show_light_blobs;
|
||||
extern bool show_origin;
|
||||
extern bool save_labelled;
|
||||
extern bool run_with_camera;
|
||||
extern bool save_video;
|
||||
extern bool collect_data;
|
||||
#endif /* FIX_OPTIONS */
|
||||
|
||||
void process_options(int argc, char *argv[]);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ stop:
|
||||
CameraGetExposureTime(h_camera, &t);
|
||||
LOGM("Exposure time: %lfms", t/1000.0);
|
||||
// 模拟增益4
|
||||
CameraSetAnalogGain(h_camera, 55);
|
||||
CameraSetAnalogGain(h_camera, 60);
|
||||
// 使用预设LUT表
|
||||
CameraSetLutMode(h_camera, LUTMODE_PRESET);
|
||||
// 抗频闪
|
||||
|
||||
@@ -35,6 +35,8 @@ void save_video_file(cv::Mat &src){
|
||||
|
||||
#define SAVE_DIR "/home/sjturm/Desktop/labelled/"
|
||||
|
||||
bool save_label_error_flag = false;
|
||||
|
||||
int get_labelled_cnt(){
|
||||
FILE *fp = fopen(SAVE_DIR"info.txt", "r");
|
||||
int cnt=0;
|
||||
@@ -50,18 +52,20 @@ void save_labelled_cnt(int cnt){
|
||||
}
|
||||
|
||||
void save_labelled_image(cv::Mat &src, cv::Rect2d box){
|
||||
static int cnt=get_labelled_cnt();
|
||||
char name[50];
|
||||
sprintf(name, SAVE_DIR"%d.jpg", cnt);
|
||||
cv::imwrite(name, src);
|
||||
sprintf(name, SAVE_DIR"%d.txt", cnt);
|
||||
FILE *fp = fopen(name, "w");
|
||||
if(fp == NULL){
|
||||
LOGW("Can't create file: %s!\nStop saving!", name);
|
||||
save_labelled = false;
|
||||
return;
|
||||
if(!save_label_error_flag) {
|
||||
static int cnt = get_labelled_cnt();
|
||||
char name[50];
|
||||
sprintf(name, SAVE_DIR"%d.jpg", cnt);
|
||||
cv::imwrite(name, src);
|
||||
sprintf(name, SAVE_DIR"%d.txt", cnt);
|
||||
FILE *fp = fopen(name, "w");
|
||||
if (fp == NULL) {
|
||||
LOGW("Can't create file: %s!\nStop saving!", name);
|
||||
save_label_error_flag = true;
|
||||
return;
|
||||
}
|
||||
fprintf(fp, "%lf %lf %lf %lf\n", box.x, box.y, box.width, box.height);
|
||||
fclose(fp);
|
||||
save_labelled_cnt(cnt);
|
||||
}
|
||||
fprintf(fp, "%lf %lf %lf %lf\n", box.x, box.y, box.width, box.height);
|
||||
fclose(fp);
|
||||
save_labelled_cnt(cnt);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <log.h>
|
||||
#include <cstring>
|
||||
|
||||
#ifndef FIX_OPTIONS
|
||||
bool show_armor_box = false;
|
||||
bool show_armor_boxes = false;
|
||||
bool show_light_blobs = false;
|
||||
@@ -66,3 +67,6 @@ void process_options(int argc, char *argv[]){
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void process_options(int argc, char *argv[]){};
|
||||
#endif /* FIX_OPTIONS */
|
||||
|
||||
Reference in New Issue
Block a user