Przeglądaj źródła

Tweaks

customisations
alemart 5 miesięcy temu
rodzic
commit
9147b100e5

+ 1
- 7
src/trackers/image-tracker/settings.ts Wyświetl plik

@@ -158,14 +158,8 @@ export const TRACK_FILTER_ALPHA = 0.3; //0.4;
158 158
 /** Interpolation filter: correction strength for noisy corners */
159 159
 export const TRACK_FILTER_BETA = 1;
160 160
 
161
-/** Interpolation filter: translation factor */
162
-export const TRACK_FILTER_TAU = 0;
163
-
164
-/** Interpolation filter: rotational factor */
165
-export const TRACK_FILTER_OMEGA = 0; // keep it zero or close to zero
166
-
167 161
 /** Extrapolation filter: extrapolation factor */
168
-export const TRACK_EXTRAPOLATION_ALPHA = 6;
162
+export const TRACK_EXTRAPOLATION_ALPHA = 6; // 12+ = follows faster, but looks unstable (jitter)
169 163
 
170 164
 /** Extrapolation filter: correction strength for noisy corners */
171 165
 export const TRACK_EXTRAPOLATION_BETA = 1.33;

+ 14
- 11
src/trackers/image-tracker/states/tracking.ts Wyświetl plik

@@ -57,7 +57,7 @@ import {
57 57
     SUBPIXEL_GAUSSIAN_KSIZE, SUBPIXEL_GAUSSIAN_SIGMA,
58 58
     TRACK_HARRIS_QUALITY, TRACK_DETECTOR_CAPACITY, TRACK_MAX_KEYPOINTS,
59 59
     TRACK_RANSAC_REPROJECTIONERROR_NDC, TRACK_MATCH_RATIO,
60
-    TRACK_FILTER_ALPHA, TRACK_FILTER_BETA, TRACK_FILTER_TAU, TRACK_FILTER_OMEGA,
60
+    TRACK_FILTER_ALPHA, TRACK_FILTER_BETA,
61 61
     TRACK_EXTRAPOLATION_ALPHA, TRACK_EXTRAPOLATION_BETA,
62 62
     NIGHTVISION_QUALITY, SUBPIXEL_METHOD,
63 63
 } from '../settings';
@@ -90,7 +90,7 @@ export class ImageTrackerTrackingState extends ImageTrackerState
90 90
     /** current homography (for computing the pose) */
91 91
     private _poseHomography: SpeedyMatrix;
92 92
 
93
-    /* previous homography */
93
+    /* previous warp homography */
94 94
     private _prevHomography: SpeedyMatrix;
95 95
 
96 96
     /** initial keypoints (i.e., the keypoints we found when we first started tracking) */
@@ -261,13 +261,14 @@ export class ImageTrackerTrackingState extends ImageTrackerState
261 261
 
262 262
         // When using turbo, we reduce the GPU usage by skipping every other frame
263 263
         if(0 == (this._skipCounter = 1 - this._skipCounter)) {
264
-            const templateKeypoints = this._templateKeypoints;
264
+            //const templateKeypoints = this._templateKeypoints;
265 265
             const previousKeypoints = this._lastPipelineOutput.keypoints as SpeedyMatchedKeypoint[];
266 266
             //const currentKeypoints = this._predictKeypoints(previousKeypoints, templateKeypoints);
267 267
             const currentKeypoints = previousKeypoints; // this actually works
268 268
 
269
-            this._lastPipelineOutput.keypoints = currentKeypoints;
269
+            // idea: predict keypoints with optical flow?
270 270
 
271
+            this._lastPipelineOutput.keypoints = currentKeypoints;
271 272
             return Speedy.Promise.resolve(this._lastPipelineOutput);
272 273
         }
273 274
 
@@ -312,14 +313,15 @@ export class ImageTrackerTrackingState extends ImageTrackerState
312 313
         })
313 314
         .then(warpMotion => {
314 315
 
316
+            const lowPower = (Settings.powerPreference == 'low-power');
317
+            const multiplier = /*!USE_TURBO ||*/ lowPower ? 2 : 1;
318
+
315 319
             // apply filter
316 320
             return ImageTrackerUtils.interpolateHomographies(
317 321
                 NO_MOTION,
318 322
                 Speedy.Matrix(warpMotion),
319
-                TRACK_FILTER_ALPHA,
320
-                TRACK_FILTER_BETA,
321
-                TRACK_FILTER_TAU,
322
-                TRACK_FILTER_OMEGA
323
+                TRACK_FILTER_ALPHA * multiplier,
324
+                TRACK_FILTER_BETA
323 325
             );
324 326
 
325 327
         })
@@ -336,8 +338,9 @@ export class ImageTrackerTrackingState extends ImageTrackerState
336 338
                 this._prevHomography,
337 339
                 this._warpHomography,
338 340
                 TRACK_EXTRAPOLATION_ALPHA,
339
-                TRACK_EXTRAPOLATION_BETA
340
-            );
341
+                TRACK_EXTRAPOLATION_BETA,
342
+                //2.5,0.1
343
+            )
341 344
 
342 345
             /*
343 346
             const lowPower = (Settings.powerPreference == 'low-power');
@@ -357,7 +360,7 @@ export class ImageTrackerTrackingState extends ImageTrackerState
357 360
                 0.4,//TRACK_FILTER_ALPHA,
358 361
                 1,//TRACK_FILTER_BETA,
359 362
                 0.4,//TRACK_FILTER_TAU,
360
-                0.05,//TRACK_FILTER_OMEGA
363
+                0.05,//TRACK_FILTER_OMEGA // keep it zero or close to zero
361 364
             );
362 365
             */
363 366
 

Ładowanie…
Anuluj
Zapisz