PureCV

A high-performance, pure Rust computer vision library focusing on the core and imgproc modules of OpenCV. PureCV is built from the ground up to be memory-safe, thread-safe, and highly portable without the overhead of C++ FFI.
๐ฏ Philosophy
Unlike existing wrappers, PureCV is a native rewrite. It aims to provide:
- Zero-FFI: No complex linking or C++ toolchain requirements.
- Memory Safety: Elimination of segmentation faults and buffer overflows via Rust's ownership model.
- Modern Parallelism: Native integration with Rayon for effortless multi-core processing.
- WASM & Native SIMD: Optimized for the web and high-performance native architectures using explicit SIMD (via
pulp).
โจ Features
purecv-core
- Matrix Operations: Multi-dimensional
Matrix<T>with support for common arithmetic (add,sub,mul,div) and bitwise logic. - Factory Methods: Intuitive initialization with
zeros,ones,eye, anddiag. - Structural:
flip,rotate,transpose,repeat,reshape,hconcat,vconcat. - Math & Stats:
sqrt,exp,log,pow,sum,mean,minMaxLoc,norm. - Channel Management:
split,merge,mixChannels.
purecv-imgproc
- Color Conversions: High-performance
cvt_colorsupporting RGB, BGR, Gray, and more. - Filtering: (In Progress) Fast convolutions and image filters.
๐ Getting Started
Installation
Add the following to your Cargo.toml:
[]
= { = "https://github.com/webarkit/purecv" }
Usage Example
use ;
use ;
Running Examples
Explore the capabilities of PureCV by running the provided examples:
# Basic matrix arithmetic
# Structural operations (flip, rotate, split/merge)
# Color conversion (RGB to Grayscale)
๐งช Testing & Benchmarking
Running Tests
PureCV uses a comprehensive suite of unit tests to ensure correctness and parity with OpenCV.
# Run all tests
Running Benchmarks
Performance is a core focus. You can run benchmarks to see the impact of SIMD and multi-threading on your architecture:
# Run all benchmarks
๐บ Roadmap
- Phase 1: Core Foundation - Matrix types, arithmetic, geometric utilities, and basic structural transforms.
- [/] Phase 2: Performance - SIMD optimizations and benchmarking vs OpenCV C++.
- Phase 3: WebAssembly - Specialized wrappers and multi-threading for the web.
- Phase 4: Image Processing - Advanced filtering, convolutions, and feature detection.
๐ License
This project is licensed under the LGPL-3.0 License.