|
@@ -58,6 +58,7 @@ import {
|
58
|
58
|
TRACK_HARRIS_QUALITY, TRACK_DETECTOR_CAPACITY, TRACK_MAX_KEYPOINTS,
|
59
|
59
|
TRACK_RANSAC_REPROJECTIONERROR_NDC, TRACK_MATCH_RATIO,
|
60
|
60
|
TRACK_FILTER_ALPHA, TRACK_FILTER_BETA, TRACK_FILTER_TAU, TRACK_FILTER_OMEGA,
|
|
61
|
+ TRACK_EXTRAPOLATION_ALPHA, TRACK_EXTRAPOLATION_BETA,
|
61
|
62
|
NIGHTVISION_QUALITY, SUBPIXEL_METHOD,
|
62
|
63
|
} from '../settings';
|
63
|
64
|
import { Settings } from '../../../core/settings';
|
|
@@ -89,6 +90,9 @@ export class ImageTrackerTrackingState extends ImageTrackerState
|
89
|
90
|
/** current homography (for computing the pose) */
|
90
|
91
|
private _poseHomography: SpeedyMatrix;
|
91
|
92
|
|
|
93
|
+ /* previous homography */
|
|
94
|
+ private _prevHomography: SpeedyMatrix;
|
|
95
|
+
|
92
|
96
|
/** initial keypoints (i.e., the keypoints we found when we first started tracking) */
|
93
|
97
|
private _templateKeypoints: SpeedyKeypoint[];
|
94
|
98
|
|
|
@@ -129,6 +133,7 @@ export class ImageTrackerTrackingState extends ImageTrackerState
|
129
|
133
|
this._referenceImage = null;
|
130
|
134
|
this._warpHomography = Speedy.Matrix.Eye(3);
|
131
|
135
|
this._poseHomography = Speedy.Matrix.Eye(3);
|
|
136
|
+ this._prevHomography = Speedy.Matrix.Eye(3);
|
132
|
137
|
this._templateKeypoints = [];
|
133
|
138
|
this._initialScreenSize = Speedy.Size(1, 1);
|
134
|
139
|
this._lastOutput = {};
|
|
@@ -159,8 +164,9 @@ export class ImageTrackerTrackingState extends ImageTrackerState
|
159
|
164
|
|
160
|
165
|
// set attributes
|
161
|
166
|
this._referenceImage = referenceImage;
|
162
|
|
- this._warpHomography = Speedy.Matrix(homography);
|
163
|
|
- this._poseHomography = Speedy.Matrix(homography);
|
|
167
|
+ this._warpHomography.setToSync(homography);
|
|
168
|
+ this._poseHomography.setToSync(homography);
|
|
169
|
+ this._prevHomography.setToSync(homography);
|
164
|
170
|
this._templateKeypoints = templateKeypoints;
|
165
|
171
|
this._initialScreenSize = Speedy.Size(initialScreenSize.width, initialScreenSize.height);
|
166
|
172
|
this._lastOutput = {};
|
|
@@ -320,8 +326,18 @@ export class ImageTrackerTrackingState extends ImageTrackerState
|
320
|
326
|
.then(warpMotion => {
|
321
|
327
|
|
322
|
328
|
// update warp homography
|
|
329
|
+ this._prevHomography.setToSync(this._warpHomography);
|
323
|
330
|
this._warpHomography.setToSync(warpMotion.times(this._warpHomography));
|
324
|
|
- return this._warpHomography;
|
|
331
|
+ //return this._warpHomography;
|
|
332
|
+
|
|
333
|
+ // extrapolate to compensante a bit the delay introduced by the
|
|
334
|
+ // previous filter
|
|
335
|
+ return ImageTrackerUtils.interpolateHomographies(
|
|
336
|
+ this._prevHomography,
|
|
337
|
+ this._warpHomography,
|
|
338
|
+ TRACK_EXTRAPOLATION_ALPHA,
|
|
339
|
+ TRACK_EXTRAPOLATION_BETA
|
|
340
|
+ );
|
325
|
341
|
|
326
|
342
|
/*
|
327
|
343
|
const lowPower = (Settings.powerPreference == 'low-power');
|