Struct Mat

Source
pub struct Mat { /* private fields */ }
Expand description

Mat structure - the fundamental data container

Implementations§

Source§

impl Mat

Source

pub fn new() -> Result<Self>

Create a new empty Mat

Source

pub fn new_size(size: Size, mat_type: MatType) -> Result<Self>

Create a Mat with specified dimensions and type

Source

pub fn new_size_with_default( size: Size, mat_type: MatType, _default_value: Scalar, ) -> Result<Self>

Create a Mat with specified dimensions, type, and default value

Source

pub fn from_slice<T>( data: &[T], rows: i32, cols: i32, mat_type: MatType, ) -> Result<Self>

Create a Mat from existing data

Source

pub fn rows(&self) -> i32

Get the number of rows

Source

pub fn cols(&self) -> i32

Get the number of columns

Source

pub fn size(&self) -> Size

Get the size of the matrix

Source

pub fn mat_type(&self) -> MatType

Get the matrix type

Source

pub fn channels(&self) -> i32

Get the number of channels

Source

pub fn is_empty(&self) -> bool

Check if the matrix is empty

Source

pub fn roi(&self, rect: Rect) -> Result<Mat>

Get a region of interest (ROI)

Source

pub fn clone(&self) -> Result<Mat>

Clone the matrix

Source

pub fn copy_to(&self, dst: &mut Mat) -> Result<()>

Copy data to another matrix

Source

pub fn convert_to( &self, dst: &mut Mat, rtype: MatType, _alpha: f64, _beta: f64, ) -> Result<()>

Convert matrix type

Source

pub fn data_ptr(&self) -> *const u8

Get raw data pointer

Source

pub fn data_ptr_mut(&mut self) -> *mut u8

Get mutable raw data pointer

Source

pub fn elem_size(&self) -> usize

Get element size in bytes

Source

pub fn total(&self) -> usize

Get total number of elements

Trait Implementations§

Source§

impl Debug for Mat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Mat

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl MatTrait for Mat

Source§

fn rows(&self) -> i32

Get number of rows
Source§

fn cols(&self) -> i32

Get number of columns
Source§

fn size(&self) -> Size

Get size
Source§

fn mat_type(&self) -> MatType

Get matrix type
Source§

fn channels(&self) -> i32

Get number of channels
Source§

fn is_empty(&self) -> bool

Check if empty
Source§

impl Send for Mat

Source§

impl Sync for Mat

Auto Trait Implementations§

§

impl Freeze for Mat

§

impl RefUnwindSafe for Mat

§

impl Unpin for Mat

§

impl UnwindSafe for Mat

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.