@@ -103,17 +103,32 @@ struct FeatureFinder {
103
103
}
104
104
105
105
// Find keypoints in the current image
106
- cv::ORB orb;
106
+ #if (CV_MAJOR_VERSION ==3)
107
+ cv::Ptr <cv::ORB> orb = cv::ORB::create (*n_features_, *scale_factor_, *n_levels_);
108
+ #elif (CV_MAJOR_VERSION == 2) && (CV_MINOR_VERSION >= 4)
109
+ cv::ORB orb = cv::ORB (*n_features_, *scale_factor_, *n_levels_);
110
+ #else
111
+ cv::ORB::CommonParams orb_params;
112
+ orb_params.first_level_ = 0 ;
113
+ orb_params.n_levels_ = *n_levels_;
114
+ orb_params.scale_factor_ = *scale_factor_;
115
+ cv::ORB orb = cv::ORB (*n_features_, orb_params);
116
+ #endif
117
+
107
118
cv::Mat descriptors;
108
119
if (*use_fast_) {
109
120
cv::FAST (*image_, *keypoints_, 30 );
121
+ #if (CV_MAJOR_VERSION ==3)
122
+ orb->detectAndCompute (*image_, mask, *keypoints_, descriptors, true );
123
+ #else
110
124
orb (*image_, mask, *keypoints_, descriptors, true );
125
+ #endif
111
126
} else {
112
- cv::ORB orb;
113
- orb.set (" nFeatures" , *n_features_);
114
- orb.set (" nLevels" , *n_levels_);
115
- orb.set (" scaleFactor" , *scale_factor_);
127
+ #if (CV_MAJOR_VERSION ==3)
128
+ orb->detectAndCompute (*image_, mask, *keypoints_, descriptors);
129
+ #else
116
130
orb (*image_, mask, *keypoints_, descriptors);
131
+ #endif
117
132
}
118
133
119
134
// Remove bad keypoints
@@ -153,7 +168,8 @@ struct FeatureFinder {
153
168
/* * The mask of where to find keypoints in the image */
154
169
ecto::spore<cv::Mat> mask_;
155
170
/* * ORB parameters */
156
- ecto::spore<float > n_features_, n_levels_, scale_factor_;
171
+ ecto::spore<int > n_features_, n_levels_;
172
+ ecto::spore<float > scale_factor_;
157
173
/* * The resulting descriptors */
158
174
ecto::spore<cv::Mat> descriptors_;
159
175
/* * Thekeypoints */
0 commit comments