Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ The unified core library containing all AR functionality:
- `kpm::ref_data_set` — `.fset3` reference data I/O and compression modes.
- `kpm::types` — KPM data structures and constants.
- `kpm::freak` — FREAK descriptor math, homography, and matching utilities (pure Rust port of `WebARKitLib/lib/SRC/KPM/FreakMatcher`):
- `freak::visual_database` — top-level per-frame query orchestrator (M9-1): builds the query keyframe, then runs the two-pass pipeline (feature match → Hough voting → homography → inlier filter, then a homography-guided re-match) across stored reference keyframes. Exposes `query` / `query_from_keyframe` and facade-parity accessors on the database + `FeatureStore` slices (#147, #148).
- `freak::math` — linear algebra (matrix operations, linear solvers) and Padé matrix exponential.
- `freak::homography` — homography estimation and refinement pipeline.
- `freak::hough` — Hough similarity voting (4D bin discretization over translation × angle × scale) for filtering matches by transformation consistency.
- `freak::clustering` — K-Medoids partitioning + Binary Hierarchical Clustering (BHC) vocabulary tree for fast approximate-NN search on 96-byte FREAK descriptors. Hamming distance via 24×32-bit bit-magic. Includes a byte-identical port of C++ `vision::FastRandom` / `vision::ArrayShuffle` so the BHC tree topology matches the C++ baseline given the same seed.
- `freak::matcher` — `FeatureStore` (points + flat descriptor buffer) and `FeatureMatcher` with three match variants: brute force, BHC-indexed (fast path), and homography-guided (spatial filter via 3×3 inverse + `tr` radius). All three apply the C++ ratio test (default 0.7) and filter by `FeaturePoint::maxima`.
- `freak::image_pyramid` — image pyramid construction via `BoxFilterPyramid8u` (box filtering for 8-bit grayscale) and `BinomialPyramid32f` (32-bit floating-point binomial pyramid with scale-space interpolation).
- `freak::gaussian_pyramid` — Gaussian scale-space pyramid driving the DoG detector. Hot binomial-filter passes have NO-FMA SSE4.1 / AVX2 / wasm SIMD paths (runtime-detected, bit-exact against the scalar fallback for dual-mode parity) and rayon-parallelized rows (v0.8.0, #200–#207).
- `freak::feature_extraction` — keypoint detection via Difference-of-Gaussians (DoG), dominant orientation assignment via circular gradient voting, and FREAK descriptor computation with native Rust implementation of the FREAK binary pattern and bit-pair comparison.
- **Types** (`types`): core data structures (`ARHandle`, `ARParam`, etc.).

Expand All @@ -50,6 +52,13 @@ The unified core library containing all AR functionality:
WASM wrapper and JavaScript/TypeScript glue code for browser targets.
Depends only on `webarkitlib-rs` (the core crate).

Since **v0.8.0 (#161)** it exposes the pure-Rust NFT pipeline to the
browser: a `WasmKpmHandle` binding for KPM detection (load reference data
from bytes, detect), `console_log` wiring via `ar_log_init_wasm()`, a dual
**standard + SIMD** build pipeline (`npm run build:wasm`), and an
end-to-end browser NFT demo under `crates/wasm/www`. The `cc`/`bindgen`
build dependencies are optional so the wasm target builds pure-Rust.

## Feature Flags

| Feature | Description |
Expand All @@ -58,6 +67,7 @@ Depends only on `webarkitlib-rs` (the core crate).
| `simd` | Umbrella: enables all SIMD sub-features |
| `simd-wasm32` | WASM SIMD128 intrinsics |
| `simd-x86-sse41` | x86 SSE4.1 intrinsics |
| `simd-x86-avx2` | x86 AVX2 intrinsics (runtime-detected; NO-FMA for bit-exact scalar parity) |
| `log-helpers` | Enable logging infrastructure (installs `env_logger` for desktop/tests, `console_log` for WASM) |
| `ffi-backend` | **Opt-in** — compile the C++ FreakMatcher library and generate FFI bindings. Used for cross-validation and the regression-test suite; not required for production tracking. |
| `dual-mode` | Enables FFI-based parity tests that validate pure-Rust ports against the live C++ baseline (M6 math/solvers/homography, M7 BHC/matcher, PRNG). Transitively enables `ffi-backend`. Run in CI on Linux/macOS/Windows. |
Expand Down
72 changes: 70 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,76 @@
# Changelog - webarkit/webarkitlib-rs
# Changelog - webarkit/webarkitlib-rs

All notable changes to this project will be documented in this file.

## [0.7.0] - 2026-06-05
## [0.8.0] - 2026-06-26

## Milestone — Pure-Rust completeness, validation & polish

### ⚙️ Miscellaneous Tasks

- *(ar2)* Allow too_many_arguments on SIMD get_similarity variants (#180)
- Clear strict clippy lints in examples/tests/benches (#180)
- *(codecov)* Exclude examples/benches from coverage targets (#180)
- *(coverage)* Fix tarpaulin tests/ glob and mirror in codecov (#180)
- Tighten clippy gate to --all-targets --all-features (#180)
- Relocate strict clippy gate to kpm-build (ubuntu) job (#180)
- *(miri)* Add Miri UB validation for pure-Rust code paths (#182)
- *(miri)* Drop -Zmiri-strict-provenance (trips on third-party deps) (#182)
- *(miri)* Switch to Tree Borrows to avoid crossbeam-epoch false positive (#182)
- *(miri)* Enable -Zmiri-disable-isolation for tempfile-using tests (#182)
- *(miri)* Enable -Zmiri-ignore-leaks for rayon thread pool (#194)
- *(miri)* Promote to required gate, split workflow, add README badge (#182)
- *(miri)* Skip docs-only changes via paths-ignore + same-name shim
- *(benchmarks)* Harden against flaky external C-library downloads (#204)

### ⚡ Performance

- *(ci)* Scope Miri job to unsafe boundaries via cfg_attr(miri, ignore) (#194)
- *(ci)* Annotate remaining real-image tests (#194 follow-up)
- *(kpm)* Gaussian scale-space pyramid — benchmark + rayon parallelization (#209)
- *(kpm)* Box-filter Pyramid downsample — criterion benchmark + SIMD (#211)

### 🐛 Bug Fixes

- *(core)* Clean up trivial clippy lints under --all-targets --all-features (#180)
- *(kpm)* Tighten dual-mode FFI extern cfg to match caller cfg (#180)
- *(kpm)* Replace unaligned transmute in hamming_distance_96 (#192)
- *(ci)* Disable cargo-bin cache on kpm-build to stop stale rustup-init shim (#134)

### 💼 Other

- *(wasm)* Make cc/bindgen optional, fix wasm dead-code (#161 goal 1)

### 📚 Documentation

- *(benches)* Refresh BENCHMARKS.md for criterion 0.8
- *(agents)* Codify #180 clippy conventions and un-ignore .agents/
- *(kpm)* Mark box-filter Pyramid as kept-but-unused reference (#203)
- *(wasm)* Note .fset3 / KPM detection in the NFT demo description (#161)
- Update README + ARCHITECTURE for the v0.8.0 milestone

### 🕸️ WebAssembly & Emscripten

- *(wasm)* Wire console logger + clean SIMD wasm build; add .fset3 asset (#161 goals 2,3)
- *(wasm)* KPM detection binding + browser NFT demo (#161 goal 4)

### 🚀 Features

- *(kpm)* Facade-parity convenience accessors on VisualDatabase + FeatureStore slices (#148)
- *(example)* Nft_marker_gen .fset3 via RustFreakMatcher — drop ffi-backend (#179)

### 🚜 Refactor

- *(ar)* Convert Default::default() + field reassign to struct-init (#180)
- *(kpm)* Factor VisualDatabase::query matching loop + add query_from_keyframe (#147) (#217)

### 🧪 Testing

- *(core)* Add unit tests for relocated math/pattern helpers (#180)
- *(homography)* Widen cauchy_cost tolerance to 1e-5 for Miri (#194)
- *(kpm)* Raise M9 coverage — exclude examples + edge tests (#177) (#218)
- *(ci)* Verify ffi-backend tests + example link on macOS (#119)
## [0.7.0] - 2026-06-05

## Milestone 9 — VisualDatabase & pure Rust backend

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exclude = [
resolver = "2"

[workspace.package]
version = "0.7.0"
version = "0.8.0"
authors = ["kalwalt <github@kalwaltart.it>"]
edition = "2021"
description = "A high-performance, memory-safe Rust port of WebARKitLib (ARToolKit) for native and WASM."
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
This project aims to provide a pure-Rust implementation of the core ARToolKit algorithms, targeting both **native** systems and **WebAssembly (WASM)** for high-performance augmented reality in the browser.

> [!NOTE]
> This project is currently a **Work in Progress**. Core marker detection and pose estimation are functional. KPM/NFT (Natural Feature Tracking) is in an early stage with partial Rust porting -- a fully idiomatic Rust KPM pipeline with a working example is the primary goal for v1.0.0.
> Core marker detection and pose estimation are functional, and as of **v0.8.0** the **KPM/NFT (Natural Feature Tracking) pipeline is fully ported to pure Rust** — end-to-end keypoint matching, marker generation (`.iset`/`.fset`/`.fset3`), and runtime tracking all run with **no C++ toolchain**, natively and in the browser via WebAssembly. The project remains a **Work in Progress** toward v1.0.0 (broader API docs, multi-marker support, and a dedicated KPM benchmark are the remaining focus areas).

## 🌟 Key Features

Expand All @@ -40,7 +40,7 @@ Add `webarkitlib-rs` to your `Cargo.toml`:

```toml
[dependencies]
webarkitlib-rs = "0.7"
webarkitlib-rs = "0.8"
```

### Pure Rust tracking (no C++ compiler required)
Expand All @@ -66,7 +66,7 @@ need to do anything special:

```toml
[dependencies]
webarkitlib-rs = "0.7" # default backend is pure Rust
webarkitlib-rs = "0.8" # default backend is pure Rust
```

```bash
Expand All @@ -83,7 +83,7 @@ NFT tracking**:

```toml
[dependencies]
webarkitlib-rs = { version = "0.7", features = ["ffi-backend"] }
webarkitlib-rs = { version = "0.8", features = ["ffi-backend"] }
```

> When installing from crates.io, no extra setup is required — the C++
Expand Down Expand Up @@ -248,7 +248,7 @@ Enable the `log-helpers` feature and call the bundled initializer once in your b

```toml
[dependencies]
webarkitlib-rs = { version = "0.7", features = ["log-helpers"] }
webarkitlib-rs = { version = "0.8", features = ["log-helpers"] }
```

```rust
Expand Down Expand Up @@ -429,12 +429,16 @@ The workspace contains two crates:
- Cross-platform / cross-stack matcher determinism — Rust `HashMap` → `BTreeMap` and upstream C++ `unordered_map` → `std::map` ([WebARKitLib#39](https://github.com/webarkit/WebARKitLib/pull/39)).
- Hand-annotated absolute corner-error regression gate (browser-based annotation tool + 5 fixtures + Linux CI gate). Finding: pure-Rust backend is more accurate than C++ on `pinball-demo` (5.27 px vs 18.79 px max corner error).
- Cross-stack parity gate against `@webarkit/jsartoolkit-nft@1.10.0` ([jsartoolkitNFT#584](https://github.com/webarkit/jsartoolkitNFT/pull/584)) — guarantees native Rust pose matches what production WASM consumers see.
- **v0.8.0 — Pure-Rust completeness, validation & polish**: Closed out the remaining gaps on top of M9:
- **Full WASM/NFT support** ([#161](https://github.com/webarkit/WebARKitLib-rs/issues/161)): `WasmKpmHandle` KPM-detection bindings, `console_log` wiring, clean dual (standard + SIMD) wasm builds, and an end-to-end **browser NFT demo** of the pure-Rust pipeline.
- **Pure-Rust `.fset3` marker generation** ([#179](https://github.com/webarkit/WebARKitLib-rs/issues/179)): `nft_marker_gen` now produces `.iset` + `.fset` + `.fset3` entirely via `RustFreakMatcher` — the `ffi-backend` is no longer needed for marker creation.
- **`VisualDatabase` ergonomics** ([#147](https://github.com/webarkit/WebARKitLib-rs/issues/147), [#148](https://github.com/webarkit/WebARKitLib-rs/issues/148)): factored the per-frame query loop, added `query_from_keyframe`, and facade-parity accessors on `VisualDatabase` + `FeatureStore` slices.
- **Gaussian scale-space pyramid performance** ([#200](https://github.com/webarkit/WebARKitLib-rs/issues/200)/[#201](https://github.com/webarkit/WebARKitLib-rs/issues/201)/[#207](https://github.com/webarkit/WebARKitLib-rs/issues/207)): criterion benchmark, NO-FMA SSE4.1/AVX2/wasm SIMD binomial filter with bit-exact scalar parity, and rayon-parallelized filter passes.
- **Validation & CI hardening**: raised M9 patch coverage ≥90% ([#177](https://github.com/webarkit/WebARKitLib-rs/issues/177)), Miri UB gate ([#182](https://github.com/webarkit/WebARKitLib-rs/issues/182)), strict `--all-targets --all-features` clippy gate ([#180](https://github.com/webarkit/WebARKitLib-rs/issues/180)), benchmark download hardening ([#204](https://github.com/webarkit/WebARKitLib-rs/issues/204)), and macOS/Windows build + cache fixes ([#134](https://github.com/webarkit/WebARKitLib-rs/issues/134), [#119](https://github.com/webarkit/WebARKitLib-rs/issues/119)).

### 🎯 Short-term Goals (toward v1.0.0)
- **KPM-specific benchmark** ([deferred from #142](https://github.com/webarkit/WebARKitLib-rs/issues/142)): Add a dedicated `kpm_bench.rs` Criterion bench so we can verify the pure-Rust backend stays within 20% of C++ on `pinball-demo`. The existing `marker_bench` only measures barcode marker detection.
- **WASM browser examples for KPM/NFT** ([#161](https://github.com/webarkit/WebARKitLib-rs/issues/161)): End-to-end runnable browser demo of the pure-Rust NFT pipeline.
- **Raise M9 patch coverage** ([#177](https://github.com/webarkit/WebARKitLib-rs/issues/177)): Lift M9 modules from 84.76% → ≥90% patch coverage with no file under 85%.
- **Dependency upgrades**: Criterion 0.5 → 0.8 ([#174](https://github.com/webarkit/WebARKitLib-rs/issues/174)).
- **Live-camera WASM demo + pose parity** ([#215](https://github.com/webarkit/WebARKitLib-rs/issues/215)): Extend the browser NFT demo with a live camera feed and jsartoolkitNFT pose parity.
- **Enhanced Documentation**: Expand API reference with complete module-level docs, integration walkthroughs for JS/TS, and detailed usage examples.
- **WASM Memory Management**: Improve resource cleanup when switching engines or markers in long-running browser sessions.

Expand Down
Loading
Loading