1From 57b1e723b73da4c8d42c20d4e28040ec4c0edd85 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Fri, 28 Feb 2020 14:29:47 +0100
4Subject: [PATCH] modules/video_filter/opencv_example.cpp: fix build with
5 opencv 3.4.9
6
7Use cvScalar instead of CV_RGB to avoid the following build failure with
8opencv 3.4.9:
9
10In file included from /home/naourr/work/instance-2/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/opencv2/imgproc/imgproc.hpp:48,
11                 from video_filter/opencv_example.cpp:46:
12video_filter/opencv_example.cpp: In function 'picture_t* Filter(filter_t*, picture_t*)':
13video_filter/opencv_example.cpp:200:46: error: could not convert 'cv::Scalar_<double>((double)0, (double)0, (double)0, (double)0)' from 'cv::Scalar' {aka 'cv::Scalar_<double>'} to 'CvScalar'
14             cvRectangle( p_img[0], pt1, pt2, CV_RGB(0,0,0), 3, 8, 0 );
15                                              ^~~~~~
16
17Indeed, CV_RGB is defined as cv::Scalar instead of cvScalar since
18version 3.4.2 and
19https://github.com/opencv/opencv/commit/7f9253ea0a9fe2635926379420002dbf0c3fce0f
20
21Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
22[Upstream status: https://patches.videolan.org/patch/26655]
23---
24 modules/video_filter/opencv_example.cpp | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27diff --git a/modules/video_filter/opencv_example.cpp b/modules/video_filter/opencv_example.cpp
28index 1334cd4c36..1a8d574f7a 100644
29--- a/modules/video_filter/opencv_example.cpp
30+++ b/modules/video_filter/opencv_example.cpp
31@@ -202,7 +202,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
32             pt2.x = (r->x+r->width)*scale;
33             pt1.y = r->y*scale;
34             pt2.y = (r->y+r->height)*scale;
35-            cvRectangle( p_img[0], pt1, pt2, CV_RGB(0,0,0), 3, 8, 0 );
36+            cvRectangle( p_img[0], pt1, pt2, cvScalar(0,0,0,0), 3, 8, 0 );
37
38             *(CvRect*)(&(p_sys->event_info.p_region[i])) = *r;
39             p_sys->event_info.p_region[i].i_id = p_sys->i_id++;
40--
412.25.0
42
43