From 3b33c84634161664c4cea2c19a636147e2a9d874 Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 2 Sep 2019 20:31:02 +0300 Subject: [PATCH] Porting to opencv-3.2.0. --- src/ShapeRecognition/ShapeRec_FeatureDetector.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx index a56e18f7f..c4ac7b14e 100644 --- a/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx +++ b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx @@ -27,6 +27,14 @@ #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 @@ -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) // { -- 2.39.2