1 diff --git a/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx
2 index a56e18f7f..a59aaee76 100644
3 --- a/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx
4 +++ b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx
6 #include "ShapeRec_FeatureDetector.hxx"
9 +#include <opencv2/core/version.hpp>
12 +#if CV_MAJOR_VERSION == 3
13 +#define cvCvtPixToPlane cvSplit
16 // TODO : All the following methods but ComputeContours use the C API of OpenCV while ComputContours
17 // uses the C++ API of the library.
18 @@ -233,7 +239,12 @@ bool ShapeRec_FeatureDetector::ComputeContours( bool useROI, ShapeRec_Parameters
19 cvReleaseImage(&input_splane);
20 cvReleaseImage(&backproject);
22 - detected_edges = cv::Mat(binary_backproject);
24 +#if CV_MAJOR_VERSION == 3
25 + detected_edges = cv::cvarrToMat(binary_backproject);
27 + detected_edges = cv::Mat(binary_backproject);
30 // else if ( detection_method == RIDGE_DETECTOR ) // Method adapted for engineering drawings (e.g. watershed functionality could be used here cf.OpenCV documentation and samples)