From 160eddddc4e265d5ee59a38797c30720bf46cd7c Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Sun, 27 May 2018 13:53:42 +0000
Subject: [PATCH] Minor fix
---
src/http_stream.cpp | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/http_stream.cpp b/src/http_stream.cpp
index 5449192..9192f75 100644
--- a/src/http_stream.cpp
+++ b/src/http_stream.cpp
@@ -44,6 +44,12 @@
using std::endl;
#include "opencv2/opencv.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
+#ifndef CV_VERSION_EPOCH
+#include "opencv2/videoio/videoio.hpp"
+#endif
using namespace cv;
#include "http_stream.h"
@@ -196,6 +202,18 @@
}
// ----------------------------------------
+CvCapture* get_capture_video_stream(char *path) {
+ CvCapture* cap = NULL;
+ try {
+ cap = (CvCapture*)new cv::VideoCapture(path);
+ }
+ catch (...) {
+ std::cout << " Error: video-stream " << path << " can't be opened! \n";
+ }
+ return cap;
+}
+// ----------------------------------------
+
CvCapture* get_capture_webcam(int index) {
CvCapture* cap = NULL;
try {
@@ -215,14 +233,18 @@
try {
cv::VideoCapture &cpp_cap = *(cv::VideoCapture *)cap;
cv::Mat frame;
- if (cpp_cap.isOpened()) {
+ if (cpp_cap.isOpened())
+ {
cpp_cap >> frame;
- src = cvCreateImageHeader(cvSize(frame.cols, frame.rows), 8, frame.channels());
- *src = frame;
+ IplImage tmp = frame;
+ src = cvCloneImage(&tmp);
+ }
+ else {
+ std::cout << " Video-stream stoped! \n";
}
}
catch (...) {
- std::cout << " Web-camera stoped! \n";
+ std::cout << " Video-stream stoped! \n";
}
return src;
}
--
Gitblit v1.10.0