From 82f630cac763a168b67d3d51e60eb860e2aa26de Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Sat, 17 Feb 2018 23:31:56 +0000
Subject: [PATCH] Added param -http_port 8090 to show MJPEG-stream in the WebBrowser (Chrome/Firefox)

---
 src/image.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/image.c b/src/image.c
index 3afe027..efa7185 100644
--- a/src/image.c
+++ b/src/image.c
@@ -14,13 +14,14 @@
 #include "opencv2/highgui/highgui_c.h"
 #include "opencv2/imgproc/imgproc_c.h"
 #include "opencv2/core/version.hpp"
+#include "http_stream.h"
 #ifndef CV_VERSION_EPOCH
 #include "opencv2/videoio/videoio_c.h"
 #include "opencv2/imgcodecs/imgcodecs_c.h"
+#include "http_stream.h"
 #endif
 #endif
 
-
 int windows = 0;
 
 float colors[6][3] = { {1,0,1}, {0,0,1},{0,1,1},{0,1,0},{1,1,0},{1,0,0} };
@@ -527,7 +528,7 @@
 }
 
 
-void show_image_cv_ipl(IplImage *disp, const char *name, const char *out_filename)
+void show_image_cv_ipl(IplImage *disp, const char *name, const char *out_filename, int http_stream_port)
 {
 	if (disp == NULL) return;
 	char buff[256];
@@ -538,6 +539,18 @@
 	++windows;
 	cvShowImage(buff, disp);
 
+
+	// http mjpeg stream: http://localhost:8090
+	// use URL with the port number stated in your command line instead of 8090
+	if (http_stream_port > 0) {
+		//int port = 8090;
+		int port = http_stream_port;
+		int timeout = 200;
+		int jpeg_quality = 30;	// 1 - 100
+		send_mjpeg(disp, port, timeout, jpeg_quality);
+	}
+
+
 	if(out_filename)
 	{
 		CvSize size;

--
Gitblit v1.10.0