From e4ab47dfcedb4c87e5eddf484caa4ac0c020fc9b Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Wed, 21 Feb 2018 12:35:09 +0000
Subject: [PATCH] Optimized resizing of region_layer for random=1

---
 src/demo.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/demo.c b/src/demo.c
index 3aec3a5..9c3fea4 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -7,16 +7,23 @@
 #include "box.h"
 #include "image.h"
 #include "demo.h"
-//#include <sys/time.h>
+#ifdef WIN32
 #include <time.h>
 #include <winsock.h>
 #include "gettimeofday.h"
+#else
+#include <sys/time.h>
+#endif
 
 #define FRAMES 3
 
 #ifdef OPENCV
 #include "opencv2/highgui/highgui_c.h"
 #include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/core/version.hpp"
+#ifndef CV_VERSION_EPOCH
+#include "opencv2/videoio/videoio_c.h"
+#endif
 image get_image_from_stream(CvCapture *cap);
 
 static char **demo_names;
@@ -42,6 +49,7 @@
 static float *avg;
 
 void draw_detections_cv(IplImage* show_img, int num, float thresh, box *boxes, float **probs, char **names, image **alphabet, int classes);
+void show_image_cv_ipl(IplImage *disp, const char *name, const char *out_filename, int http_stream_port);
 image get_image_from_stream_resize(CvCapture *cap, int w, int h, IplImage** in_img);
 IplImage* in_img;
 IplImage* det_img;
@@ -108,7 +116,8 @@
     return (double)time.tv_sec + (double)time.tv_usec * .000001;
 }
 
-void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix)
+void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, 
+	int frame_skip, char *prefix, char *out_filename, int http_stream_port)
 {
     //skip = frame_skip;
     image **alphabet = load_alphabet();
@@ -118,7 +127,7 @@
     demo_classes = classes;
     demo_thresh = thresh;
     printf("Demo\n");
-    net = parse_network_cfg(cfgfile);
+    net = parse_network_cfg_custom(cfgfile, 1);
     if(weightfile){
         load_weights(&net, weightfile);
     }
@@ -187,7 +196,7 @@
 
             if(!prefix){                
 				//show_image(disp, "Demo");
-				show_image_cv_ipl(show_img, "Demo");
+				show_image_cv_ipl(show_img, "Demo", out_filename, http_stream_port);
                 int c = cvWaitKey(1);
                 if (c == 10){
                     if(frame_skip == 0) frame_skip = 60;
@@ -237,7 +246,7 @@
     }
 }
 #else
-void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix)
+void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix, char *out_filename, int http_stream_port)
 {
     fprintf(stderr, "Demo needs OpenCV for webcam images.\n");
 }

--
Gitblit v1.10.0