pub struct GpuMatND { /* private fields */ }
Implementations§
source§impl GpuMatND
impl GpuMatND
sourcepub unsafe fn new_1(
size: GpuMatND_SizeArray,
typ: i32,
data: *mut c_void,
step: GpuMatND_StepArray
) -> Result<GpuMatND>
pub unsafe fn new_1( size: GpuMatND_SizeArray, typ: i32, data: *mut c_void, step: GpuMatND_StepArray ) -> Result<GpuMatND>
default constructor
§Overloaded parameters
§Parameters
- size: Array of integers specifying an n-dimensional array shape.
- type: Array type. Use CV_8UC1, …, CV_16FC4 to create 1-4 channel matrices, or CV_8UC(n), …, CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
- data: Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically deallocated, so you should take care of it.
- step: Array of _size.size()-1 steps in case of a multi-dimensional array (the last step is always set to the element size). If not specified, the matrix is assumed to be continuous.
§C++ default parameters
- step: StepArray()
sourcepub unsafe fn new_def(
size: GpuMatND_SizeArray,
typ: i32,
data: *mut c_void
) -> Result<GpuMatND>
pub unsafe fn new_def( size: GpuMatND_SizeArray, typ: i32, data: *mut c_void ) -> Result<GpuMatND>
@overload
§Parameters
- size: Array of integers specifying an n-dimensional array shape.
- type: Array type. Use CV_8UC1, …, CV_16FC4 to create 1-4 channel matrices, or CV_8UC(n), …, CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
- data: Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically deallocated, so you should take care of it.
- step: Array of _size.size()-1 steps in case of a multi-dimensional array (the last step is always set to the element size). If not specified, the matrix is assumed to be continuous.
§Note
This alternative version of [new] function uses the following default values for its arguments:
- step: StepArray()
pub fn copy(unnamed: &impl GpuMatNDTraitConst) -> GpuMatND
pub fn copy_mut(unnamed: GpuMatND) -> GpuMatND
Trait Implementations§
source§impl Boxed for GpuMatND
impl Boxed for GpuMatND
source§unsafe fn from_raw(ptr: <GpuMatND as OpenCVFromExtern>::ExternReceive) -> Self
unsafe fn from_raw(ptr: <GpuMatND as OpenCVFromExtern>::ExternReceive) -> Self
Wrap the specified raw pointer Read more
source§fn into_raw(self) -> <GpuMatND as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <GpuMatND as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying raw pointer while consuming this wrapper. Read more
source§fn as_raw(&self) -> <GpuMatND as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <GpuMatND as OpenCVTypeExternContainer>::ExternSend
Return the underlying raw pointer. Read more
source§fn as_raw_mut(
&mut self
) -> <GpuMatND as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self ) -> <GpuMatND as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying mutable raw pointer Read more
source§impl GpuMatNDTrait for GpuMatND
impl GpuMatNDTrait for GpuMatND
fn as_raw_mut_GpuMatND(&mut self) -> *mut c_void
source§fn set_size(&mut self, val: GpuMatND_SizeArray)
fn set_size(&mut self, val: GpuMatND_SizeArray)
shape of this array
source§fn set_step(&mut self, val: GpuMatND_StepArray)
fn set_step(&mut self, val: GpuMatND_StepArray)
! step values
Their semantics is identical to the semantics of step for Mat.
source§fn create(&mut self, size: GpuMatND_SizeArray, typ: i32) -> Result<()>
fn create(&mut self, size: GpuMatND_SizeArray, typ: i32) -> Result<()>
Allocates GPU memory.
Suppose there is some GPU memory already allocated. In that case, this method may choose to reuse that
GPU memory under the specific condition: it must be of the same size and type, not externally allocated,
the GPU memory is continuous(i.e., isContinuous() is true), and is not a sub-matrix of another GpuMatND
(i.e., isSubmatrix() is false). In other words, this method guarantees that the GPU memory allocated by
this method is always continuous and is not a sub-region of another GpuMatND.
fn release(&mut self) -> Result<()>
fn swap(&mut self, m: &mut impl GpuMatNDTrait)
source§fn ranges_mut(
&mut self,
ranges: &Vector<Range>
) -> Result<BoxedRefMut<'_, GpuMatND>>
fn ranges_mut( &mut self, ranges: &Vector<Range> ) -> Result<BoxedRefMut<'_, GpuMatND>>
Extracts a sub-matrix.
The operator makes a new header for the specified sub-array of *this.
The operator is an O(1) operation, that is, no matrix data is copied. Read more
source§fn create_gpu_mat_header_mut(
&mut self,
idx: GpuMatND_IndexArray,
row_range: impl RangeTrait,
col_range: impl RangeTrait
) -> Result<BoxedRefMut<'_, GpuMat>>
fn create_gpu_mat_header_mut( &mut self, idx: GpuMatND_IndexArray, row_range: impl RangeTrait, col_range: impl RangeTrait ) -> Result<BoxedRefMut<'_, GpuMat>>
Creates a GpuMat header for a 2D plane part of an n-dim matrix. Read more
source§fn create_gpu_mat_header_mut_1(&mut self) -> Result<BoxedRefMut<'_, GpuMat>>
fn create_gpu_mat_header_mut_1(&mut self) -> Result<BoxedRefMut<'_, GpuMat>>
@overload
Creates a GpuMat header if this GpuMatND is effectively 2D. Read more
source§fn rowscols_mut(
&mut self,
idx: GpuMatND_IndexArray,
row_range: impl RangeTrait,
col_range: impl RangeTrait
) -> Result<BoxedRefMut<'_, GpuMat>>
fn rowscols_mut( &mut self, idx: GpuMatND_IndexArray, row_range: impl RangeTrait, col_range: impl RangeTrait ) -> Result<BoxedRefMut<'_, GpuMat>>
Extracts a 2D plane part of an n-dim matrix.
It differs from createGpuMatHeader(IndexArray, Range, Range) in that it clones a part of this
GpuMatND to the returned GpuMat. Read more
fn set(&mut self, unnamed: &impl GpuMatNDTraitConst)
fn set_1(&mut self, unnamed: GpuMatND)
fn upload(&mut self, src: &impl ToInputArray) -> Result<()>
fn upload_1( &mut self, src: &impl ToInputArray, stream: &mut impl StreamTrait ) -> Result<()>
source§impl GpuMatNDTraitConst for GpuMatND
impl GpuMatNDTraitConst for GpuMatND
fn as_raw_GpuMatND(&self) -> *const c_void
source§fn size(&self) -> GpuMatND_SizeArray
fn size(&self) -> GpuMatND_SizeArray
shape of this array
source§fn step(&self) -> GpuMatND_StepArray
fn step(&self) -> GpuMatND_StepArray
! step values
Their semantics is identical to the semantics of step for Mat.
source§fn try_clone(&self) -> Result<GpuMatND>
fn try_clone(&self) -> Result<GpuMatND>
Creates a full copy of the array and the underlying data.
The method creates a full copy of the array. It mimics the behavior of Mat::clone(), i.e.
the original step is not taken into account. So, the array copy is a continuous array
occupying total()*elemSize() bytes.
source§fn clone(&self, stream: &mut impl StreamTrait) -> Result<GpuMatND>
fn clone(&self, stream: &mut impl StreamTrait) -> Result<GpuMatND>
Creates a full copy of the array and the underlying data.
The method creates a full copy of the array. It mimics the behavior of Mat::clone(), i.e.
the original step is not taken into account. So, the array copy is a continuous array
occupying total()*elemSize() bytes. Read more
source§fn ranges(&self, ranges: &Vector<Range>) -> Result<BoxedRef<'_, GpuMatND>>
fn ranges(&self, ranges: &Vector<Range>) -> Result<BoxedRef<'_, GpuMatND>>
Extracts a sub-matrix.
The operator makes a new header for the specified sub-array of *this.
The operator is an O(1) operation, that is, no matrix data is copied. Read more
source§fn create_gpu_mat_header(
&self,
idx: GpuMatND_IndexArray,
row_range: impl RangeTrait,
col_range: impl RangeTrait
) -> Result<BoxedRef<'_, GpuMat>>
fn create_gpu_mat_header( &self, idx: GpuMatND_IndexArray, row_range: impl RangeTrait, col_range: impl RangeTrait ) -> Result<BoxedRef<'_, GpuMat>>
Creates a GpuMat header for a 2D plane part of an n-dim matrix. Read more
source§fn create_gpu_mat_header_1(&self) -> Result<BoxedRef<'_, GpuMat>>
fn create_gpu_mat_header_1(&self) -> Result<BoxedRef<'_, GpuMat>>
Creates a GpuMat header for a 2D plane part of an n-dim matrix. Read more
source§fn rowscols(
&self,
idx: GpuMatND_IndexArray,
row_range: impl RangeTrait,
col_range: impl RangeTrait
) -> Result<BoxedRef<'_, GpuMat>>
fn rowscols( &self, idx: GpuMatND_IndexArray, row_range: impl RangeTrait, col_range: impl RangeTrait ) -> Result<BoxedRef<'_, GpuMat>>
Extracts a 2D plane part of an n-dim matrix.
It differs from createGpuMatHeader(IndexArray, Range, Range) in that it clones a part of this
GpuMatND to the returned GpuMat. Read more
source§fn to_gpu_mat(&self) -> Result<GpuMat>
fn to_gpu_mat(&self) -> Result<GpuMat>
Extracts a 2D plane part of an n-dim matrix if this GpuMatND is effectively 2D.
It differs from createGpuMatHeader() in that it clones a part of this GpuMatND. Read more
fn download(&self, dst: &mut impl ToOutputArray) -> Result<()>
fn download_1( &self, dst: &mut impl ToOutputArray, stream: &mut impl StreamTrait ) -> Result<()>
source§fn is_continuous(&self) -> Result<bool>
fn is_continuous(&self) -> Result<bool>
returns true iff the GpuMatND data is continuous
(i.e. when there are no gaps between successive rows)
source§fn is_submatrix(&self) -> Result<bool>
fn is_submatrix(&self) -> Result<bool>
returns true if the matrix is a sub-matrix of another matrix
source§fn elem_size1(&self) -> Result<size_t>
fn elem_size1(&self) -> Result<size_t>
returns the size of element channel in bytes
source§fn external(&self) -> Result<bool>
fn external(&self) -> Result<bool>
returns true if not empty and points to external(user-allocated) gpu memory
source§fn get_device_ptr(&self) -> Result<*mut u8>
fn get_device_ptr(&self) -> Result<*mut u8>
returns pointer to the first byte of the GPU memory
source§fn total_mem_size(&self) -> Result<size_t>
fn total_mem_size(&self) -> Result<size_t>
returns the size of underlying memory in bytes
impl Send for GpuMatND
Auto Trait Implementations§
impl Freeze for GpuMatND
impl RefUnwindSafe for GpuMatND
impl !Sync for GpuMatND
impl Unpin for GpuMatND
impl UnwindSafe for GpuMatND
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<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res ) -> Res
Helper function to call OpenCV functions that allow in-place modification of a
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance
sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold
. Read more