Skip to content

Commit 0aac05f

Browse files
committed
Fix #750 making it compatible with Opencv4.4
1 parent 24bff92 commit 0aac05f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cc/xfeatures2d/SIFTDetector.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
#ifndef __FF_SIFTDETECTOR_H__
77
#define __FF_SIFTDETECTOR_H__
88

9+
#if CV_VERSION_GREATER_EQUAL(4, 4, 0)
10+
class SIFTDetector : public FeatureDetector, public FF::ObjectWrapTemplate<SIFTDetector, cv::Ptr<cv::SIFT>> {
11+
#else
912
class SIFTDetector : public FeatureDetector, public FF::ObjectWrapTemplate<SIFTDetector, cv::Ptr<cv::xfeatures2d::SIFT>> {
13+
#endif
1014
public:
1115
static Nan::Persistent<v8::FunctionTemplate> constructor;
1216

@@ -47,7 +51,11 @@ class SIFTDetector : public FeatureDetector, public FF::ObjectWrapTemplate<SIFTD
4751
auto sigma = opt<FF::DoubleConverter>("sigma", 1.6);
4852

4953
executeBinding = [=]() {
54+
#if CV_VERSION_GREATER_EQUAL(4, 4, 0)
55+
return cv::SIFT::create(
56+
#else
5057
return cv::xfeatures2d::SIFT::create(
58+
#endif
5159
nFeatures->ref(),
5260
nOctaveLayers->ref(),
5361
contrastThreshold->ref(),
@@ -67,4 +75,4 @@ class SIFTDetector : public FeatureDetector, public FF::ObjectWrapTemplate<SIFTD
6775
};
6876
};
6977

70-
#endif
78+
#endif

0 commit comments

Comments
 (0)