From 63aeb63dee51aff8d0b7c862f9c7966e055eb061 Mon Sep 17 00:00:00 2001
From: Alexey <AlexeyAB@users.noreply.github.com>
Date: Thu, 07 Jun 2018 13:46:23 +0000
Subject: [PATCH] Update Readme.md

---
 src/http_stream.cpp |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/http_stream.cpp b/src/http_stream.cpp
index a2ffc0c..1b65173 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
@@ -208,7 +208,7 @@
 		cap = (CvCapture*)new cv::VideoCapture(path);
 	}
 	catch (...) {
-		std::cout << " Error: Web-camera " << path << " can't be opened! \n";
+		std::cout << " Error: video-stream " << path << " can't be opened! \n";
 	}
 	return cap;
 }
@@ -283,19 +283,26 @@
 
 	// HSV augmentation
 	// CV_BGR2HSV, CV_RGB2HSV, CV_HSV2BGR, CV_HSV2RGB
-	cv::Mat hsv_src;
-	cvtColor(sized, hsv_src, CV_BGR2HSV);	// also BGR -> RGB
+	if (ipl->nChannels >= 3)
+	{
+		cv::Mat hsv_src;
+		cvtColor(sized, hsv_src, CV_BGR2HSV);	// also BGR -> RGB
 	
-	std::vector<cv::Mat> hsv;
-	cv::split(hsv_src, hsv);
+		std::vector<cv::Mat> hsv;
+		cv::split(hsv_src, hsv);
 
-	hsv[1] *= dsat;
-	hsv[2] *= dexp;
-	hsv[0] += 179 * dhue;
+		hsv[1] *= dsat;
+		hsv[2] *= dexp;
+		hsv[0] += 179 * dhue;
 
-	cv::merge(hsv, hsv_src);
+		cv::merge(hsv, hsv_src);
 
-	cvtColor(hsv_src, sized, CV_HSV2RGB);	// now RGB instead of BGR
+		cvtColor(hsv_src, sized, CV_HSV2RGB);	// now RGB instead of BGR
+	}
+	else
+	{
+		sized *= dexp;
+	}
 
 	// Mat -> IplImage -> image
 	IplImage src = sized;
@@ -305,4 +312,4 @@
 }
 
 
-#endif	// OPENCV
\ No newline at end of file
+#endif	// OPENCV

--
Gitblit v1.10.0