Salome HOME
Porting to opencv-3.2.0.
authorrnv <rnv@opencascade.com>
Mon, 2 Sep 2019 17:31:02 +0000 (20:31 +0300)
committerrnv <rnv@opencascade.com>
Mon, 2 Sep 2019 17:31:02 +0000 (20:31 +0300)
src/ShapeRecognition/ShapeRec_FeatureDetector.cxx

index a56e18f7fd04c7f3bfb1f458ef1e586b14c5ddd3..c4ac7b14e1d500521888f3a32436f51e221e8a44 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
@@ -232,8 +240,12 @@ bool ShapeRec_FeatureDetector::ComputeContours( bool useROI, ShapeRec_Parameters
     cvReleaseImage(&input_hplane);
     cvReleaseImage(&input_splane);
     cvReleaseImage(&backproject);
-  
+
+#if CV_MAJOR_VERSION == 3
+    detected_edges = cv::cvarrToMat(binary_backproject);
+#else
     detected_edges = cv::Mat(binary_backproject);
+#endif
   }
   // else if ( detection_method == RIDGE_DETECTOR )  // Method adapted for engineering drawings (e.g. watershed functionality could be used here cf.OpenCV documentation and samples)
   // {