garbage opencv key codes

This commit is contained in:
Joseph Redmon 2017-04-17 17:18:08 -07:00
parent e501a09e06
commit 9726f1e89c
3 changed files with 13 additions and 9 deletions

View File

@ -693,7 +693,7 @@ void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *fi
image im = load_image_color(input, 0, 0);
image r = resize_min(im, size);
resize_network(&net, r.w, r.h);
printf("%d %d\n", r.w, r.h);
//printf("%d %d\n", r.w, r.h);
float *X = r.data;
time=clock();

View File

@ -182,7 +182,7 @@ void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const ch
if(!prefix){
show_image(disp, "Demo");
int c = cvWaitKey(1);
printf("%d\n", c);
if (c != -1) c = c%256;
if (c == 10){
if(frame_skip == 0) frame_skip = 60;
else if(frame_skip == 4) frame_skip = 0;
@ -190,14 +190,14 @@ void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const ch
else frame_skip = 0;
} else if (c == 27) {
return;
} else if (c == 65362) {
} else if (c == 82) {
demo_thresh += .02;
} else if (c == 65364) {
} else if (c == 84) {
demo_thresh -= .02;
if(demo_thresh <= .02) demo_thresh = .02;
} else if (c == 65363) {
} else if (c == 83) {
demo_hier += .02;
} else if (c == 65361) {
} else if (c == 81) {
demo_hier -= .02;
if(demo_hier <= .0) demo_hier = .0;
}

View File

@ -580,7 +580,7 @@ void validate_detector_recall(char *cfgfile, char *weightfile)
}
}
void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh, char *outfile)
void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh, char *outfile, int fullscreen)
{
list *options = read_data_cfg(datacfg);
char *name_list = option_find_str(options, "names", "data/names.list");
@ -633,8 +633,12 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
}
else{
save_image(im, "predictions");
show_image(im, "predictions");
#ifdef OPENCV
cvNamedWindow("predictions", CV_WINDOW_NORMAL);
if(fullscreen){
cvSetWindowProperty("predictions", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
}
show_image(im, "predictions");
cvWaitKey(0);
cvDestroyAllWindows();
#endif
@ -693,7 +697,7 @@ void run_detector(int argc, char **argv)
char *cfg = argv[4];
char *weights = (argc > 5) ? argv[5] : 0;
char *filename = (argc > 6) ? argv[6]: 0;
if(0==strcmp(argv[2], "test")) test_detector(datacfg, cfg, weights, filename, thresh, hier_thresh, outfile);
if(0==strcmp(argv[2], "test")) test_detector(datacfg, cfg, weights, filename, thresh, hier_thresh, outfile, fullscreen);
else if(0==strcmp(argv[2], "train")) train_detector(datacfg, cfg, weights, gpus, ngpus, clear);
else if(0==strcmp(argv[2], "valid")) validate_detector(datacfg, cfg, weights, outfile);
else if(0==strcmp(argv[2], "valid2")) validate_detector_flip(datacfg, cfg, weights, outfile);