Trait opencv::prelude::DataType

source ·
pub unsafe trait DataType: Copy {
    // Required methods
    fn opencv_depth() -> i32;
    fn opencv_channels() -> i32;

    // Provided method
    fn opencv_type() -> i32 { ... }
}
Expand description

Implement this trait types that are valid to use as Mat elements.

§Safety

Types implementing this trait must adhere to the memory layout declared by the values returned by opencv_depth() and opencv_channels() functions. In most cases that means that the type must also be #[repr(C)].

Required Methods§

source

fn opencv_depth() -> i32

The shape of bytes occupied by the single layer/channel of the element. E.g. for an 8-bit BGR image it’s CV_8U because a single channel for a pixel is unsigned 8 bits. You should use one of the depth constants for this like CV_8U, CV_8S, CV_32F, etc.

source

fn opencv_channels() -> i32

Amount of layers/channels per element. E.g. for an 8-bit BGR image it’s 3 because one pixel consists of 3 channels: B, G and R.

Provided Methods§

source

fn opencv_type() -> i32

OpenCV value for this type as produced by CV_MAKETYPE() function

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DataType for f32

source§

impl DataType for f64

source§

impl DataType for i8

source§

impl DataType for i16

source§

impl DataType for i32

source§

impl DataType for u8

source§

impl DataType for u16

Implementors§

source§

impl<T: DataType> DataType for Point3_<T>

source§

impl<T: DataType> DataType for Point_<T>

source§

impl<T: DataType> DataType for Rect_<T>

source§

impl<T: DataType> DataType for Size_<T>

source§

impl<T: DataType, const N: usize> DataType for VecN<T, N>