fix(motion_estimator): restore affine2d error() and check_subset() (#51) - #52
Merged
Conversation
jsfeatNext's affine2d kernel was missing the error() and check_subset() methods that original jsfeat defines on it, so motion_estimator.ransac / lmeds with an affine2d kernel threw 'kernel.check_subset/error is not a function'. Port both from jsfeat's affine2d (error = affine reprojection residual; check_subset = true). The parity test added in #49 is flipped from pinning the crash to a full parity check: affine2d RANSAC now matches the oracle's 3x3 model and inlier mask on identical seeded data, and rejects the synthetic outliers. npm test: 57 passed; tsc --noEmit: clean. Closes #51 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #51. First fix guarded by the new parity suite (Phase 0, #39).
Bug
jsfeatNext's
affine2dkernel was missing theerror()andcheck_subset()methods that original jsfeat defines on it. Somotion_estimator.ransac()/lmeds()with anaffine2dkernel threwTypeError: kernel.check_subset is not a function(thenkernel.error is not a function) — affine motion estimation was completely broken, while homography2d worked (it has its own overrides).Surfaced by the characterization test added in #49, which had to pin the crash to stay green.
Fix
Port both methods onto
affine2dfrom original jsfeat (src/jsfeat_motion_estimator.js):error()— affine reprojection residualsqr(dx) + sqr(dy)check_subset()— returnstrueTest
The parity test is flipped from
expect(...).toThrow(TypeError)to a full parity check: affine2d RANSAC now returns the sametrue, the same 3×3 model (to 4 decimals), and the same inlier mask as the oracle on identical seeded data, and rejects the synthetic outliers.npm test→ 57 passedtsc --noEmit→ clean🤖 Generated with Claude Code