|
|
|
@ -21,6 +21,8 @@ |
|
|
|
|
#include "opencv2/videoio/videoio_c.h" |
|
|
|
|
#endif |
|
|
|
|
image get_image_from_stream(CvCapture *cap); |
|
|
|
|
image get_image_from_stream_cpp(CvCapture *cap); |
|
|
|
|
#include "http_stream.h" |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
float *get_regression_values(char **labels, int n) |
|
|
|
@ -861,9 +863,12 @@ void threat_classifier(char *datacfg, char *cfgfile, char *weightfile, int cam_i |
|
|
|
|
CvCapture * cap; |
|
|
|
|
|
|
|
|
|
if (filename) { |
|
|
|
|
cap = cvCaptureFromFile(filename); |
|
|
|
|
}else{ |
|
|
|
|
cap = cvCaptureFromCAM(cam_index); |
|
|
|
|
//cap = cvCaptureFromFile(filename);
|
|
|
|
|
cap = get_capture_video_stream(filename); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
//cap = cvCaptureFromCAM(cam_index);
|
|
|
|
|
cap = get_capture_webcam(filename); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int top = option_find_int(options, "top", 1); |
|
|
|
@ -886,7 +891,8 @@ void threat_classifier(char *datacfg, char *cfgfile, char *weightfile, int cam_i |
|
|
|
|
struct timeval tval_before, tval_after, tval_result; |
|
|
|
|
gettimeofday(&tval_before, NULL); |
|
|
|
|
|
|
|
|
|
image in = get_image_from_stream(cap); |
|
|
|
|
//image in = get_image_from_stream(cap);
|
|
|
|
|
image in = get_image_from_stream_cpp(cap); |
|
|
|
|
if(!in.data) break; |
|
|
|
|
image in_s = resize_image(in, net.w, net.h); |
|
|
|
|
|
|
|
|
@ -993,9 +999,12 @@ void gun_classifier(char *datacfg, char *cfgfile, char *weightfile, int cam_inde |
|
|
|
|
CvCapture * cap; |
|
|
|
|
|
|
|
|
|
if (filename) { |
|
|
|
|
cap = cvCaptureFromFile(filename); |
|
|
|
|
}else{ |
|
|
|
|
cap = cvCaptureFromCAM(cam_index); |
|
|
|
|
//cap = cvCaptureFromFile(filename);
|
|
|
|
|
cap = get_capture_video_stream(filename); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
//cap = cvCaptureFromCAM(cam_index);
|
|
|
|
|
cap = get_capture_webcam(filename); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int top = option_find_int(options, "top", 1); |
|
|
|
@ -1015,7 +1024,8 @@ void gun_classifier(char *datacfg, char *cfgfile, char *weightfile, int cam_inde |
|
|
|
|
struct timeval tval_before, tval_after, tval_result; |
|
|
|
|
gettimeofday(&tval_before, NULL); |
|
|
|
|
|
|
|
|
|
image in = get_image_from_stream(cap); |
|
|
|
|
//image in = get_image_from_stream(cap);
|
|
|
|
|
image in = get_image_from_stream_cpp(cap); |
|
|
|
|
image in_s = resize_image(in, net.w, net.h); |
|
|
|
|
show_image(in, "Threat Detection"); |
|
|
|
|
|
|
|
|
@ -1070,9 +1080,11 @@ void demo_classifier(char *datacfg, char *cfgfile, char *weightfile, int cam_ind |
|
|
|
|
CvCapture * cap; |
|
|
|
|
|
|
|
|
|
if(filename){ |
|
|
|
|
cap = cvCaptureFromFile(filename); |
|
|
|
|
//cap = cvCaptureFromFile(filename);
|
|
|
|
|
cap = get_capture_video_stream(filename); |
|
|
|
|
}else{ |
|
|
|
|
cap = cvCaptureFromCAM(cam_index); |
|
|
|
|
//cap = cvCaptureFromCAM(cam_index);
|
|
|
|
|
cap = get_capture_webcam(filename); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int top = option_find_int(options, "top", 1); |
|
|
|
@ -1092,7 +1104,8 @@ void demo_classifier(char *datacfg, char *cfgfile, char *weightfile, int cam_ind |
|
|
|
|
struct timeval tval_before, tval_after, tval_result; |
|
|
|
|
gettimeofday(&tval_before, NULL); |
|
|
|
|
|
|
|
|
|
image in = get_image_from_stream(cap); |
|
|
|
|
//image in = get_image_from_stream(cap);
|
|
|
|
|
image in = get_image_from_stream_cpp(cap); |
|
|
|
|
image in_s = resize_image(in, net.w, net.h); |
|
|
|
|
show_image(in, "Classifier"); |
|
|
|
|
|
|
|
|
|