Try the Live In-Browser WebAssembly Demo → — drag and drop two images to run SIFT feature extraction, RANSAC matching, and homography stitching 100% locally in your browser (no Rust install or server upload required).
A 100% pure-Rust, zero-unsafe (#![forbid(unsafe_code)]) computer vision engine, CLI, visual catalog indexer, and Axum HTTP workbench implementing SIFT (Scale-Invariant Feature Transform, expired patent US6711293B1), 2D Similarity RANSAC, and 4-Point DLT Planar Homography RANSAC.
Zero C/C++ FFI, zero OpenCV/CMake/LLVM build dependencies — compiles cleanly to static binaries, Docker sidecars, mobile targets, and WebAssembly (--no-default-features omits axum/tokio).
636 geometric RANSAC inliers matched across rotated, scaled aerial tiles (pure-sift visualize-matches).
Planar 3x3 Homography alignment and feather-blended stitch (pure-sift align).
Core Capabilities
- Scale-Space DoG Keypoints (
src/pipeline.rs): Separable Gaussian pyramid, Difference-of-Gaussians, Hessian edge filtering, and 3D Taylor sub-pixel / sub-scale extremum refinement (< 0.12 pxlocalization on smooth Gaussian blobs). - Canonical Orientation & 128-D SIFT Descriptors:
>= 80%secondary orientation peak splitting + Rayon-parallelized 128-D descriptor extraction. - Geometric Verification & Alignment: Lowe ratio matching, 2D Similarity RANSAC, horizon-guarded 4-point DLT 3x3 Homography estimation (
estimate_homography_ransac), and bilinear inverse-mapped feather-blended stitching (src/visualize.rs). - Visual Catalog Search (
src/catalog.rs): 128-bitXOR + POPCNTcoarse Hamming shortlisting followed by exact 128-D L2 + geometric RANSAC verification. - CLI + Optional Single-Binary Web UI (
src/main.rs,src/web_ui.html): Drop-in Axum API and embedded 3-tab browser workbench (Keypoints & Descriptors,Match & Stitch Alignment,Visual Catalog Search).
Quick Start
Use as a Rust Library
Add pure-sift to your Cargo.toml (use default-features = false for WASM, mobile, or library-only builds without axum/tokio):
[dependencies] pure-sift = { version = "0.1", default-features = false } image = "0.25"
use image::ImageReader; use pure_sift::{ DEFAULT_CONTRAST_THRESHOLD, DEFAULT_MATCH_RATIO, DEFAULT_RANSAC_REPROJ_THRESHOLD, estimate_homography_ransac, extract_sift_features, luma_to_array2, match_descriptors, }; fn main() -> Result<(), Box<dyn std::error::Error>> { let q_luma = ImageReader::open("query.jpg")?.decode()?.into_luma8(); let t_luma = ImageReader::open("target.jpg")?.decode()?.into_luma8(); let q_feats = extract_sift_features(&luma_to_array2(&q_luma), 3, 3, DEFAULT_CONTRAST_THRESHOLD); let t_feats = extract_sift_features(&luma_to_array2(&t_luma), 3, 3, DEFAULT_CONTRAST_THRESHOLD); let matches = match_descriptors(&q_feats, &t_feats, DEFAULT_MATCH_RATIO); let (inliers, homography) = estimate_homography_ransac(&matches, DEFAULT_RANSAC_REPROJ_THRESHOLD); println!("RANSAC Homography inliers: {} / {}", inliers.len(), matches.len()); if let Some(h) = homography { println!("3x3 Homography matrix: {:?}", h.matrix); } Ok(()) }
Run the Embedded Web UI & HTTP Microservice
cargo run --release -- serve --bind 127.0.0.1:3000
# Open http://127.0.0.1:3000/ in your browserUse as a CLI Tool
# Build release binary cargo build --release # Extract DoG keypoints & 128-D SIFT descriptors ./target/release/pure-sift extract image.jpg --descriptors --pretty -o features.json # Match features & estimate 2D Similarity + 3x3 Homography transforms ./target/release/pure-sift match query.jpg target.jpg --pretty -o matches.json # Render keypoint overlay or side-by-side inlier matches ./target/release/pure-sift visualize image.jpg -o keypoints.png ./target/release/pure-sift visualize-matches query.jpg target.jpg -o matches.png # Warp & feather-blend query onto target via Homography ./target/release/pure-sift align query.jpg target.jpg -o aligned.png # Build and query a 128-bit Hamming + RANSAC visual catalog ./target/release/pure-sift catalog-build ./photos -o catalog.json ./target/release/pure-sift catalog-search catalog.json probe.jpg --pretty
HTTP API Endpoints
GET /— Embedded interactive HTML/JS SIFT & RANSAC workbenchGET /health— JSON readiness probePOST /api/v1/process-features— Extract keypoints (and optional 128-D descriptors)POST /api/v1/match-features— Match two images + Similarity & Homography transformsPOST /api/v1/visualize-features— Keypoint scale/orientation overlay PNGPOST /api/v1/align-images— Stitched homography warp (mode=stitch) or match lines (mode=matches) PNGGET /api/v1/catalog|POST /api/v1/catalog/index|POST /api/v1/catalog/search
Benchmarks & Specification
- Full mathematical derivation &
US6711293B1compliance notes:patent_analysis.md - Real-camera validation benchmarks tested with
pure-sift:- Object in Clutter (
box.pngvs.box_in_scene.png):17/22Similarity inliers,18/22Homography inliers - Oxford VGG 3D Viewpoint Tilt (
graf1.pngvs.graf3.png):52/103(50.5%) Homography inliers vs.11/103rigid-only Similarity - 10-MP DSLR Panorama (
boat1.jpgvs.boat2.jpg,3888x2592):470/617(76.2%) Homography inliers stitched to5411x2998
- Object in Clutter (
License
Dual-licensed under either of:
- Apache License, Version 2.0 (
LICENSE-APACHE) - MIT License (
LICENSE-MIT)
at your option.