Skip to content

Implement BFMatcher and document AKAZE differences#79

Merged
kalwalt merged 3 commits into
devfrom
feat/feature-matching-infrastructure
Jun 27, 2026
Merged

Implement BFMatcher and document AKAZE differences#79
kalwalt merged 3 commits into
devfrom
feat/feature-matching-infrastructure

Conversation

@kalwalt

@kalwalt kalwalt commented Jun 26, 2026

Copy link
Copy Markdown
Member

This pull request introduces a new feature matching visualization example and implements a set of drawing utilities for feature detection and matching in the purecv library. It also implements BFMatcher and DMatch for descriptor matching. The main changes include a new example demonstrating ORB feature matching and a new draw.rs module for visualizing keypoints and matches, both with detailed documentation and LGPLv3+ licensing headers.

New Example and Visualization Utilities

Example and Usage

  • Added a new example examples/match_features.rs that demonstrates ORB feature detection, extraction, matching (with mutual cross-check using BFMatcher), and visualization. The example loads examples/data/graf.png (a stitched image), splits it down the middle, detects and matches features, draws the matches, and saves the result to examples/data/out/graf_matches.png. Extensive documentation and usage instructions are included.
  • Added examples/data/graf.png as test data for the example.

Feature Matching Infrastructure (src/features2d/matcher.rs)

  • Implemented BFMatcher (Brute-Force Matcher) with support for NormType (including NormHamming for binary descriptors) and optional cross-check for mutual consistency filtering.
  • Introduced the DMatch struct to represent individual descriptor matches.
  • BFMatcher implements the DescriptorMatcher trait via the match_descriptors method.

Drawing Utilities for Feature Visualization (src/features2d/draw.rs)

Introduced a new draw.rs module implementing pixel-level drawing utilities:

  • Functions for drawing lines (Bresenham's algorithm) and circles (midpoint algorithm).
  • The draw_keypoints function draws circles and orientation lines for detected keypoints.
  • The draw_matches function visualizes matches between two images by drawing lines between corresponding keypoints. Supports random or fixed line colors; passing None for the unmatched-keypoints parameter suppresses their rendering.
  • All functions are documented, and the module includes an LGPLv3+ license header with classpath exception.

Module and Library Updates

  • Updated src/features2d/mod.rs to expose the new draw and matcher submodules and re-export their public API.
  • Updated src/lib.rs accordingly.
  • Added tests in src/features2d/tests.rs covering the new functionality.

Note: This example differs from the OpenCV AKAZE matching and tracking tutorials in that purecv implements ORB and FAST rather than AKAZE, and matches are filtered using mutual consistency (cross_check = true) rather than homography estimation.

@kalwalt kalwalt self-assigned this Jun 26, 2026
@kalwalt kalwalt added documentation Improvements or additions to documentation enhancement New feature or request rust-code rust Pull requests that update rust code features2D-module labels Jun 26, 2026
- Add BFMatcher and match_features usage examples to README

- Add rustdoc examples to src/features2d/mod.rs

- Update roadmap to remove completed milestones and add Milestone 7
@kalwalt kalwalt merged commit 5ad4f11 into dev Jun 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request features2D-module rust Pull requests that update rust code rust-code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant