-
Notifications
You must be signed in to change notification settings - Fork 72
Implement newer FAST Corner Detector #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Nvm, |
- Replace free functions with FastDetector struct and methods - Update benchmarks, tests, and example to use FastDetector - Improve mask handling and keypoint extraction logic
- Rename `corner_fast` to `compute_corner_response` - Rename `get_keypoints` to `extract_keypoints` - Add and expand doc comments for public methods and struct fields - Refactor internal logic for clarity and parallelism - Update examples and benchmarks to use new method names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a newer FAST (Features from Accelerated Segment Test) corner detector, replacing the previous function-based implementation with a stateful FastDetector
struct. The new implementation includes corner response computation, non-maximum suppression, and configurable minimum distance between keypoints.
Key changes:
- Replaced the simple
fast_feature_detector
function with a comprehensiveFastDetector
struct - Added corner response computation and keypoint extraction as separate steps
- Introduced minimum distance filtering to reduce clustering of detected keypoints
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
examples/fast_detector/src/main.rs | Updated to use new FastDetector API with additional parameters and separate computation steps |
examples/fast_detector/README.md | Updated documentation to reflect new command-line interface and parameters |
examples/fast_detector/Cargo.toml | Removed unnecessary "gstreamer" feature dependency |
crates/kornia-imgproc/src/features/fast.rs | Complete rewrite implementing stateful FastDetector with corner response computation and keypoint extraction |
crates/kornia-imgproc/benches/bench_features.rs | Updated benchmark to use new FastDetector API and added detector clearing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if consecutive_count == n { | ||
curr_response = 0; | ||
circle_intensities.iter().for_each(|m| { | ||
curr_response = curr_response.saturating_add(m.saturating_sub(curr_pixel)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The corner response calculation is incorrect. When m < curr_pixel
, m.saturating_sub(curr_pixel)
returns 0, which doesn't contribute to the response. For darker pixels, the calculation should use curr_pixel.saturating_sub(*m)
to get the actual intensity difference.
curr_response = curr_response.saturating_add(m.saturating_sub(curr_pixel)); | |
curr_response = curr_response.saturating_add((i16::from(*m) - i16::from(curr_pixel)).abs() as u8); |
Copilot uses AI. Check for mistakes.
(yy as isize - y as isize) | ||
.abs() | ||
.max((xx as isize - x as isize).abs()) | ||
< min_distance as isize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The distance calculation uses Chebyshev distance (max of absolute differences) but the condition should be <= min_distance
instead of < min_distance
to properly suppress points exactly at the minimum distance.
(yy as isize - y as isize) | |
.abs() | |
.max((xx as isize - x as isize).abs()) | |
< min_distance as isize | |
<= min_distance as isize |
Copilot uses AI. Check for mistakes.
$ cargo run -p fast_detector --release -- --image-path "path/to/image.png" --min-distance 10 --threshold 30
Benchmark
TODOs