Skip to content

Commit 0a0aedb

Browse files
committed
Fixes frameCount bug and try to set parameters for smooth Smartphone usage (8 FPS...)
1 parent 59b1e78 commit 0a0aedb

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

lib-SLProject/source/CV/SLCVTrackerFeatures.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ for a good top down information.
3030
using namespace cv;
3131

3232
#define DEBUG 0
33-
#define DETECT_ONLY 0
34-
//#define SAVE_SNAPSHOTS_OUTPUT "/tmp/cv_tracking/"
33+
#define FORCE_DETECT 0
34+
// #define SAVE_SNAPSHOTS_OUTPUT "/tmp/cv_tracking/"
3535

3636
// Feature detection and extraction
3737
const int nFeatures = 200;
38-
const float minRatio = 0.9f;
38+
const float minRatio = 0.7f;
3939
#define FLANN_BASED 0
4040

4141
// RANSAC parameters
42-
const int iterations = 200;
43-
const float reprojectionError = 3.0f;
44-
const double confidence = 0.95;
42+
const int iterations = 500;
43+
const float reprojectionError = 2.0f;
44+
const double confidence = 0.9;
4545

4646
// Benchmarking
4747
#define TRACKING_MEASUREMENT 0
@@ -57,7 +57,7 @@ float high_compute_milis;
5757
//-----------------------------------------------------------------------------
5858
SLCVTrackerFeatures::SLCVTrackerFeatures(SLNode *node) :
5959
SLCVTracker(node) {
60-
SLScene::current->_detector->setDetector(new SLCVRaulMurOrb(nFeatures, 1.44f, 4, 30, 20));
60+
SLScene::current->_detector->setDetector(new SLCVRaulMurOrb(nFeatures, 1.44f, 3, 30, 20));
6161
SLScene::current->_descriptor->setDescriptor(ORB::create(nFeatures, 1.44f, 3, 31, 0, 2, ORB::HARRIS_SCORE, 31, 30));
6262

6363
#if FLANN_BASED
@@ -142,7 +142,7 @@ SLbool SLCVTrackerFeatures::track(SLCVMat imageGray,
142142
#endif
143143

144144
// Handle detecting || tracking correctly!
145-
if (DETECT_ONLY || frameCount % 20 == 0 || lastNmatchedKeypoints * 0.6f > _prev.points2D.size()) {
145+
if (FORCE_DETECT || frameCount % 20 == 0 || lastNmatchedKeypoints * 0.6f > _prev.points2D.size()) {
146146
#if DEBUG
147147
cout << "Going to detect keypoints and match them with model..." << endl;
148148
#endif
@@ -224,18 +224,15 @@ SLbool SLCVTrackerFeatures::track(SLCVMat imageGray,
224224
}
225225
#endif
226226

227-
228-
#if(TRACKING_MEASUREMENT || defined SAVE_SNAPSHOTS_OUTPUT)
229-
frameCount++;
230-
#endif
231-
232227
// Copy actual frame data to _prev struct for next frame
233228
_prev.imageGray = imageGray;
234229
_prev.image = image;
235230
_prev.points2D = points2D;
236231
_prev.rvec = rvec;
237232
_prev.tvec = tvec;
238233

234+
frameCount++;
235+
239236
return false;
240237
}
241238

0 commit comments

Comments
 (0)