Trait opencv::core::DataType

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

    // Provided methods
    fn opencv_type() -> i32 { ... }
    fn depth() -> i32 { ... }
    fn channels() -> i32 { ... }
    fn typ() -> 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

source

fn depth() -> i32

👎Deprecated: Use opencv_depth() instead. Removal in July 2023
source

fn channels() -> i32

👎Deprecated: Use opencv_channels() instead. Removal in July 2023
source

fn typ() -> i32

👎Deprecated: Use opencv_type() instead. Removal in July 2023

Implementations on Foreign Types§

source§

impl DataType for u8

source§

impl DataType for i16

source§

impl DataType for i32

source§

impl DataType for u16

source§

impl DataType for f64

source§

impl DataType for f32

source§

impl DataType for i8

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>