cv-convert
Type conversions among famous Rust computer vision libraries. It supports the following crates:
Using this crate
Add this snipplet to your Cargo.toml to include cv-convert with full support.
[]
= "0.14"
= ["full"]
To avoid bloat on unused libraries, it's suggested to specify used libraries manually.
[]
= "0.14"
= ["opencv", "nalgebra"]
The minimum supported rustc is 1.51
You may use older versions of the crate (>=0.6) in order to use rustc versions that do not support const-generics.
Cargo Features
Include everything
full
OpenCV
Enable clang-runtime in opencv crate. It is useful when you get libclang shared library is not loaded on this thread! panic.
opencvopencv-clang-runtime
Image
image
nalgebra
nalgebra
tch
tch
Usage
The crate provides FromCv, TryFromCv, IntoCv, TryIntoCv traits, which are similar to standard library's From and Into.
use ;
use nalgebra as na;
use opencv as cv;
// FromCv
let cv_point = new;
let na_points = from_cv;
// IntoCv
let cv_point = new;
let na_points: Point2 = cv_point.into_cv;
// TryFromCv
let na_mat = from_vec;
let cv_mat = try_from_cv?;
// TryIntoCv
let na_mat = from_vec;
let cv_mat: Mat = na_mat.try_into_cv?;
License
MIT license. See LICENSE file.