0001-src-mod-applications-mod_cv-mod_cv.cpp-fix-build-wit.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 575409a14e62f73e83309daf8ff6642a235f250c Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Fri, 16 Oct 2020 23:06:36 +0200
  4. Subject: [PATCH] src/mod/applications/mod_cv/mod_cv.cpp: fix build with opencv
  5. 3.4.9
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Use cvScalar instead of CV_RGB to avoid the following build failure with
  10. opencv 3.4.9:
  11. mod_cv.cpp:693:24: error: conversion from ‘cv::Scalar {aka cv::Scalar_<double>}’ to non-scalar type ‘CvScalar’ requested
  12. CvScalar col = CV_RGB((float)255 * object_neighbors / max_neighbors, 0, 0);
  13. ^
  14. Indeed, CV_RGB is defined as cv::Scalar instead of cvScalar since
  15. version 3.4.2 and
  16. https://github.com/opencv/opencv/commit/7f9253ea0a9fe2635926379420002dbf0c3fce0f
  17. It should be noted that CV_RGB(r,g,b) = cvScalar(b,g,r,0)
  18. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  19. [Upstream status: https://github.com/signalwire/freeswitch/pull/914]
  20. ---
  21. src/mod/applications/mod_cv/mod_cv.cpp | 2 +-
  22. 1 file changed, 1 insertion(+), 1 deletion(-)
  23. diff --git a/src/mod/applications/mod_cv/mod_cv.cpp b/src/mod/applications/mod_cv/mod_cv.cpp
  24. index 582f925abf..bbec755e91 100644
  25. --- a/src/mod/applications/mod_cv/mod_cv.cpp
  26. +++ b/src/mod/applications/mod_cv/mod_cv.cpp
  27. @@ -690,7 +690,7 @@ void detectAndDraw(cv_context_t *context)
  28. //printf("WTF %d\n", object_neighbors);
  29. //cout << "Detected " << object_neighbors << " object neighbors" << endl;
  30. const int rect_height = cvRound((float)img.rows * object_neighbors / max_neighbors);
  31. - CvScalar col = CV_RGB((float)255 * object_neighbors / max_neighbors, 0, 0);
  32. + CvScalar col = cvScalar(0, 0, (float)255 * object_neighbors / max_neighbors, 0);
  33. rectangle(img, cvPoint(0, img.rows), cvPoint(img.cols/10, img.rows - rect_height), col, -1);
  34. parse_stats(&context->nestDetected, nestedObjects.size(), context->skip);
  35. --
  36. 2.28.0