cv-convert
Type conversions among famous Rust computer vision libraries. It supports the following crates:
Import to Your Crate
Add cv-convert to Cargo.toml
to import most conversions by default.
[]
= "0.9"
You can manually choose supported libraries to avoid bloating.
= "0.9"
= false
= ["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.
Supported Cargo Features
opencv crate features
opencv-clang-runtime
: Enableclang-runtime
in opencv crate. Useful if you getlibclang shared library is not loaded on this thread!
panic.opencv-contrib
:opencv-contrib
has been dropped by the mainopencv
crate in favour of runtime module set detection. If you need the older version, 0.5.0 was the version that last supportedopencv-0.51.0
.opencv-4
,opencv-34
,opencv-32
,opencv-buildtime-bindgen
: These features have been dropped in opencv-0.53.0 in favour of runtime generation and detection. cv-convert-0.6 was the last version that supportedopencv-0.52.0
, which had these features.
image crate feature
image
nalgebra crate feature
nalgebra
- With the arrival of
nalgebra
0.26, const-generic are used in this crate and are incompatible with previous versions ofnalgebra
. If you are pulling in previous versions ofnalgebra
, please use 0.6 or older.
tch crate feature
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.