[−][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]
pub unsafe fn from_raw(ptr: *mut c_void) -> Self
[src]
pub fn into_raw(self) -> *mut c_void
[src]
pub fn as_raw(&self) -> *const c_void
[src]
pub fn as_raw_mut(&mut self) -> *mut c_void
[src]
impl Clone for GpuMat
[src]
pub fn clone(&self) -> Self
[src]
Calls try_clone() and panics if that fails
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for GpuMat
[src]
impl GpuMatTrait for GpuMat
[src]
pub fn as_raw_GpuMat(&self) -> *const c_void
[src]
pub fn as_raw_mut_GpuMat(&mut self) -> *mut c_void
[src]
pub fn flags(&self) -> i32
[src]
pub fn set_flags(&mut self, val: i32)
[src]
pub fn rows(&self) -> i32
[src]
pub fn set_rows(&mut self, val: i32)
[src]
pub fn cols(&self) -> i32
[src]
pub fn set_cols(&mut self, val: i32)
[src]
pub fn step(&self) -> size_t
[src]
pub fn set_step(&mut self, val: size_t)
[src]
pub fn data(&mut self) -> &mut u8
[src]
pub fn set_data(&mut self, val: &mut u8)
[src]
pub fn refcount(&mut self) -> &mut i32
[src]
pub fn set_refcount(&mut self, val: &mut i32)
[src]
pub fn datastart(&mut self) -> &mut u8
[src]
pub fn set_datastart(&mut self, val: &mut u8)
[src]
pub fn dataend(&self) -> &u8
[src]
pub fn allocator(&mut self) -> AbstractRefMut<'_, dyn GpuMat_Allocator>
[src]
pub unsafe fn set_allocator(&mut self, val: &mut dyn GpuMat_Allocator)
[src]
pub fn create(&mut self, rows: i32, cols: i32, typ: i32) -> Result<()>
[src]
pub fn create_1(&mut self, size: Size, typ: i32) -> Result<()>
[src]
pub fn release(&mut self) -> Result<()>
[src]
pub fn swap(&mut self, mat: &mut GpuMat) -> Result<()>
[src]
pub fn upload(&mut self, arr: &dyn ToInputArray) -> Result<()>
[src]
pub fn upload_async(
&mut self,
arr: &dyn ToInputArray,
stream: &mut Stream
) -> Result<()>
[src]
&mut self,
arr: &dyn ToInputArray,
stream: &mut Stream
) -> Result<()>
pub fn download(&self, dst: &mut dyn ToOutputArray) -> Result<()>
[src]
pub fn download_async(
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
[src]
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
pub fn try_clone(&self) -> Result<GpuMat>
[src]
pub fn copy_to(&self, dst: &mut dyn ToOutputArray) -> Result<()>
[src]
pub fn copy_to_1(
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
[src]
&self,
dst: &mut dyn ToOutputArray,
stream: &mut Stream
) -> Result<()>
pub fn copy_to_2(
&self,
dst: &mut dyn ToOutputArray,
mask: &dyn ToInputArray
) -> Result<()>
[src]
&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<()>
[src]
&self,
dst: &mut dyn ToOutputArray,
mask: &dyn ToInputArray,
stream: &mut Stream
) -> Result<()>
pub fn set_to(&mut self, s: Scalar) -> Result<GpuMat>
[src]
pub fn set_to_1(&mut self, s: Scalar, stream: &mut Stream) -> Result<GpuMat>
[src]
pub fn set_to_2(&mut self, s: Scalar, mask: &dyn ToInputArray) -> Result<GpuMat>
[src]
pub 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>
pub fn convert_to(&self, dst: &mut dyn ToOutputArray, rtype: i32) -> Result<()>
[src]
pub 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<()>
pub 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<()>
pub 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<()>
pub 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<()>
pub fn assign_to(&self, m: &mut GpuMat, typ: i32) -> Result<()>
[src]
pub fn ptr(&mut self, y: i32) -> Result<&mut u8>
[src]
pub fn ptr_1(&self, y: i32) -> Result<&u8>
[src]
pub fn row(&self, y: i32) -> Result<GpuMat>
[src]
pub fn col(&self, x: i32) -> Result<GpuMat>
[src]
pub fn row_range(&self, startrow: i32, endrow: i32) -> Result<GpuMat>
[src]
pub fn row_range_1(&self, r: Range) -> Result<GpuMat>
[src]
pub fn col_range(&self, startcol: i32, endcol: i32) -> Result<GpuMat>
[src]
pub fn col_range_1(&self, r: Range) -> Result<GpuMat>
[src]
pub fn reshape(&self, cn: i32, rows: i32) -> Result<GpuMat>
[src]
pub fn locate_roi(&self, whole_size: &mut Size, ofs: &mut Point) -> Result<()>
[src]
pub 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>
pub fn is_continuous(&self) -> Result<bool>
[src]
pub fn elem_size(&self) -> Result<size_t>
[src]
pub fn elem_size1(&self) -> Result<size_t>
[src]
pub fn typ(&self) -> Result<i32>
[src]
pub fn depth(&self) -> Result<i32>
[src]
pub fn channels(&self) -> Result<i32>
[src]
pub fn step1(&self) -> Result<size_t>
[src]
pub fn size(&self) -> Result<Size>
[src]
pub fn empty(&self) -> Result<bool>
[src]
pub fn cuda_ptr(&self) -> Result<*mut c_void>
[src]
pub fn update_continuity_flag(&mut self) -> Result<()>
[src]
impl Send for GpuMat
[src]
impl ToInputArray for GpuMat
[src]
pub fn input_array(&self) -> Result<_InputArray>
[src]
impl<'_> ToInputArray for &'_ GpuMat
[src]
pub fn input_array(&self) -> Result<_InputArray>
[src]
impl ToInputOutputArray for GpuMat
[src]
pub fn input_output_array(&mut self) -> Result<_InputOutputArray>
[src]
impl<'_> ToInputOutputArray for &'_ mut GpuMat
[src]
pub fn input_output_array(&mut self) -> Result<_InputOutputArray>
[src]
impl ToOutputArray for GpuMat
[src]
pub fn output_array(&mut self) -> Result<_OutputArray>
[src]
impl<'_> ToOutputArray for &'_ mut GpuMat
[src]
pub fn output_array(&mut self) -> Result<_OutputArray>
[src]
impl VectorElement for GpuMat where
Vector<GpuMat>: VectorExtern<GpuMat>,
[src]
Vector<GpuMat>: VectorExtern<GpuMat>,
Auto Trait Implementations
impl RefUnwindSafe for GpuMat
[src]
impl !Sync for GpuMat
[src]
impl Unpin for GpuMat
[src]
impl UnwindSafe for GpuMat
[src]
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,