#cv #convert #vision #computer-vision #conversion

cv-convert

Type conversions among famous Rust computer vision libraries

24 releases (breaking)

Uses new Rust 2021

0.19.0 Jun 19, 2022
0.17.2 Feb 12, 2022
0.14.0 Dec 8, 2021
0.13.0 Nov 14, 2021
0.4.0 Mar 26, 2021
Download history 129/week @ 2022-03-16 59/week @ 2022-03-23 29/week @ 2022-03-30 22/week @ 2022-04-06 12/week @ 2022-04-13 8/week @ 2022-04-20 128/week @ 2022-04-27 157/week @ 2022-05-04 355/week @ 2022-05-11 94/week @ 2022-05-18 127/week @ 2022-05-25 169/week @ 2022-06-01 49/week @ 2022-06-08 31/week @ 2022-06-15 15/week @ 2022-06-22 8/week @ 2022-06-29

103 downloads per month

MIT license

96KB
2.5K SLoC

cv-convert

Type conversions among famous Rust computer vision libraries. It supports the following crates:

Usage

This crate allows crate version selection in Cargo features. For example, the feature nalgebra_0-30 enables nalgebra 0.30.x.

[dependencies.cv-convert]
version = 'x.y.z'
features = [
    'image_0-23',
    'opencv_0-62',
    'tch_0-6',
    'nalgebra_0-30',
    'ndarray_0-15',
]

The full feature enable all crates with up-to-date versions.

[dependencies.cv-convert]
version = 'x.y.z'
features = ['full']

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

  • opencv_0-63

Enable the corresponding feature below if you get libclang shared library is not loaded on this thread! panic.

  • opencv_0-62-clang-runtime
  • opencv_0-61-clang-runtime

image

  • image_0-23

ndarray

  • ndarray_0-15

nalgebra

  • nalgebra_0-30
  • nalgebra_0-29
  • nalgebra_0-28
  • nalgebra_0-27
  • nalgebra_0-26

tch

  • tch_0-6

Usage

The crate provides FromCv, TryFromCv, IntoCv, TryIntoCv traits, which are similar to standard library's From and Into.

use cv_convert::{FromCv, IntoCv, TryFromCv, TryIntoCv};
use nalgebra as na;
use opencv as cv;

// FromCv
let cv_point = cv::core::Point2d::new(1.0, 3.0);
let na_points = na::Point2::<f64>::from_cv(&cv_point);

// IntoCv
let cv_point = cv::core::Point2d::new(1.0, 3.0);
let na_points: na::Point2<f64> = cv_point.into_cv();

// TryFromCv
let na_mat = na::DMatrix::from_vec(2, 3, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]);
let cv_mat = cv::core::Mat::try_from_cv(&na_mat)?;

// TryIntoCv
let na_mat = na::DMatrix::from_vec(2, 3, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]);
let cv_mat: cv::core::Mat = na_mat.try_into_cv()?;

License

MIT license. See LICENSE file.

Dependencies

~355KB