From f762e6adb50d0a7eb72825b322e7d4192ae29ef3 Mon Sep 17 00:00:00 2001
From: Alexey <AlexeyAB@users.noreply.github.com>
Date: Sat, 03 Feb 2018 12:38:31 +0000
Subject: [PATCH] Merge pull request #357 from rajendraarora16/new-changes-darknet

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

diff --git a/src/demo.c b/src/demo.c
index 3aec3a5..eece00a 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;
@@ -108,7 +115,7 @@
     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)
 {
     //skip = frame_skip;
     image **alphabet = load_alphabet();
@@ -118,7 +125,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 +194,7 @@
 
             if(!prefix){                
 				//show_image(disp, "Demo");
-				show_image_cv_ipl(show_img, "Demo");
+				show_image_cv_ipl(show_img, "Demo", out_filename);
                 int c = cvWaitKey(1);
                 if (c == 10){
                     if(frame_skip == 0) frame_skip = 60;
@@ -237,7 +244,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)
 {
     fprintf(stderr, "Demo needs OpenCV for webcam images.\n");
 }

--
Gitblit v1.10.0