From 016f03aaff846f121ce6a1afd9aa70f02100880d Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 16 Mar 2021 14:26:59 +0300 Subject: [PATCH] Backward compatibility with OpenCV 2x --- src/ShapeRecognition/ShapeRec_FeatureDetector.cxx | 12 ++---------- src/ShapeRecognition/ShapeRec_FeatureDetector.hxx | 10 ++++------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx index c667720d9..ca54fe2e2 100644 --- a/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx +++ b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx @@ -27,14 +27,6 @@ #include #include "utilities.h" -#include - - -#if CV_MAJOR_VERSION == 3 -#define cvCvtPixToPlane cvSplit -#endif - - // TODO : All the following methods but ComputeContours use the C API of OpenCV while ComputContours // uses the C++ API of the library. // This should be homogenized and preferably by using the C++ API (which is more recent for all the methods @@ -169,7 +161,7 @@ bool ShapeRec_FeatureDetector::ComputeContours( bool useROI, ShapeRec_Parameters cvCvtColor(sample_image, sample_hsv, CV_BGR2HSV); - cvCvtPixToPlane(sample_hsv, sample_h_plane, sample_s_plane, 0, 0); + cvSplit(sample_hsv, sample_h_plane, sample_s_plane, 0, 0); IplImage* sample_planes[] = { sample_h_plane, sample_s_plane }; // Create the hue / saturation histogram of the SAMPLE image. @@ -223,7 +215,7 @@ bool ShapeRec_FeatureDetector::ComputeContours( bool useROI, ShapeRec_Parameters // Get hue and saturation planes of the INPUT image cvCvtColor(input_image, input_hsv, CV_BGR2HSV); - cvCvtPixToPlane(input_hsv, input_hplane, input_splane, 0, 0); + cvSplit(input_hsv, input_hplane, input_splane, 0, 0); IplImage* input_planes[] = { input_hplane, input_splane }; // Compute the back projection diff --git a/src/ShapeRecognition/ShapeRec_FeatureDetector.hxx b/src/ShapeRecognition/ShapeRec_FeatureDetector.hxx index f068387ba..a4b3cc21e 100644 --- a/src/ShapeRecognition/ShapeRec_FeatureDetector.hxx +++ b/src/ShapeRecognition/ShapeRec_FeatureDetector.hxx @@ -28,13 +28,11 @@ // This workaround will be removed after correction of the // https://tracker.dev.opencascade.org/view.php?id=28457 issue. #ifdef HAVE_TBB - #undef HAVE_TBB - #include - #include - #define HAVE_TBB +#undef HAVE_TBB +#include +#define HAVE_TBB #else - #include - #include +#include #endif // Qt -- 2.30.2