[−][src]Struct opencv::core::GpuMat
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
impl GpuMat
[src]
pub fn as_raw_GpuMat(&self) -> *const c_void
[src]
pub fn as_raw_mut_GpuMat(&mut self) -> *mut c_void
[src]
impl GpuMat
[src]
pub fn default_allocator(
) -> Result<AbstractRefMut<'static, dyn GpuMat_Allocator>>
[src]
) -> Result<AbstractRefMut<'static, dyn GpuMat_Allocator>>
default allocator
pub unsafe fn set_default_allocator(
allocator: &mut dyn GpuMat_Allocator
) -> Result<()>
[src]
allocator: &mut dyn GpuMat_Allocator
) -> Result<()>
pub unsafe fn new(allocator: &mut dyn GpuMat_Allocator) -> Result<GpuMat>
[src]
pub unsafe fn new_rows_cols(
rows: i32,
cols: i32,
typ: i32,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
[src]
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()
pub unsafe fn new_size(
size: Size,
typ: i32,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
[src]
size: Size,
typ: i32,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
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>
[src]
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>
[src]
size: Size,
typ: i32,
s: Scalar,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
C++ default parameters
- allocator: GpuMat::defaultAllocator()
pub fn copy(m: &GpuMat) -> Result<GpuMat>
[src]
copy constructor
pub unsafe fn new_rows_cols_with_data(
rows: i32,
cols: i32,
typ: i32,
data: *mut c_void,
step: size_t
) -> Result<GpuMat>
[src]
rows: i32,
cols: i32,
typ: i32,
data: *mut c_void,
step: size_t
) -> Result<GpuMat>
constructor for GpuMat headers pointing to user-allocated data
C++ default parameters
- step: Mat::AUTO_STEP
pub unsafe fn new_size_with_data(
size: Size,
typ: i32,
data: *mut c_void,
step: size_t
) -> Result<GpuMat>
[src]
size: Size,
typ: i32,
data: *mut c_void,
step: size_t
) -> Result<GpuMat>
C++ default parameters
- step: Mat::AUTO_STEP
pub fn rowscols(
m: &GpuMat,
row_range: Range,
col_range: Range
) -> Result<GpuMat>
[src]
m: &GpuMat,
row_range: Range,
col_range: Range
) -> Result<GpuMat>
creates a GpuMat header for a part of the bigger matrix
pub fn roi(m: &GpuMat, roi: Rect) -> Result<GpuMat>
[src]
pub unsafe fn from_hostmem(
arr: &dyn ToInputArray,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
[src]
arr: &dyn ToInputArray,
allocator: &mut dyn GpuMat_Allocator
) -> Result<GpuMat>
builds GpuMat from host memory (Blocking call)
C++ default parameters
- allocator: GpuMat::defaultAllocator()
impl GpuMat
[src]
Trait Implementations
impl Boxed for GpuMat
[src]
unsafe fn from_raw(ptr: *mut c_void) -> Self
[src]
fn into_raw(self) -> *mut c_void
[src]
fn as_raw(&self) -> *const c_void
[src]
fn as_raw_mut(&mut self) -> *mut c_void
[src]
impl Clone for GpuMat
[src]
fn clone(&self) -> Self
[src]
Calls try_clone() and panics if that fails
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for GpuMat
[src]
impl GpuMatTrait for GpuMat
[src]
fn as_raw_GpuMat(&self) -> *const c_void
[src]
fn as_raw_mut_GpuMat(&mut self) -> *mut c_void
[src]
fn flags(&self) -> i32
[src]
fn set_flags(&mut self, val: i32)
[src]
fn rows(&self) -> i32
[src]
fn set_rows(&mut self, val: i32)
[src]
fn cols(&self) -> i32
[src]
fn set_cols(&mut self, val: i32)
[src]
fn step(&self) -> size_t
[src]
fn set_step(&mut self, val: size_t)
[src]
fn data(&mut self) -> &mut u8
[src]
fn set_data(&mut self, val: &mut u8)
[src]
fn refcount(&mut self) -> &mut i32
[src]
fn set_refcount(&mut self, val: &mut i32)
[src]
fn datastart(&mut self) -> &mut u8
[src]
fn set_datastart(&mut self, val: &mut u8)
[src]
fn dataend(&self) -> &u8
[src]
fn allocator(&mut self) -> AbstractRefMut<dyn GpuMat_Allocator>
[src]
unsafe fn set_allocator(&mut self, val: &mut dyn GpuMat_Allocator)
[src]
fn create(&mut self, rows: i32, cols: i32, typ: i32) -> Result<()>
[src]
fn create_1(&mut self, size: Size, typ: i32) -> Result<()>
[src]
fn release(&mut self) -> Result<()>
[src]
fn swap(&mut self, mat: &mut GpuMat) -> Result<()>
[src]
fn upload(&mut self, arr: &dyn ToInputArray) -> Result<()>
[src]
fn upload_async(
&mut self,
arr: &dyn ToInputArray,
stream: &mut Stream
) -> Result<()>
[src]
&mut self,
arr: &dyn ToInputArray,
stream: &mut Stream
) -> Result<()>
fn download(&self, dst: &mut dyn ToOutputArray) -> Result<()>
[src]
fn download_async(
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
[src]
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
fn try_clone(&self) -> Result<GpuMat>
[src]
fn copy_to(&self, dst: &mut dyn ToOutputArray) -> Result<()>
[src]
fn copy_to_1(
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
[src]
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
fn copy_to_2(
&self,
dst: &mut dyn ToOutputArray,
mask: &dyn ToInputArray
) -> Result<()>
[src]
&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<()>
[src]
&self,
dst: &mut dyn ToOutputArray,
mask: &dyn ToInputArray,
stream: &mut Stream
) -> Result<()>
fn set_to(&mut self, s: Scalar) -> Result<GpuMat>
[src]
fn set_to_1(&mut self, s: Scalar, stream: &mut Stream) -> Result<GpuMat>
[src]
fn set_to_2(&mut self, s: Scalar, mask: &dyn ToInputArray) -> Result<GpuMat>
[src]
fn set_to_3(
&mut self,
s: Scalar,
mask: &dyn ToInputArray,
stream: &mut Stream
) -> Result<GpuMat>
[src]
&mut self,
s: Scalar,
mask: &dyn ToInputArray,
stream: &mut Stream
) -> Result<GpuMat>
fn convert_to(&self, dst: &mut dyn ToOutputArray, rtype: i32) -> Result<()>
[src]
fn convert_to_1(
&self,
dst: &mut dyn ToOutputArray,
rtype: i32,
stream: &mut Stream
) -> Result<()>
[src]
&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<()>
[src]
&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<()>
[src]
&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<()>
[src]
&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<()>
[src]
fn ptr(&mut self, y: i32) -> Result<&mut u8>
[src]
fn ptr_1(&self, y: i32) -> Result<&u8>
[src]
fn row(&self, y: i32) -> Result<GpuMat>
[src]
fn col(&self, x: i32) -> Result<GpuMat>
[src]
fn row_range(&self, startrow: i32, endrow: i32) -> Result<GpuMat>
[src]
fn row_range_1(&self, r: Range) -> Result<GpuMat>
[src]
fn col_range(&self, startcol: i32, endcol: i32) -> Result<GpuMat>
[src]
fn col_range_1(&self, r: Range) -> Result<GpuMat>
[src]
fn reshape(&self, cn: i32, rows: i32) -> Result<GpuMat>
[src]
fn locate_roi(&self, whole_size: &mut Size, ofs: &mut Point) -> Result<()>
[src]
fn adjust_roi(
&mut self,
dtop: i32,
dbottom: i32,
dleft: i32,
dright: i32
) -> Result<GpuMat>
[src]
&mut self,
dtop: i32,
dbottom: i32,
dleft: i32,
dright: i32
) -> Result<GpuMat>
fn is_continuous(&self) -> Result<bool>
[src]
fn elem_size(&self) -> Result<size_t>
[src]
fn elem_size1(&self) -> Result<size_t>
[src]
fn typ(&self) -> Result<i32>
[src]
fn depth(&self) -> Result<i32>
[src]
fn channels(&self) -> Result<i32>
[src]
fn step1(&self) -> Result<size_t>
[src]
fn size(&self) -> Result<Size>
[src]
fn empty(&self) -> Result<bool>
[src]
fn cuda_ptr(&self) -> Result<*mut c_void>
[src]
fn update_continuity_flag(&mut self) -> Result<()>
[src]
impl Send for GpuMat
[src]
impl ToInputArray for GpuMat
[src]
fn input_array(&self) -> Result<_InputArray>
[src]
impl<'_> ToInputArray for &'_ GpuMat
[src]
fn input_array(&self) -> Result<_InputArray>
[src]
impl ToInputOutputArray for GpuMat
[src]
fn input_output_array(&mut self) -> Result<_InputOutputArray>
[src]
impl<'_> ToInputOutputArray for &'_ mut GpuMat
[src]
fn input_output_array(&mut self) -> Result<_InputOutputArray>
[src]
impl ToOutputArray for GpuMat
[src]
fn output_array(&mut self) -> Result<_OutputArray>
[src]
impl<'_> ToOutputArray for &'_ mut GpuMat
[src]
fn output_array(&mut self) -> Result<_OutputArray>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,