]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Backward compatibility with OpenCV 2x
authorvsr <vsr@opencascade.com>
Tue, 16 Mar 2021 11:26:59 +0000 (14:26 +0300)
committervsr <vsr@opencascade.com>
Tue, 16 Mar 2021 11:26:59 +0000 (14:26 +0300)
src/ShapeRecognition/ShapeRec_FeatureDetector.cxx
src/ShapeRecognition/ShapeRec_FeatureDetector.hxx

index c667720d91e5814de58bdc2e5ddaa9b47bed86e1..ca54fe2e22b3b04b4897224001a27a58c2599c7b 100644 (file)
 #include <stdio.h>
 #include "utilities.h"
 
-#include <opencv2/core/version.hpp>
-
-
-#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
index f068387ba989b036d975b715b4125d4eb6d77d4b..a4b3cc21e8bedf8ae8d474337d40a6681e7373fe 100644 (file)
 //      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 <opencv2/imgproc/imgproc.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #define HAVE_TBB
+#undef HAVE_TBB
+#include <opencv2/opencv.hpp>
+#define HAVE_TBB
 #else
- #include <opencv2/imgproc/imgproc.hpp>
- #include <opencv2/highgui/highgui.hpp>
+#include <opencv2/opencv.hpp>
 #endif
 
 // Qt