pub struct Mat_<T> { /* private fields */ }
Expand description
This struct is freely convertible into and from Mat
using into
and try_from
methods. You might want
to convert Mat
to Mat_
before calling typed methods (like at
, data_typed
) when more performance is
required because this way you will skip the data type checks (still WIP, not all methods are covered).
Implementations§
source§impl<T: DataType> Mat_<T>
impl<T: DataType> Mat_<T>
pub fn into_untyped(self) -> Mat
pub fn as_untyped(&self) -> &Mat
pub fn as_raw_Mat_(&self) -> *const c_void
pub fn as_raw_mut_Mat_(&mut self) -> *mut c_void
pub fn at(&self, i0: i32) -> Result<&T>
pub fn at_mut(&mut self, i0: i32) -> Result<&mut T>
pub fn data_typed(&self) -> Result<&[T]>
pub fn data_typed_mut(&mut self) -> Result<&mut [T]>
Trait Implementations§
source§impl<T> Boxed for Mat_<T>
impl<T> Boxed for Mat_<T>
source§impl<T> MatTrait for Mat_<T>
impl<T> MatTrait for Mat_<T>
fn as_raw_mut_Mat(&mut self) -> *mut c_void
source§fn set_rows(&mut self, val: i32)
fn set_rows(&mut self, val: i32)
the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
source§fn set_cols(&mut self, val: i32)
fn set_cols(&mut self, val: i32)
the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
source§fn set_to(
&mut self,
value: &impl ToInputArray,
mask: &impl ToInputArray
) -> Result<Mat>
fn set_to( &mut self, value: &impl ToInputArray, mask: &impl ToInputArray ) -> Result<Mat>
Sets all or some of the array elements to the specified value. Read more
source§unsafe fn create_rows_cols(
&mut self,
rows: i32,
cols: i32,
typ: i32
) -> Result<()>
unsafe fn create_rows_cols( &mut self, rows: i32, cols: i32, typ: i32 ) -> Result<()>
Allocates new array data if needed. Read more
source§unsafe fn create_size(&mut self, size: Size, typ: i32) -> Result<()>
unsafe fn create_size(&mut self, size: Size, typ: i32) -> Result<()>
Allocates new array data if needed. Read more
source§unsafe fn create_nd(&mut self, sizes: &[i32], typ: i32) -> Result<()>
unsafe fn create_nd(&mut self, sizes: &[i32], typ: i32) -> Result<()>
Allocates new array data if needed. Read more
source§unsafe fn create_nd_vec(&mut self, sizes: &Vector<i32>, typ: i32) -> Result<()>
unsafe fn create_nd_vec(&mut self, sizes: &Vector<i32>, typ: i32) -> Result<()>
Allocates new array data if needed. Read more
source§fn release(&mut self) -> Result<()>
fn release(&mut self) -> Result<()>
Decrements the reference counter and deallocates the matrix if needed. Read more
source§fn deallocate(&mut self) -> Result<()>
fn deallocate(&mut self) -> Result<()>
internal use function, consider to use ‘release’ method instead; deallocates the matrix data
source§fn reserve(&mut self, sz: size_t) -> Result<()>
fn reserve(&mut self, sz: size_t) -> Result<()>
Reserves space for the certain number of rows. Read more
source§fn reserve_buffer(&mut self, sz: size_t) -> Result<()>
fn reserve_buffer(&mut self, sz: size_t) -> Result<()>
Reserves space for the certain number of bytes. Read more
source§fn resize_with_default(&mut self, sz: size_t, s: Scalar) -> Result<()>
fn resize_with_default(&mut self, sz: size_t, s: Scalar) -> Result<()>
Changes the number of matrix rows. Read more
source§fn push_back(&mut self, m: &Mat) -> Result<()>
fn push_back(&mut self, m: &Mat) -> Result<()>
Adds elements to the bottom of the matrix. Read more
source§fn pop_back(&mut self, nelems: size_t) -> Result<()>
fn pop_back(&mut self, nelems: size_t) -> Result<()>
Removes elements from the bottom of the matrix. Read more
source§fn adjust_roi(
&mut self,
dtop: i32,
dbottom: i32,
dleft: i32,
dright: i32
) -> Result<Mat>
fn adjust_roi( &mut self, dtop: i32, dbottom: i32, dleft: i32, dright: i32 ) -> Result<Mat>
Adjusts a submatrix size and position within the parent matrix. Read more
source§fn ptr_mut(&mut self, i0: i32) -> Result<*mut u8>
fn ptr_mut(&mut self, i0: i32) -> Result<*mut u8>
Returns a pointer to the specified matrix row. Read more
source§fn ptr_2d_mut(&mut self, row: i32, col: i32) -> Result<*mut u8>
fn ptr_2d_mut(&mut self, row: i32, col: i32) -> Result<*mut u8>
Returns a pointer to the specified matrix row. Read more
source§fn ptr_3d_mut(&mut self, i0: i32, i1: i32, i2: i32) -> Result<*mut u8>
fn ptr_3d_mut(&mut self, i0: i32, i1: i32, i2: i32) -> Result<*mut u8>
Returns a pointer to the specified matrix row. Read more
source§fn ptr_nd_mut(&mut self, idx: &[i32]) -> Result<*mut u8>
fn ptr_nd_mut(&mut self, idx: &[i32]) -> Result<*mut u8>
Returns a pointer to the specified matrix row. Read more
source§fn at_mut<T: DataType>(&mut self, i0: i32) -> Result<&mut T>
fn at_mut<T: DataType>(&mut self, i0: i32) -> Result<&mut T>
Returns a reference to the specified array element. Read more
source§fn at_2d_mut<T: DataType>(&mut self, row: i32, col: i32) -> Result<&mut T>
fn at_2d_mut<T: DataType>(&mut self, row: i32, col: i32) -> Result<&mut T>
Returns a reference to the specified array element. Read more
source§fn at_3d_mut<T: DataType>(
&mut self,
i0: i32,
i1: i32,
i2: i32
) -> Result<&mut T>
fn at_3d_mut<T: DataType>( &mut self, i0: i32, i1: i32, i2: i32 ) -> Result<&mut T>
Returns a reference to the specified array element. Read more
source§fn at_nd_mut<T: DataType>(&mut self, idx: &[i32]) -> Result<&mut T>
fn at_nd_mut<T: DataType>(&mut self, idx: &[i32]) -> Result<&mut T>
Returns a reference to the specified array element. Read more
source§fn at_pt_mut<T: DataType>(&mut self, pt: Point) -> Result<&mut T>
fn at_pt_mut<T: DataType>(&mut self, pt: Point) -> Result<&mut T>
Returns a reference to the specified array element. Read more
source§fn update_continuity_flag(&mut self) -> Result<()>
fn update_continuity_flag(&mut self) -> Result<()>
internal use method: updates the continuity flag
source§impl<T> MatTraitConst for Mat_<T>
impl<T> MatTraitConst for Mat_<T>
fn as_raw_Mat(&self) -> *const c_void
source§fn rows(&self) -> i32
fn rows(&self) -> i32
the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
source§fn cols(&self) -> i32
fn cols(&self) -> i32
the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
fn dataend(&self) -> *const u8
fn datalimit(&self) -> *const u8
fn mat_size(&self) -> MatSize
fn mat_step(&self) -> MatStep
source§fn get_umat(
&self,
access_flags: AccessFlag,
usage_flags: UMatUsageFlags
) -> Result<UMat>
fn get_umat( &self, access_flags: AccessFlag, usage_flags: UMatUsageFlags ) -> Result<UMat>
retrieve UMat from Mat Read more
source§fn row(&self, y: i32) -> Result<Mat>
fn row(&self, y: i32) -> Result<Mat>
Creates a matrix header for the specified matrix row. Read more
source§fn col(&self, x: i32) -> Result<Mat>
fn col(&self, x: i32) -> Result<Mat>
Creates a matrix header for the specified matrix column. Read more
source§fn row_bounds(&self, startrow: i32, endrow: i32) -> Result<Mat>
fn row_bounds(&self, startrow: i32, endrow: i32) -> Result<Mat>
Creates a matrix header for the specified row span. Read more
source§fn row_range(&self, r: &Range) -> Result<Mat>
fn row_range(&self, r: &Range) -> Result<Mat>
Creates a matrix header for the specified row span. Read more
source§fn col_bounds(&self, startcol: i32, endcol: i32) -> Result<Mat>
fn col_bounds(&self, startcol: i32, endcol: i32) -> Result<Mat>
Creates a matrix header for the specified column span. Read more
source§fn col_range(&self, r: &Range) -> Result<Mat>
fn col_range(&self, r: &Range) -> Result<Mat>
Creates a matrix header for the specified column span. Read more
source§fn try_clone(&self) -> Result<Mat>
fn try_clone(&self) -> Result<Mat>
Creates a full copy of the array and the underlying data. Read more
source§fn copy_to(&self, m: &mut impl ToOutputArray) -> Result<()>
fn copy_to(&self, m: &mut impl ToOutputArray) -> Result<()>
Copies the matrix to another one. Read more
source§fn copy_to_masked(
&self,
m: &mut impl ToOutputArray,
mask: &impl ToInputArray
) -> Result<()>
fn copy_to_masked( &self, m: &mut impl ToOutputArray, mask: &impl ToInputArray ) -> Result<()>
Copies the matrix to another one. Read more
source§fn convert_to(
&self,
m: &mut impl ToOutputArray,
rtype: i32,
alpha: f64,
beta: f64
) -> Result<()>
fn convert_to( &self, m: &mut impl ToOutputArray, rtype: i32, alpha: f64, beta: f64 ) -> Result<()>
Converts an array to another data type with optional scaling. Read more
source§fn assign_to(&self, m: &mut Mat, typ: i32) -> Result<()>
fn assign_to(&self, m: &mut Mat, typ: i32) -> Result<()>
Provides a functional form of convertTo. Read more
source§fn reshape(&self, cn: i32, rows: i32) -> Result<Mat>
fn reshape(&self, cn: i32, rows: i32) -> Result<Mat>
Changes the shape and/or the number of channels of a 2D matrix without copying the data. Read more
source§fn reshape_nd(&self, cn: i32, newsz: &[i32]) -> Result<Mat>
fn reshape_nd(&self, cn: i32, newsz: &[i32]) -> Result<Mat>
Changes the shape and/or the number of channels of a 2D matrix without copying the data. Read more
source§fn reshape_nd_vec(&self, cn: i32, newshape: &Vector<i32>) -> Result<Mat>
fn reshape_nd_vec(&self, cn: i32, newshape: &Vector<i32>) -> Result<Mat>
Changes the shape and/or the number of channels of a 2D matrix without copying the data. Read more
source§fn mul(&self, m: &impl ToInputArray, scale: f64) -> Result<MatExpr>
fn mul(&self, m: &impl ToInputArray, scale: f64) -> Result<MatExpr>
Performs an element-wise multiplication or division of the two matrices. Read more
source§fn cross(&self, m: &impl ToInputArray) -> Result<Mat>
fn cross(&self, m: &impl ToInputArray) -> Result<Mat>
Computes a cross-product of two 3-element vectors. Read more
source§fn dot(&self, m: &impl ToInputArray) -> Result<f64>
fn dot(&self, m: &impl ToInputArray) -> Result<f64>
Computes a dot-product of two vectors. Read more
source§fn locate_roi(&self, whole_size: &mut Size, ofs: &mut Point) -> Result<()>
fn locate_roi(&self, whole_size: &mut Size, ofs: &mut Point) -> Result<()>
Locates the matrix header within a parent matrix. Read more
source§fn apply(&self, row_range: Range, col_range: Range) -> Result<Mat>
fn apply(&self, row_range: Range, col_range: Range) -> Result<Mat>
Extracts a rectangular submatrix. Read more
source§fn apply_3(&self, ranges: &Vector<Range>) -> Result<Mat>
fn apply_3(&self, ranges: &Vector<Range>) -> Result<Mat>
Extracts a rectangular submatrix. Read more
source§fn is_continuous(&self) -> bool
fn is_continuous(&self) -> bool
Reports whether the matrix is continuous or not. Read more
source§fn is_submatrix(&self) -> bool
fn is_submatrix(&self) -> bool
returns true if the matrix is a submatrix of another matrix
source§fn elem_size1(&self) -> size_t
fn elem_size1(&self) -> size_t
Returns the size of each matrix element channel in bytes. Read more
source§fn total_slice(&self, start_dim: i32, end_dim: i32) -> Result<size_t>
fn total_slice(&self, start_dim: i32, end_dim: i32) -> Result<size_t>
Returns the total number of array elements. Read more
source§fn check_vector(
&self,
elem_channels: i32,
depth: i32,
require_continuous: bool
) -> Result<i32>
fn check_vector( &self, elem_channels: i32, depth: i32, require_continuous: bool ) -> Result<i32>
Parameters Read more
source§fn ptr(&self, i0: i32) -> Result<*const u8>
fn ptr(&self, i0: i32) -> Result<*const u8>
Returns a pointer to the specified matrix row. Read more
source§fn ptr_2d(&self, row: i32, col: i32) -> Result<*const u8>
fn ptr_2d(&self, row: i32, col: i32) -> Result<*const u8>
Returns a pointer to the specified matrix row. Read more
source§fn ptr_3d(&self, i0: i32, i1: i32, i2: i32) -> Result<*const u8>
fn ptr_3d(&self, i0: i32, i1: i32, i2: i32) -> Result<*const u8>
Returns a pointer to the specified matrix row. Read more
source§fn ptr_nd(&self, idx: &[i32]) -> Result<*const u8>
fn ptr_nd(&self, idx: &[i32]) -> Result<*const u8>
Returns a pointer to the specified matrix row. Read more
source§fn at<T: DataType>(&self, i0: i32) -> Result<&T>
fn at<T: DataType>(&self, i0: i32) -> Result<&T>
Returns a reference to the specified array element. Read more
source§fn at_2d<T: DataType>(&self, row: i32, col: i32) -> Result<&T>
fn at_2d<T: DataType>(&self, row: i32, col: i32) -> Result<&T>
Returns a reference to the specified array element. Read more
source§fn at_3d<T: DataType>(&self, i0: i32, i1: i32, i2: i32) -> Result<&T>
fn at_3d<T: DataType>(&self, i0: i32, i1: i32, i2: i32) -> Result<&T>
Returns a reference to the specified array element. Read more
source§fn at_nd<T: DataType>(&self, idx: &[i32]) -> Result<&T>
fn at_nd<T: DataType>(&self, idx: &[i32]) -> Result<&T>
Returns a reference to the specified array element. Read more
source§fn at_pt<T: DataType>(&self, pt: Point) -> Result<&T>
fn at_pt<T: DataType>(&self, pt: Point) -> Result<&T>
Returns a reference to the specified array element. Read more
fn size(&self) -> Result<Size>
fn data(&self) -> *const u8
source§impl<T> ToInputArray for Mat_<T>
impl<T> ToInputArray for Mat_<T>
fn input_array(&self) -> Result<_InputArray>
source§impl<T> ToInputOutputArray for Mat_<T>
impl<T> ToInputOutputArray for Mat_<T>
fn input_output_array(&mut self) -> Result<_InputOutputArray>
source§impl<T> ToOutputArray for Mat_<T>
impl<T> ToOutputArray for Mat_<T>
fn output_array(&mut self) -> Result<_OutputArray>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Mat_<T>where T: RefUnwindSafe,
impl<T> Send for Mat_<T>where T: Send,
impl<T> !Sync for Mat_<T>
impl<T> Unpin for Mat_<T>where T: Unpin,
impl<T> UnwindSafe for Mat_<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> MatTraitConstManual for Twhere
T: MatTraitConst + ?Sized,
impl<T> MatTraitConstManual for Twhere T: MatTraitConst + ?Sized,
source§unsafe fn at_unchecked<T: DataType>(&self, i0: i32) -> Result<&T>
unsafe fn at_unchecked<T: DataType>(&self, i0: i32) -> Result<&T>
Like
Mat::at()
but performs no bounds or type checks Read moresource§unsafe fn at_2d_unchecked<T: DataType>(&self, row: i32, col: i32) -> Result<&T>
unsafe fn at_2d_unchecked<T: DataType>(&self, row: i32, col: i32) -> Result<&T>
Like
Mat::at_2d()
but performs no bounds or type checks Read moresource§unsafe fn at_pt_unchecked<T: DataType>(&self, pt: Point) -> Result<&T>
unsafe fn at_pt_unchecked<T: DataType>(&self, pt: Point) -> Result<&T>
Like
Mat::at_pt()
but performs no bounds or type checks Read moresource§unsafe fn at_3d_unchecked<T: DataType>(
&self,
i0: i32,
i1: i32,
i2: i32
) -> Result<&T>
unsafe fn at_3d_unchecked<T: DataType>( &self, i0: i32, i1: i32, i2: i32 ) -> Result<&T>
Like
Mat::at_3d()
but performs no bounds or type checks Read moresource§unsafe fn at_nd_unchecked<T: DataType>(&self, idx: &[i32]) -> Result<&T>
unsafe fn at_nd_unchecked<T: DataType>(&self, idx: &[i32]) -> Result<&T>
Like
Mat::at_nd()
but performs no bounds or type checks Read moresource§unsafe fn at_row_unchecked<T: DataType>(&self, row: i32) -> Result<&[T]>
unsafe fn at_row_unchecked<T: DataType>(&self, row: i32) -> Result<&[T]>
Like
Mat::at_row()
but performs no bounds or type checks Read morefn is_allocated(&self) -> bool
source§fn data_bytes(&self) -> Result<&[u8]>
fn data_bytes(&self) -> Result<&[u8]>
Returns underlying data array as byte slice, Mat must be continuous.
fn data_typed<T: DataType>(&self) -> Result<&[T]>
fn to_vec_2d<T: DataType>(&self) -> Result<Vec<Vec<T>>>
source§impl<T> MatTraitManual for Twhere
T: MatTrait + ?Sized,
impl<T> MatTraitManual for Twhere T: MatTrait + ?Sized,
source§unsafe fn at_unchecked_mut<T: DataType>(&mut self, i0: i32) -> Result<&mut T>
unsafe fn at_unchecked_mut<T: DataType>(&mut self, i0: i32) -> Result<&mut T>
Like
Mat::at_mut()
but performs no bounds or type checks Read moresource§unsafe fn at_2d_unchecked_mut<T: DataType>(
&mut self,
row: i32,
col: i32
) -> Result<&mut T>
unsafe fn at_2d_unchecked_mut<T: DataType>( &mut self, row: i32, col: i32 ) -> Result<&mut T>
Like
Mat::at_2d_mut()
but performs no bounds or type checks Read moresource§unsafe fn at_pt_unchecked_mut<T: DataType>(
&mut self,
pt: Point
) -> Result<&mut T>
unsafe fn at_pt_unchecked_mut<T: DataType>( &mut self, pt: Point ) -> Result<&mut T>
Like
Mat::at_pt_mut()
but performs no bounds or type checks Read moresource§unsafe fn at_3d_unchecked_mut<T: DataType>(
&mut self,
i0: i32,
i1: i32,
i2: i32
) -> Result<&mut T>
unsafe fn at_3d_unchecked_mut<T: DataType>( &mut self, i0: i32, i1: i32, i2: i32 ) -> Result<&mut T>
Like
Mat::at_3d_mut()
but performs no bounds or type checks Read moresource§unsafe fn at_nd_unchecked_mut<T: DataType>(
&mut self,
idx: &[i32]
) -> Result<&mut T>
unsafe fn at_nd_unchecked_mut<T: DataType>( &mut self, idx: &[i32] ) -> Result<&mut T>
Like
Mat::at_nd_mut()
but performs no bounds or type checks Read moresource§fn at_row_mut<T: DataType>(&mut self, row: i32) -> Result<&mut [T]>
fn at_row_mut<T: DataType>(&mut self, row: i32) -> Result<&mut [T]>
Return a complete writeable row
source§unsafe fn at_row_unchecked_mut<T: DataType>(
&mut self,
row: i32
) -> Result<&mut [T]>
unsafe fn at_row_unchecked_mut<T: DataType>( &mut self, row: i32 ) -> Result<&mut [T]>
Like
Mat::at_row_mut()
but performs no bounds or type checks Read moresource§fn data_bytes_mut(&mut self) -> Result<&mut [u8]>
fn data_bytes_mut(&mut self) -> Result<&mut [u8]>
Returns underlying data array as mutable byte slice, Mat must be continuous.