Skip to content

Commit

Permalink
lowering num. of features
Browse files Browse the repository at this point in the history
- better clear_output method
- using NORM_HAMMING for the matcher
  • Loading branch information
kalwalt committed Jun 4, 2024
1 parent 64ff718 commit ebd9df3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

extern const double DEFAULT_NN_MATCH_RATIO = 0.7f;
extern const double TEBLID_NN_MATCH_RATIO = 0.8f;
extern const int DEFAULT_MAX_FEATURES = 8000;
extern const int TEBLID_MAX_FEATURES = 10000;
extern const int DEFAULT_MAX_FEATURES = 800;
extern const int TEBLID_MAX_FEATURES = 1000;
extern const int N = 10;
extern const int MIN_NUM_MATCHES = 8;
extern const int minRequiredDetectedFeatures = 50; ///< Minimum number of detected features required to consider a target matched.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ class WebARKitTracker::WebARKitTrackerImpl {
_patternTrackingInfo.cameraPoseFromPoints(_pose, objPoints, imgPoints, m_camMatrix, m_distortionCoeff);
// _patternTrackingInfo.computePose(_pattern.points3d, warpedCorners, m_camMatrix, m_distortionCoeff);
_patternTrackingInfo.getTrackablePose(_pose);
fill_output2(m_H);
}

WEBARKIT_LOG("Marker detected : %s\n", _isDetected ? "true" : "false");
Expand Down Expand Up @@ -579,7 +580,7 @@ class WebARKitTracker::WebARKitTrackerImpl {
output[16] = _bBoxTransformed[3].y;
};

void clear_output() { output = std::vector<double>(17, 0.0); };
void clear_output() { std::fill(output.begin(), output.end(), 0); };

void buildImagePyramid(cv::Mat& frame) { cv::buildOpticalFlowPyramid(frame, _pyramid, winSize, maxLevel); }

Expand Down Expand Up @@ -712,7 +713,6 @@ class WebARKitTracker::WebARKitTrackerImpl {
this->_valid = homoInfo.validHomography;
// Update the bounding box.
perspectiveTransform(_bBox, _bBoxTransformed, homoInfo.homography);
fill_output2(m_H);
if (_trackVizActive) {
for (int i = 0; i < 4; i++) {
// _trackViz.bounds[i][0] = _trackables[trackableId]._bBoxTransformed[i].x;
Expand Down Expand Up @@ -943,13 +943,13 @@ class WebARKitTracker::WebARKitTrackerImpl {
this->_featureDetector = cv::ORB::create(DEFAULT_MAX_FEATURES);
this->_featureDescriptor = cv::ORB::create(DEFAULT_MAX_FEATURES);
} else if (trackerType == webarkit::TRACKER_TYPE::FREAK_TRACKER) {
this->_featureDetector = cv::ORB::create(10000);
this->_featureDetector = cv::ORB::create(DEFAULT_MAX_FEATURES);
this->_featureDescriptor = cv::xfeatures2d::FREAK::create();
} else if (trackerType == webarkit::TRACKER_TYPE::TEBLID_TRACKER) {
this->_featureDetector = cv::ORB::create(TEBLID_MAX_FEATURES);
this->_featureDescriptor = cv::xfeatures2d::TEBLID::create(1.00f);
}
_matcher = cv::BFMatcher::create();
_matcher = cv::BFMatcher::create(cv::NORM_HAMMING);
};
};

Expand Down

0 comments on commit ebd9df3

Please sign in to comment.