r/computervision • u/HorsePuzzleheaded803 • 15d ago
Showcase I built a 100% pure-Rust implementation of SIFT, RANSAC homography, and image stitching (zero OpenCV/C++ FFI dependencies)
636 geometric RANSAC inliers matched across rotated and scaled aerial tiles
Seamless panoramic stitch generated using 4-point DLT homography and bilinear feather blending
Hi r/computervision,
If you have ever had to bundle OpenCV into a Docker container, deploy to an embedded target, or compile across platforms without wrestling with CMake and C++ shared library dependencies, you know how heavy the toolchain friction can be.
To make classic feature extraction lightweight and portable, I built pure-sift: an open-source, 100% pure-Rust library implementing Lowe's SIFT (Scale-Invariant Feature Transform, US6711293B1 patent expired in 2020), 2D Similarity RANSAC, 4-Point DLT Planar Homography, and an automated image stitcher with zero OpenCV or C++ dependencies.
- GitHub: https://github.com/dannkkie/pure-sift
- crates.io: https://crates.io/crates/pure-sift
Technical Implementation:
- SIFT Scale Space:
- Octave pyramid generation with separable 1D Gaussian kernels.
- Difference-of-Gaussians (DoG) scale-space extrema detection across 26-neighborhood volumes.
- 3D quadratic Taylor-expansion sub-pixel and sub-scale localization (< 0.12 px error).
- Hessian edge-ratio filtering ➡️ (r <= 10.0) using the trace and determinant to discard flat edges.
- Secondary orientation peak splitting (peaks within 80% generate extra keypoints).
- 128-dimensional illumination-invariant gradient descriptors, parallelized via Rayon.
- Robust Feature Matching & Geometry:
- Lowe’s ratio test (threshold 0.75) for 128-D Euclidean nearest-neighbor matching.
- 2-point 2D Similarity RANSAC (rotation, scale, translation).
- 4-point Direct Linear Transform (DLT) 3x3 Homography RANSAC with horizon validation ➡️ (det(H) > 0).
- Bilinear feather-blended panoramic stitcher.
- Visual Catalog & Retrieval:
- 128-bit compact Hamming binary hash index + geometric RANSAC reranking for image identification.
- Portability:
- Zero unsafe code (
#![forbid(unsafe_code)]). - Core math and image processing compile cleanly with
--no-default-featuresfor embedded, static binary, or WebAssembly (WASM) environments.
- Zero unsafe code (
Dual-licensed under MIT or Apache-2.0.
I would love to get your feedback, hear about your edge cases, and see what benchmarks you would like to see compared to OpenCV's implementation!
2
u/loss182 9d ago
Very nice work! Tried your web demo with some agricultural drone images with low overlap (20%) and it was able to tie the images together nicely! Looking forward for the future development of this!
Later I will try to run it locally with the full resolution image to see how fast it runs