Trait opencv::core::prelude::GpuMatTraitConst [−][src]
pub trait GpuMatTraitConst {
Show 38 methods
fn as_raw_GpuMat(&self) -> *const c_void;
fn flags(&self) -> i32 { ... }
fn rows(&self) -> i32 { ... }
fn cols(&self) -> i32 { ... }
fn step(&self) -> size_t { ... }
fn dataend(&self) -> *const u8 { ... }
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 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(&self, y: i32) -> Result<*const 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, r: Range) -> Result<GpuMat> { ... }
fn col_range(&self, startcol: i32, endcol: i32) -> Result<GpuMat> { ... }
fn col_range_1(&self, 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 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> { ... }
}
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
Required methods
fn as_raw_GpuMat(&self) -> *const c_void
Provided methods
! includes several bit-fields:
- the magic signature
- continuity flag
- depth
- number of channels
fn download(&self, dst: &mut dyn ToOutputArray) -> Result<()>
fn download(&self, dst: &mut dyn ToOutputArray) -> Result<()>
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<()>
fn download_async(
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
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 copy_to(&self, dst: &mut dyn ToOutputArray) -> Result<()>
fn copy_to(&self, dst: &mut dyn ToOutputArray) -> Result<()>
copies the GpuMat content to device memory (Blocking call)
copies the GpuMat content to device memory (Non-Blocking call)
fn copy_to_2(
&self,
dst: &mut dyn ToOutputArray,
mask: &dyn ToInputArray
) -> Result<()>
fn copy_to_2(
&self,
dst: &mut dyn ToOutputArray,
mask: &dyn ToInputArray
) -> Result<()>
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)
fn convert_to(&self, dst: &mut dyn ToOutputArray, rtype: i32) -> Result<()>
fn convert_to(&self, dst: &mut dyn ToOutputArray, rtype: i32) -> Result<()>
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<()>
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)
fn row_range_1(&self, r: Range) -> Result<GpuMat>
… for the specified column span
fn col_range_1(&self, r: Range) -> Result<GpuMat>
creates alternative GpuMat header for the same data, with different number of channels and/or different number of rows
C++ default parameters
- rows: 0
locates GpuMat header within a parent GpuMat
fn is_continuous(&self) -> Result<bool>
fn is_continuous(&self) -> Result<bool>
returns true iff the GpuMat data is continuous (i.e. when there are no gaps between successive rows)
fn elem_size1(&self) -> Result<size_t>
fn elem_size1(&self) -> Result<size_t>
returns the size of element channel in bytes
returns GpuMat size : width == number of columns, height == number of rows