From 026a679dedbc45486a11ecabf56c898372d8cac5 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Thu, 21 Jun 2018 16:23:30 +0000
Subject: [PATCH] Minor fix: darknet.py for OpenCV

---
 src/http_stream.cpp |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/http_stream.cpp b/src/http_stream.cpp
index acb6c8e..b122f5b 100644
--- a/src/http_stream.cpp
+++ b/src/http_stream.cpp
@@ -44,7 +44,7 @@
 using std::endl;
 
 #include "opencv2/opencv.hpp"
-#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui.hpp"
 #include "opencv2/highgui/highgui_c.h"
 #include "opencv2/imgproc/imgproc_c.h"
 #ifndef CV_VERSION_EPOCH
@@ -248,6 +248,22 @@
 	}
 	return src;
 }
+
+int get_stream_fps_cpp(CvCapture *cap) {
+	int fps = 25;
+	try {
+		cv::VideoCapture &cpp_cap = *(cv::VideoCapture *)cap;
+#ifndef CV_VERSION_EPOCH	// OpenCV 3.x
+		fps = cpp_cap.get(CAP_PROP_FPS);
+#else						// OpenCV 2.x
+		fps = cpp_cap.get(CV_CAP_PROP_FPS);
+#endif		
+	}
+	catch (...) {
+		std::cout << " Can't get FPS of source videofile. For output video FPS = 25 by default. \n";
+	}
+	return fps;
+}
 // ----------------------------------------
 extern "C" {
 	image ipl_to_image(IplImage* src);	// image.c
@@ -312,4 +328,4 @@
 }
 
 
-#endif	// OPENCV
\ No newline at end of file
+#endif	// OPENCV

--
Gitblit v1.10.0