[][src]Trait opencv::core::GpuMatTrait

pub trait GpuMatTrait {
    pub fn as_raw_GpuMat(&self) -> *const c_void;
pub fn as_raw_mut_GpuMat(&mut self) -> *mut c_void; pub fn flags(&self) -> i32 { ... }
pub fn set_flags(&mut self, val: i32) { ... }
pub fn rows(&self) -> i32 { ... }
pub fn set_rows(&mut self, val: i32) { ... }
pub fn cols(&self) -> i32 { ... }
pub fn set_cols(&mut self, val: i32) { ... }
pub fn step(&self) -> size_t { ... }
pub fn set_step(&mut self, val: size_t) { ... }
pub fn data(&mut self) -> &mut u8 { ... }
pub fn set_data(&mut self, val: &mut u8) { ... }
pub fn refcount(&mut self) -> &mut i32 { ... }
pub fn set_refcount(&mut self, val: &mut i32) { ... }
pub fn datastart(&mut self) -> &mut u8 { ... }
pub fn set_datastart(&mut self, val: &mut u8) { ... }
pub fn dataend(&self) -> &u8 { ... }
pub fn allocator(&mut self) -> AbstractRefMut<'_, dyn GpuMat_Allocator> { ... }
pub unsafe fn set_allocator(&mut self, val: &mut dyn GpuMat_Allocator) { ... }
pub fn create(&mut self, rows: i32, cols: i32, typ: i32) -> Result<()> { ... }
pub fn create_1(&mut self, size: Size, typ: i32) -> Result<()> { ... }
pub fn release(&mut self) -> Result<()> { ... }
pub fn swap(&mut self, mat: &mut GpuMat) -> Result<()> { ... }
pub fn upload(&mut self, arr: &dyn ToInputArray) -> Result<()> { ... }
pub fn upload_async(
        &mut self,
        arr: &dyn ToInputArray,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn download(&self, dst: &mut dyn ToOutputArray) -> Result<()> { ... }
pub fn download_async(
        &self,
        dst: &mut dyn ToOutputArray,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn try_clone(&self) -> Result<GpuMat> { ... }
pub fn copy_to(&self, dst: &mut dyn ToOutputArray) -> Result<()> { ... }
pub fn copy_to_1(
        &self,
        dst: &mut dyn ToOutputArray,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn copy_to_2(
        &self,
        dst: &mut dyn ToOutputArray,
        mask: &dyn ToInputArray
    ) -> Result<()> { ... }
pub fn copy_to_3(
        &self,
        dst: &mut dyn ToOutputArray,
        mask: &dyn ToInputArray,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn set_to(&mut self, s: Scalar) -> Result<GpuMat> { ... }
pub fn set_to_1(&mut self, s: Scalar, stream: &mut Stream) -> Result<GpuMat> { ... }
pub fn set_to_2(
        &mut self,
        s: Scalar,
        mask: &dyn ToInputArray
    ) -> Result<GpuMat> { ... }
pub fn set_to_3(
        &mut self,
        s: Scalar,
        mask: &dyn ToInputArray,
        stream: &mut Stream
    ) -> Result<GpuMat> { ... }
pub fn convert_to(
        &self,
        dst: &mut dyn ToOutputArray,
        rtype: i32
    ) -> Result<()> { ... }
pub fn convert_to_1(
        &self,
        dst: &mut dyn ToOutputArray,
        rtype: i32,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn convert_to_2(
        &self,
        dst: &mut dyn ToOutputArray,
        rtype: i32,
        alpha: f64,
        beta: f64
    ) -> Result<()> { ... }
pub fn convert_to_3(
        &self,
        dst: &mut dyn ToOutputArray,
        rtype: i32,
        alpha: f64,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn convert_to_4(
        &self,
        dst: &mut dyn ToOutputArray,
        rtype: i32,
        alpha: f64,
        beta: f64,
        stream: &mut Stream
    ) -> Result<()> { ... }
pub fn assign_to(&self, m: &mut GpuMat, typ: i32) -> Result<()> { ... }
pub fn ptr(&mut self, y: i32) -> Result<&mut u8> { ... }
pub fn ptr_1(&self, y: i32) -> Result<&u8> { ... }
pub fn row(&self, y: i32) -> Result<GpuMat> { ... }
pub fn col(&self, x: i32) -> Result<GpuMat> { ... }
pub fn row_range(&self, startrow: i32, endrow: i32) -> Result<GpuMat> { ... }
pub fn row_range_1(&self, r: Range) -> Result<GpuMat> { ... }
pub fn col_range(&self, startcol: i32, endcol: i32) -> Result<GpuMat> { ... }
pub fn col_range_1(&self, r: Range) -> Result<GpuMat> { ... }
pub fn reshape(&self, cn: i32, rows: i32) -> Result<GpuMat> { ... }
pub fn locate_roi(
        &self,
        whole_size: &mut Size,
        ofs: &mut Point
    ) -> Result<()> { ... }
pub fn adjust_roi(
        &mut self,
        dtop: i32,
        dbottom: i32,
        dleft: i32,
        dright: i32
    ) -> Result<GpuMat> { ... }
pub fn is_continuous(&self) -> Result<bool> { ... }
pub fn elem_size(&self) -> Result<size_t> { ... }
pub fn elem_size1(&self) -> Result<size_t> { ... }
pub fn typ(&self) -> Result<i32> { ... }
pub fn depth(&self) -> Result<i32> { ... }
pub fn channels(&self) -> Result<i32> { ... }
pub fn step1(&self) -> Result<size_t> { ... }
pub fn size(&self) -> Result<Size> { ... }
pub fn empty(&self) -> Result<bool> { ... }
pub fn cuda_ptr(&self) -> Result<*mut c_void> { ... }
pub fn update_continuity_flag(&mut self) -> Result<()> { ... } }

Base storage class for GPU memory with reference counting.

Its interface matches the Mat interface with the following limitations:

  • no arbitrary dimensions support (only 2D)
  • no functions that return references to their data (because references on GPU are not valid for CPU)
  • no expression templates technique support

Beware that the latter limitation may lead to overloaded matrix operators that cause memory allocations. The GpuMat class is convertible to cuda::PtrStepSz and cuda::PtrStep so it can be passed directly to the kernel.

Note: In contrast with Mat, in most cases GpuMat::isContinuous() == false . This means that rows are aligned to a size depending on the hardware. Single-row GpuMat is always a continuous matrix.

Note: You are not recommended to leave static or global GpuMat variables allocated, that is, to rely on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory release function returns error if the CUDA context has been destroyed before.

Some member functions are described as a "Blocking Call" while some are described as a "Non-Blocking Call". Blocking functions are synchronous to host. It is guaranteed that the GPU operation is finished when the function returns. However, non-blocking functions are asynchronous to host. Those functions may return even if the GPU operation is not finished.

Compared to their blocking counterpart, non-blocking functions accept Stream as an additional argument. If a non-default stream is passed, the GPU operation may overlap with operations in other streams.

See also

Mat

Required methods

Loading content...

Provided methods

pub fn flags(&self) -> i32[src]

! includes several bit-fields:

  • the magic signature
  • continuity flag
  • depth
  • number of channels

pub fn set_flags(&mut self, val: i32)[src]

! includes several bit-fields:

  • the magic signature
  • continuity flag
  • depth
  • number of channels

pub fn rows(&self) -> i32[src]

the number of rows and columns

pub fn set_rows(&mut self, val: i32)[src]

the number of rows and columns

pub fn cols(&self) -> i32[src]

the number of rows and columns

pub fn set_cols(&mut self, val: i32)[src]

the number of rows and columns

pub fn step(&self) -> size_t[src]

a distance between successive rows in bytes; includes the gap if any

pub fn set_step(&mut self, val: size_t)[src]

a distance between successive rows in bytes; includes the gap if any

pub fn data(&mut self) -> &mut u8[src]

pointer to the data

pub fn set_data(&mut self, val: &mut u8)[src]

pointer to the data

pub fn refcount(&mut self) -> &mut i32[src]

pointer to the reference counter; when GpuMat points to user-allocated data, the pointer is NULL

pub fn set_refcount(&mut self, val: &mut i32)[src]

pointer to the reference counter; when GpuMat points to user-allocated data, the pointer is NULL

pub fn datastart(&mut self) -> &mut u8[src]

helper fields used in locateROI and adjustROI

pub fn set_datastart(&mut self, val: &mut u8)[src]

helper fields used in locateROI and adjustROI

pub fn dataend(&self) -> &u8[src]

pub fn allocator(&mut self) -> AbstractRefMut<'_, dyn GpuMat_Allocator>[src]

allocator

pub unsafe fn set_allocator(&mut self, val: &mut dyn GpuMat_Allocator)[src]

allocator

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

allocates new GpuMat data unless the GpuMat already has specified size and type

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

pub fn release(&mut self) -> Result<()>[src]

decreases reference counter, deallocate the data when reference counter reaches 0

pub fn swap(&mut self, mat: &mut GpuMat) -> Result<()>[src]

swaps with other smart pointer

pub fn upload(&mut self, arr: &dyn ToInputArray) -> Result<()>[src]

Performs data upload to GpuMat (Blocking call)

This function copies data from host memory to device memory. As being a blocking call, it is guaranteed that the copy operation is finished when this function returns.

pub fn upload_async(
    &mut self,
    arr: &dyn ToInputArray,
    stream: &mut Stream
) -> Result<()>
[src]

Performs data upload to GpuMat (Non-Blocking call)

This function copies data from host memory to device memory. As being a non-blocking call, this function may return even if the copy operation is not finished.

The copy operation may be overlapped with operations in other non-default streams if \p stream is not the default stream and \p dst is HostMem allocated with HostMem::PAGE_LOCKED option.

pub fn download(&self, dst: &mut dyn ToOutputArray) -> Result<()>[src]

Performs data download from GpuMat (Blocking call)

This function copies data from device memory to host memory. As being a blocking call, it is guaranteed that the copy operation is finished when this function returns.

pub fn download_async(
    &self,
    dst: &mut dyn ToOutputArray,
    stream: &mut Stream
) -> Result<()>
[src]

Performs data download from GpuMat (Non-Blocking call)

This function copies data from device memory to host memory. As being a non-blocking call, this function may return even if the copy operation is not finished.

The copy operation may be overlapped with operations in other non-default streams if \p stream is not the default stream and \p dst is HostMem allocated with HostMem::PAGE_LOCKED option.

pub fn try_clone(&self) -> Result<GpuMat>[src]

returns deep copy of the GpuMat, i.e. the data is copied

pub fn copy_to(&self, dst: &mut dyn ToOutputArray) -> Result<()>[src]

copies the GpuMat content to device memory (Blocking call)

pub fn copy_to_1(
    &self,
    dst: &mut dyn ToOutputArray,
    stream: &mut Stream
) -> Result<()>
[src]

copies the GpuMat content to device memory (Non-Blocking call)

pub fn copy_to_2(
    &self,
    dst: &mut dyn ToOutputArray,
    mask: &dyn ToInputArray
) -> Result<()>
[src]

copies those GpuMat elements to "m" that are marked with non-zero mask elements (Blocking call)

pub fn copy_to_3(
    &self,
    dst: &mut dyn ToOutputArray,
    mask: &dyn ToInputArray,
    stream: &mut Stream
) -> Result<()>
[src]

copies those GpuMat elements to "m" that are marked with non-zero mask elements (Non-Blocking call)

pub fn set_to(&mut self, s: Scalar) -> Result<GpuMat>[src]

sets some of the GpuMat elements to s (Blocking call)

pub fn set_to_1(&mut self, s: Scalar, stream: &mut Stream) -> Result<GpuMat>[src]

sets some of the GpuMat elements to s (Non-Blocking call)

pub fn set_to_2(&mut self, s: Scalar, mask: &dyn ToInputArray) -> Result<GpuMat>[src]

sets some of the GpuMat elements to s, according to the mask (Blocking call)

pub fn set_to_3(
    &mut self,
    s: Scalar,
    mask: &dyn ToInputArray,
    stream: &mut Stream
) -> Result<GpuMat>
[src]

sets some of the GpuMat elements to s, according to the mask (Non-Blocking call)

pub fn convert_to(&self, dst: &mut dyn ToOutputArray, rtype: i32) -> Result<()>[src]

converts GpuMat to another datatype (Blocking call)

pub fn convert_to_1(
    &self,
    dst: &mut dyn ToOutputArray,
    rtype: i32,
    stream: &mut Stream
) -> Result<()>
[src]

converts GpuMat to another datatype (Non-Blocking call)

pub fn convert_to_2(
    &self,
    dst: &mut dyn ToOutputArray,
    rtype: i32,
    alpha: f64,
    beta: f64
) -> Result<()>
[src]

converts GpuMat to another datatype with scaling (Blocking call)

C++ default parameters

  • beta: 0.0

pub fn convert_to_3(
    &self,
    dst: &mut dyn ToOutputArray,
    rtype: i32,
    alpha: f64,
    stream: &mut Stream
) -> Result<()>
[src]

converts GpuMat to another datatype with scaling (Non-Blocking call)

pub fn convert_to_4(
    &self,
    dst: &mut dyn ToOutputArray,
    rtype: i32,
    alpha: f64,
    beta: f64,
    stream: &mut Stream
) -> Result<()>
[src]

converts GpuMat to another datatype with scaling (Non-Blocking call)

pub fn assign_to(&self, m: &mut GpuMat, typ: i32) -> Result<()>[src]

pub fn ptr(&mut self, y: i32) -> Result<&mut u8>[src]

returns pointer to y-th row

C++ default parameters

  • y: 0

pub fn ptr_1(&self, y: i32) -> Result<&u8>[src]

pub fn row(&self, y: i32) -> Result<GpuMat>[src]

returns a new GpuMat header for the specified row

pub fn col(&self, x: i32) -> Result<GpuMat>[src]

returns a new GpuMat header for the specified column

pub fn row_range(&self, startrow: i32, endrow: i32) -> Result<GpuMat>[src]

... for the specified row span

pub fn row_range_1(&self, r: Range) -> Result<GpuMat>[src]

pub fn col_range(&self, startcol: i32, endcol: i32) -> Result<GpuMat>[src]

... for the specified column span

pub fn col_range_1(&self, r: Range) -> Result<GpuMat>[src]

pub fn reshape(&self, cn: i32, rows: i32) -> Result<GpuMat>[src]

creates alternative GpuMat header for the same data, with different number of channels and/or different number of rows

C++ default parameters

  • rows: 0

pub fn locate_roi(&self, whole_size: &mut Size, ofs: &mut Point) -> Result<()>[src]

locates GpuMat header within a parent GpuMat

pub fn adjust_roi(
    &mut self,
    dtop: i32,
    dbottom: i32,
    dleft: i32,
    dright: i32
) -> Result<GpuMat>
[src]

moves/resizes the current GpuMat ROI inside the parent GpuMat

pub fn is_continuous(&self) -> Result<bool>[src]

returns true iff the GpuMat data is continuous (i.e. when there are no gaps between successive rows)

pub fn elem_size(&self) -> Result<size_t>[src]

returns element size in bytes

pub fn elem_size1(&self) -> Result<size_t>[src]

returns the size of element channel in bytes

pub fn typ(&self) -> Result<i32>[src]

returns element type

pub fn depth(&self) -> Result<i32>[src]

returns element type

pub fn channels(&self) -> Result<i32>[src]

returns number of channels

pub fn step1(&self) -> Result<size_t>[src]

returns step/elemSize1()

pub fn size(&self) -> Result<Size>[src]

returns GpuMat size : width == number of columns, height == number of rows

pub fn empty(&self) -> Result<bool>[src]

returns true if GpuMat data is NULL

pub fn cuda_ptr(&self) -> Result<*mut c_void>[src]

pub fn update_continuity_flag(&mut self) -> Result<()>[src]

internal use method: updates the continuity flag

Loading content...

Implementors

impl GpuMatTrait for GpuMat[src]

Loading content...