Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit b7dc2a8

Browse files
committed
Updated SIFTDetector.h to work with OpenCV > 4.4.0
1 parent 202769d commit b7dc2a8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cc/xfeatures2d/SIFTDetector.h

Lines changed: 10 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,13 +51,18 @@ class SIFTDetector : public FeatureDetector, public FF::ObjectWrapTemplate<SIFTD
4751
auto sigma = opt<FF::DoubleConverter>("sigma", 1.6);
4852

4953
executeBinding = [=]() {
50-
return cv::xfeatures2d::SIFT::create(
54+
#if CV_VERSION_GREATER_EQUAL(4, 4, 0)
55+
return cv::SIFT::create(
56+
#else
57+
return cv::xfeatures2d::SIFT::create(
58+
#endif
5159
nFeatures->ref(),
5260
nOctaveLayers->ref(),
5361
contrastThreshold->ref(),
5462
edgeThreshold->ref(),
5563
sigma->ref()
5664
);
65+
#endif
5766
};
5867

5968
modifySelf = [=](SIFTDetector* self) {

0 commit comments

Comments
 (0)