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§
sourcefn opencv_depth() -> i32
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.
sourcefn opencv_channels() -> i32
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§
sourcefn opencv_type() -> i32
fn opencv_type() -> i32
OpenCV value for this type as produced by CV_MAKETYPE()
function
Object Safety§
This trait is not object safe.