Struct opencv::core::GpuMat [−][src]
pub struct GpuMat { /* fields omitted */ }
Expand description
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
Implementations
default allocator
pub unsafe fn new_rows_cols(
rows: i32,
cols: i32,
typ: i32,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
pub unsafe fn new_rows_cols(
rows: i32,
cols: i32,
typ: i32,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
constructs GpuMat of the specified size and type
C++ default parameters
- allocator: GpuMat::defaultAllocator()
C++ default parameters
- allocator: GpuMat::defaultAllocator()
pub unsafe fn new_rows_cols_with_default(
rows: i32,
cols: i32,
typ: i32,
s: Scalar,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
pub unsafe fn new_rows_cols_with_default(
rows: i32,
cols: i32,
typ: i32,
s: Scalar,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
constructs GpuMat and fills it with the specified value _s
C++ default parameters
- allocator: GpuMat::defaultAllocator()
pub unsafe fn new_size_with_default(
size: Size,
typ: i32,
s: Scalar,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
pub unsafe fn new_size_with_default(
size: Size,
typ: i32,
s: Scalar,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
C++ default parameters
- allocator: GpuMat::defaultAllocator()
constructor for GpuMat headers pointing to user-allocated data
C++ default parameters
- step: Mat::AUTO_STEP
C++ default parameters
- step: Mat::AUTO_STEP
creates a GpuMat header for a part of the bigger matrix
pub unsafe fn from_hostmem(
arr: &dyn ToInputArray,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
pub unsafe fn from_hostmem(
arr: &dyn ToInputArray,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
builds GpuMat from host memory (Blocking call)
C++ default parameters
- allocator: GpuMat::defaultAllocator()
Trait Implementations
a distance between successive rows in bytes; includes the gap if any
pointer to the reference counter; when GpuMat points to user-allocated data, the pointer is NULL Read more
pointer to the reference counter; when GpuMat points to user-allocated data, the pointer is NULL Read more
helper fields used in locateROI and adjustROI
allocator
allocator
allocates new GpuMat data unless the GpuMat already has specified size and type
decreases reference counter, deallocate the data when reference counter reaches 0
Performs data upload to GpuMat (Blocking call) Read more
Performs data upload to GpuMat (Non-Blocking call) Read more
sets some of the GpuMat elements to s (Blocking call)
sets some of the GpuMat elements to s (Non-Blocking call)
sets some of the GpuMat elements to s, according to the mask (Blocking call)
sets some of the GpuMat elements to s, according to the mask (Non-Blocking call)
moves/resizes the current GpuMat ROI inside the parent GpuMat
internal use method: updates the continuity flag
Performs data download from GpuMat (Blocking call) Read more
Performs data download from GpuMat (Non-Blocking call) Read more
copies the GpuMat content to device memory (Blocking call)
copies the GpuMat content to device memory (Non-Blocking call)
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<()>
fn copy_to_3(
&self,
dst: &mut dyn ToOutputArray,
mask: &dyn ToInputArray,
stream: &mut Stream
) -> Result<()>
copies those GpuMat elements to “m” that are marked with non-zero mask elements (Non-Blocking call)
converts GpuMat to another datatype (Blocking call)
fn convert_to_1(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
stream: &mut Stream
) -> Result<()>
fn convert_to_1(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
stream: &mut Stream
) -> Result<()>
converts GpuMat to another datatype (Non-Blocking call)
fn convert_to_2(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
alpha: f64,
beta: f64
) -> Result<()>
fn convert_to_2(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
alpha: f64,
beta: f64
) -> Result<()>
converts GpuMat to another datatype with scaling (Blocking call) Read more
fn convert_to_3(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
alpha: f64,
stream: &mut Stream
) -> Result<()>
fn convert_to_3(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
alpha: f64,
stream: &mut Stream
) -> Result<()>
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<()>
fn convert_to_4(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
alpha: f64,
beta: f64,
stream: &mut Stream
) -> Result<()>
converts GpuMat to another datatype with scaling (Non-Blocking call)
… for the specified column span
creates alternative GpuMat header for the same data, with different number of channels and/or different number of rows Read more
locates GpuMat header within a parent GpuMat
returns true iff the GpuMat data is continuous (i.e. when there are no gaps between successive rows) Read more
returns the size of element channel in bytes
returns GpuMat size : width == number of columns, height == number of rows
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more