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

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

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

! includes several bit-fields:

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

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

! includes several bit-fields:

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

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

the number of rows and columns

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

the number of rows and columns

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

the number of rows and columns

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

the number of rows and columns

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

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

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

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

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

pointer to the data

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

pointer to the data

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

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

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

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

helper fields used in locateROI and adjustROI

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

helper fields used in locateROI and adjustROI

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

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

allocator

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

allocator

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

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

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

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

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

swaps with other smart pointer

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.

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.

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.

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.

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

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

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

copies the GpuMat content to device memory (Blocking call)

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

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

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)

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)

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

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

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)

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)

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)

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

converts GpuMat to another datatype (Blocking call)

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

converts GpuMat to another datatype (Non-Blocking call)

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

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)

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)

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

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

returns pointer to y-th row

C++ default parameters

  • y: 0

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

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

returns a new GpuMat header for the specified row

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

returns a new GpuMat header for the specified column

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

... for the specified row span

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

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

... for the specified column span

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

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

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

locates GpuMat header within a parent GpuMat

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

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)

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

returns element size in bytes

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

returns the size of element channel in bytes

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

returns element type

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

returns element type

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

returns number of channels

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

returns step/elemSize1()

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

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

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

returns true if GpuMat data is NULL

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

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