You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebARKitTracker currently runs feature detection (Teblid/AKAZE/ORB) on the full-resolution frame, every frame. The two ArtoolkitX OCVT performance optimizations are disabled:
Pyramid downsampling — PlanarTracker detects on a pyrDown'd detectionFrame and scales keypoints back up via m_featureDetectScaleFactor. In WebARKit the pyrDown block in resetTracking() is commented out.
Detection guard — if (m_currentlyTrackedMarkers < m_maxNumberOfMarkersToTrack) skips detection while already tracking, relying on optical flow. In WebARKit this if is commented out (the original author noted it "doesn't work as expected ... makes tracking unstable").
The leftover scale-up that this created was a correctness bug, fixed in #43 by forcing _featureDetectScaleFactor to identity. The follow-up cleanup (removing the now-vestigial _featureDetectPyrLevel / _featureDetectScaleFactor machinery, keeping full-res detection) is the companion change to this issue.
Goal
Re-introduce the performance optimizations correctly, matching the ArtoolkitX OCVT reference, without the instability the original author hit.
Work
Restore the detectionFrame pyramid (pyrDown to _featureDetectPyrLevel).
Detect features on detectionFrame (downsampled), not the full-res frame.
Restore the keypoint scale-up (pt *= _featureDetectScaleFactor) in MatchFeatures.
Background
WebARKitTrackercurrently runs feature detection (Teblid/AKAZE/ORB) on the full-resolution frame, every frame. The two ArtoolkitX OCVT performance optimizations are disabled:PlanarTrackerdetects on apyrDown'ddetectionFrameand scales keypoints back up viam_featureDetectScaleFactor. In WebARKit thepyrDownblock inresetTracking()is commented out.if (m_currentlyTrackedMarkers < m_maxNumberOfMarkersToTrack)skips detection while already tracking, relying on optical flow. In WebARKit thisifis commented out (the original author noted it "doesn't work as expected ... makes tracking unstable").The leftover scale-up that this created was a correctness bug, fixed in #43 by forcing
_featureDetectScaleFactorto identity. The follow-up cleanup (removing the now-vestigial_featureDetectPyrLevel/_featureDetectScaleFactormachinery, keeping full-res detection) is the companion change to this issue.Goal
Re-introduce the performance optimizations correctly, matching the ArtoolkitX OCVT reference, without the instability the original author hit.
Work
detectionFramepyramid (pyrDownto_featureDetectPyrLevel).detectionFrame(downsampled), not the full-resframe.pt *= _featureDetectScaleFactor) inMatchFeatures.createFeatureMask: it currently builds the mask onframe.size()(full-res) yet divides the bbox by_featureDetectScaleFactor. With downsampling restored it must build the mask ondetectionFrame(downsampled) so the/scaleFactorbbox coords match — otherwise the mask is misaligned. (Latent landmine noted in Feature keypoints double-scaled for frames larger than featureImageMinSize (marker mis-localized at ~2x position) #43.)Notes