| Crates.io | opencv-sdk |
| lib.rs | opencv-sdk |
| version | 4.8.1 |
| created_at | 2025-07-12 17:26:50.068706+00 |
| updated_at | 2025-07-12 20:26:28.33453+00 |
| description | OpenCV SDK with C/C++/Python API compatibility layer |
| homepage | |
| repository | https://github.com/ruvnet/ruv-FANN |
| max_upload_size | |
| id | 1749524 |
| size | 34,766 |
OpenCV SDK provides a compatibility layer for using OpenCV's Rust implementation with existing C/C++ and Python code. This crate bridges the gap between Rust's safety and performance with legacy codebases that expect OpenCV's traditional API.
Add this to your Cargo.toml:
[dependencies]
opencv-sdk = "4.8.0"
# Optional features
opencv-sdk = { version = "4.8.0", features = ["python", "wasm"] }
use opencv_sdk::prelude::*;
use opencv_core::{Mat, Size, MatType};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new matrix
let mat = Mat::new_size(Size::new(640, 480), MatType::CV_8U)?;
// Use the SDK for interop
let sdk_mat = opencv_sdk::from_mat(&mat)?;
Ok(())
}
#include <opencv_sdk.h>
int main() {
// Create matrix using SDK
cv_Mat* mat = cv_Mat_new();
cv_Mat_new_size_type(mat, 640, 480, CV_8U);
// Use with existing OpenCV C code
process_image(mat);
// Cleanup
cv_Mat_delete(mat);
return 0;
}
python feature)import opencv_sdk
# Create a matrix
mat = opencv_sdk.Mat(640, 480)
# Compatible with numpy
import numpy as np
np_array = mat.to_numpy()
# Process with existing Python OpenCV code
processed = cv2.blur(np_array, (5, 5))
python: Enable Python bindings via PyO3wasm: Enable WebAssembly supportfull: Enable all optional featuresThe SDK provides three layers of compatibility:
opencv-coreThis crate maintains Rust's safety guarantees while providing FFI:
See the examples directory for more usage patterns:
c_interop.c: C/C++ integration examplepython_binding.py: Python usage examplewasm_demo.html: WebAssembly in browserContributions are welcome! Please see our contributing guidelines.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
opencv-core: Core OpenCV data structuresopencv-wasm: WebAssembly bindings