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

default constructor

C++ default parameters

  • allocator: GpuMat::defaultAllocator()

constructs GpuMat of the specified size and type

C++ default parameters

  • allocator: GpuMat::defaultAllocator()

C++ default parameters

  • allocator: GpuMat::defaultAllocator()

constructs GpuMat and fills it with the specified value _s

C++ default parameters

  • allocator: GpuMat::defaultAllocator()

C++ default parameters

  • allocator: GpuMat::defaultAllocator()

copy constructor

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

builds GpuMat from host memory (Blocking call)

C++ default parameters

  • allocator: GpuMat::defaultAllocator()

Trait Implementations

Wrap the specified raw pointer Read more

Return an the underlying raw pointer while consuming this wrapper. Read more

Return the underlying raw pointer. Read more

Return the underlying mutable raw pointer Read more

Calls try_clone() and panics if that fails

Performs copy-assignment from source. Read more

Executes the destructor for this type. Read more

! includes several bit-fields: Read more

the number of rows and columns

the number of rows and columns

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

pointer to the data

pointer to the data

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

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

swaps with other smart pointer

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)

returns pointer to y-th row Read more

moves/resizes the current GpuMat ROI inside the parent GpuMat

internal use method: updates the continuity flag

! includes several bit-fields: Read more

the number of rows and columns

the number of rows and columns

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

Performs data download from GpuMat (Blocking call) Read more

Performs data download from GpuMat (Non-Blocking call) Read more

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

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)

copies those GpuMat elements to “m” that are marked with non-zero mask elements (Non-Blocking call)

converts GpuMat to another datatype (Blocking call)

converts GpuMat to another datatype (Non-Blocking call)

converts GpuMat to another datatype with scaling (Blocking call) Read more

converts GpuMat to another datatype with scaling (Non-Blocking call)

converts GpuMat to another datatype with scaling (Non-Blocking call)

C++ default parameters Read more

C++ default parameters Read more

returns a new GpuMat header for the specified row

returns a new GpuMat header for the specified column

… for the specified row span

… 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 element size in bytes

returns the size of element channel in bytes

returns element type

returns element type

returns number of channels

returns step/elemSize1()

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

returns true if GpuMat data is NULL

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.