Struct opencv::core::HostMem

source ·
pub struct HostMem { /* private fields */ }
Expand description

Class with reference counting wrapping special memory type allocation functions from CUDA.

Its interface is also Mat-like but with additional memory type parameters.

  • PAGE_LOCKED sets a page locked memory type used commonly for fast and asynchronous uploading/downloading data from/to GPU.
  • SHARED specifies a zero copy memory allocation that enables mapping the host memory to GPU address space, if supported.
  • WRITE_COMBINED sets the write combined buffer that is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache utilization.

Note: Allocation size of such memory types is usually limited. For more details, see CUDA 2.2 Pinned Memory APIs document or CUDA C Programming Guide.

Implementations§

source§

impl HostMem

source

pub fn new(alloc_type: HostMem_AllocType) -> Result<HostMem>

§C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_def() -> Result<HostMem>

§Note

This alternative version of [new] function uses the following default values for its arguments:

  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn copy(m: &impl HostMemTraitConst) -> Result<HostMem>

source

pub fn new_1( rows: i32, cols: i32, typ: i32, alloc_type: HostMem_AllocType ) -> Result<HostMem>

§C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_def_1(rows: i32, cols: i32, typ: i32) -> Result<HostMem>

§Note

This alternative version of [new] function uses the following default values for its arguments:

  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_2( size: Size, typ: i32, alloc_type: HostMem_AllocType ) -> Result<HostMem>

§C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_def_2(size: Size, typ: i32) -> Result<HostMem>

§Note

This alternative version of [new] function uses the following default values for its arguments:

  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_3( arr: &impl ToInputArray, alloc_type: HostMem_AllocType ) -> Result<HostMem>

creates from host memory with coping data

§C++ default parameters
  • alloc_type: HostMem::AllocType::PAGE_LOCKED
source

pub fn new_def_3(arr: &impl ToInputArray) -> Result<HostMem>

creates from host memory with coping data

§Note

This alternative version of [new] function uses the following default values for its arguments:

  • alloc_type: HostMem::AllocType::PAGE_LOCKED

Trait Implementations§

source§

impl Boxed for HostMem

source§

unsafe fn from_raw(ptr: <HostMem as OpenCVFromExtern>::ExternReceive) -> Self

Wrap the specified raw pointer Read more
source§

fn into_raw(self) -> <HostMem as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying raw pointer while consuming this wrapper. Read more
source§

fn as_raw(&self) -> <HostMem as OpenCVTypeExternContainer>::ExternSend

Return the underlying raw pointer. Read more
source§

fn as_raw_mut( &mut self ) -> <HostMem as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying mutable raw pointer Read more
source§

impl Clone for HostMem

source§

fn clone(&self) -> Self

Calls try_clone() and panics if that fails

1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for HostMem

source§

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

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

impl Drop for HostMem

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl HostMemTrait for HostMem

source§

fn as_raw_mut_HostMem(&mut self) -> *mut c_void

source§

fn set_flags(&mut self, val: i32)

source§

fn set_rows(&mut self, val: i32)

source§

fn set_cols(&mut self, val: i32)

source§

fn set_step(&mut self, val: size_t)

source§

fn data_mut(&mut self) -> *mut u8

source§

unsafe fn set_data(&mut self, val: *const u8)

source§

fn refcount_mut(&mut self) -> *mut i32

source§

unsafe fn set_refcount(&mut self, val: *const i32)

source§

fn datastart_mut(&mut self) -> *mut u8

source§

unsafe fn set_datastart(&mut self, val: *const u8)

source§

fn set_alloc_type(&mut self, val: HostMem_AllocType)

source§

fn set(&mut self, m: &impl HostMemTraitConst) -> Result<()>

source§

fn swap(&mut self, b: &mut impl HostMemTrait) -> Result<()>

swaps with other smart pointer
source§

fn create(&mut self, rows: i32, cols: i32, typ: i32) -> Result<()>

allocates new matrix data unless the matrix already has specified size and type.
source§

fn create_1(&mut self, size: Size, typ: i32) -> Result<()>

source§

fn release(&mut self) -> Result<()>

decrements reference counter and released memory if needed.
source§

impl HostMemTraitConst for HostMem

source§

fn as_raw_HostMem(&self) -> *const c_void

source§

fn flags(&self) -> i32

source§

fn rows(&self) -> i32

source§

fn cols(&self) -> i32

source§

fn step(&self) -> size_t

source§

fn data(&self) -> *const u8

source§

fn refcount(&self) -> *const i32

source§

fn datastart(&self) -> *const u8

source§

fn dataend(&self) -> *const u8

source§

fn alloc_type(&self) -> HostMem_AllocType

source§

fn try_clone(&self) -> Result<HostMem>

returns deep copy of the matrix, i.e. the data is copied
source§

fn reshape(&self, cn: i32, rows: i32) -> Result<HostMem>

creates alternative HostMem header for the same data, with different number of channels and/or different number of rows Read more
source§

fn reshape_def(&self, cn: i32) -> Result<HostMem>

creates alternative HostMem header for the same data, with different number of channels and/or different number of rows Read more
source§

fn create_mat_header(&self) -> Result<Mat>

returns matrix header with disabled reference counting for HostMem data.
source§

fn create_gpu_mat_header(&self) -> Result<GpuMat>

Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting for it. Read more
source§

fn is_continuous(&self) -> Result<bool>

source§

fn elem_size(&self) -> Result<size_t>

source§

fn elem_size1(&self) -> Result<size_t>

source§

fn typ(&self) -> Result<i32>

source§

fn depth(&self) -> Result<i32>

source§

fn channels(&self) -> Result<i32>

source§

fn step1(&self) -> Result<size_t>

source§

fn size(&self) -> Result<Size>

source§

fn empty(&self) -> Result<bool>

source§

impl ToInputArray for &HostMem

source§

impl ToInputArray for HostMem

source§

impl ToInputOutputArray for &mut HostMem

source§

impl ToInputOutputArray for HostMem

source§

impl ToOutputArray for &mut HostMem

source§

impl ToOutputArray for HostMem

source§

impl Send for HostMem

Auto Trait Implementations§

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<Mat> ModifyInplace for Mat
where Mat: Boxed,

source§

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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.