Type conversions among famous Rust computer vision libraries. It supports the following crates:
Add cv-convert to Cargo.toml
to import most conversions by default.
toml
[dependencies.cv-convert]
version = "0.6"
You can manually choose supported libraries to avoid bloating.
toml
version = "0.6"
default-features = false
features = ["opencv-4", "opencv-buildtime-bindgen", "nalgebra"]
opencv crate features
opencv-4
: Enable opencv-4
in opencv crate.opencv-34
: Enable opencv-34
in opencv crate.opencv-32
: Enable opencv-32
in opencv crate.opencv-buildtime-bindgen
: Enable buildtime-bindgen
in opencv crate.opencv-clang-runtime
: Enable clang-runtime
in opencv crate. Useful if you get libclang shared library is not loaded on this thread!
panic.opencv-contrib
: opencv-contrib
has been dropped by the main opencv
crate in favour of runtime module set detection. If you need the older version, 0.5.0 was the version that last supported opencv-0.51.0
. image crate feature
image
nalgebra crate feature
nalgebra
tch crate feature
tch
The crate provides FromCv
, TryFromCv
, IntoCv
, TryIntoCv
traits, which are similar to standard library's From
and Into
.
```rust use cv_convert::{FromCv, IntoCv, TryFromCv, TryIntoCv}; use nalgebra as na; use opencv as cv;
// FromCv
let cvpoint = cv::core::Point2d::new(1.0, 3.0);
let napoints = na::Point2::
// IntoCv
let cvpoint = cv::core::Point2d::new(1.0, 3.0);
let napoints: na::Point2
// TryFromCv let namat = na::DMatrix::fromvec(2, 3, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]); let cvmat = cv::core::Mat::tryfromcv(&namat)?;
// TryIntoCv let namat = na::DMatrix::fromvec(2, 3, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]); let cvmat: cv::core::Mat = namat.tryintocv()?; ```
MIT license. See LICENSE file.