|
@@ -50,7 +50,8 @@ import {
|
50
|
50
|
TRACK_HARRIS_QUALITY, TRACK_DETECTOR_CAPACITY, TRACK_MAX_KEYPOINTS,
|
51
|
51
|
SUBPIXEL_GAUSSIAN_KSIZE, SUBPIXEL_GAUSSIAN_SIGMA,
|
52
|
52
|
PRE_TRACK_MIN_MATCHES, PRE_TRACK_MAX_ITERATIONS,
|
53
|
|
- TRACK_MATCH_RATIO, PRE_TRACK_RANSAC_REPROJECTIONERROR_NDC,
|
|
53
|
+ PRE_TRACK_MATCH_RATIO, PRE_TRACK_RANSAC_REPROJECTIONERROR_NDC,
|
|
54
|
+ PRE_TRACK_FILTER_ALPHA, PRE_TRACK_FILTER_BETA,
|
54
|
55
|
NIGHTVISION_QUALITY,
|
55
|
56
|
SUBPIXEL_METHOD,
|
56
|
57
|
} from '../settings';
|
|
@@ -216,7 +217,25 @@ export class ImageTrackerPreTrackingBState extends ImageTrackerState
|
216
|
217
|
sourceBuffer.frozen = true;
|
217
|
218
|
|
218
|
219
|
// refine the homography
|
219
|
|
- return this._homography.setTo(warp.times(this._homography));
|
|
220
|
+ //return this._homography.setTo(warp.times(this._homography));
|
|
221
|
+
|
|
222
|
+ // apply filter
|
|
223
|
+ return ImageTrackerUtils.interpolateHomographies(
|
|
224
|
+ this._homography,
|
|
225
|
+ Speedy.Matrix(warp.times(this._homography)),
|
|
226
|
+ PRE_TRACK_FILTER_ALPHA,
|
|
227
|
+ PRE_TRACK_FILTER_BETA
|
|
228
|
+ );
|
|
229
|
+
|
|
230
|
+ })
|
|
231
|
+ .then(filteredHomography => {
|
|
232
|
+
|
|
233
|
+ // test: count the number of iterations needed
|
|
234
|
+ // for stabilization with this setup of the filter
|
|
235
|
+ //console.log(this._iterations);
|
|
236
|
+
|
|
237
|
+ // refine the homography
|
|
238
|
+ return this._homography.setTo(filteredHomography);
|
220
|
239
|
|
221
|
240
|
})
|
222
|
241
|
.then(_ => ({
|
|
@@ -252,7 +271,7 @@ export class ImageTrackerPreTrackingBState extends ImageTrackerState
|
252
|
271
|
return ImageTrackerUtils.findPerspectiveWarpNDC(points, {
|
253
|
272
|
method: 'pransac',
|
254
|
273
|
reprojectionError: PRE_TRACK_RANSAC_REPROJECTIONERROR_NDC,
|
255
|
|
- numberOfHypotheses: 512*8, // we want a really good homography
|
|
274
|
+ numberOfHypotheses: 512,
|
256
|
275
|
bundleSize: 128,
|
257
|
276
|
mask: undefined // score is not needed
|
258
|
277
|
}).then(([ warp, score ]) => {
|
|
@@ -295,7 +314,7 @@ export class ImageTrackerPreTrackingBState extends ImageTrackerState
|
295
|
314
|
|
296
|
315
|
// the best match should be "much better" than the second best match,
|
297
|
316
|
// which means that they are "distinct enough"
|
298
|
|
- if(d1 <= TRACK_MATCH_RATIO * d2) {
|
|
317
|
+ if(d1 <= PRE_TRACK_MATCH_RATIO * d2) {
|
299
|
318
|
const srcKeypoint = srcKeypoints[destKeypoint.matches[0].index];
|
300
|
319
|
pairs.push([srcKeypoint, destKeypoint]);
|
301
|
320
|
}
|