Class cv::cuda::HostMem#

Class with reference counting wrapping special memory type allocation functions from CUDA. View details

Collaboration diagram for cv::cuda::HostMem:

cv::cuda::HostMem Node1 cv::cuda::HostMem   + HostMem() + HostMem() + HostMem() + HostMem() + HostMem() + ~HostMem() + channels() + clone() + create() + create() and 14 more... + getAllocator() Node2 int     Node2->Node1 +cols +flags +refcount +rows Node3 size_t     Node3->Node1 +step Node4 uint8_t     Node4->Node1 +data +dataend +datastart Node5 AllocType     Node5->Node1 +alloc_type

cv::cuda::HostMem Node1 cv::cuda::HostMem   + HostMem() + HostMem() + HostMem() + HostMem() + HostMem() + ~HostMem() + channels() + clone() + create() + create() and 14 more... + getAllocator() Node2 int     Node2->Node1 +cols +flags +refcount +rows Node3 size_t     Node3->Node1 +step Node4 uint8_t     Node4->Node1 +data +dataend +datastart Node5 AllocType     Node5->Node1 +alloc_type

Public Types#

Detailed Description#

Class with reference counting wrapping special memory type allocation functions from CUDA.

Its interface is also Mat-like but with additional memory type parameters.

  • PAGE_LOCKED sets a page locked memory type used commonly for fast and asynchronous uploading/downloading data from/to GPU.

  • SHARED specifies a zero copy memory allocation that enables mapping the host memory to GPU address space, if supported.

  • WRITE_COMBINED sets the write combined buffer that is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache utilization.

Note

Allocation size of such memory types is usually limited. For more details, see CUDA 2.2 Pinned Memory APIs document or CUDA C Programming Guide.

Member Enumeration Documentation#

enum AllocType

PAGE_LOCKED
Python: cv.cuda.HostMem_PAGE_LOCKED

SHARED
Python: cv.cuda.HostMem_SHARED

WRITE_COMBINED
Python: cv.cuda.HostMem_WRITE_COMBINED

Constructor & Destructor Documentation#

HostMem()#

cv::cuda::HostMem::HostMem(const HostMem & m)

Python:

cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(rows, cols, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(size, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem object>

HostMem()#

cv::cuda::HostMem::HostMem(HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED)

Python:

cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(rows, cols, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(size, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem object>

HostMem()#

cv::cuda::HostMem::HostMem(
InputArray arr,
HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED )

Python:

cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(rows, cols, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(size, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem object>

creates from host memory with coping data

HostMem()#

cv::cuda::HostMem::HostMem(
int rows,
int cols,
int type,
HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED )

Python:

cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(rows, cols, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(size, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem object>

HostMem()#

cv::cuda::HostMem::HostMem(
Size size,
int type,
HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED )

Python:

cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(rows, cols, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(size, type[, alloc_type]) -> <cuda_HostMem object>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem object>

~HostMem()#

cv::cuda::HostMem::~HostMem()

Member Function Documentation#

getAllocator()#

static MatAllocator * cv::cuda::HostMem::getAllocator(HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED)

channels()#

int cv::cuda::HostMem::channels()

Python:

cv.cuda.HostMem.channels() -> retval

clone()#

HostMem cv::cuda::HostMem::clone()

Python:

cv.cuda.HostMem.clone() -> retval

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

create()#

void cv::cuda::HostMem::create(
int rows,
int cols,
int type )

Python:

cv.cuda.HostMem.create(rows, cols, type)

allocates new matrix data unless the matrix already has specified size and type.

create()#

void cv::cuda::HostMem::create(
Size size,
int type )

Python:

cv.cuda.HostMem.create(rows, cols, type)

createGpuMatHeader()#

GpuMat cv::cuda::HostMem::createGpuMatHeader()

Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting for it.

This can be done only if memory was allocated with the SHARED flag and if it is supported by the hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which eliminates an extra copy.

createMatHeader()#

Mat cv::cuda::HostMem::createMatHeader()

Python:

cv.cuda.HostMem.createMatHeader() -> retval

returns matrix header with disabled reference counting for HostMem data.

depth()#

int cv::cuda::HostMem::depth()

Python:

cv.cuda.HostMem.depth() -> retval

elemSize()#

size_t cv::cuda::HostMem::elemSize()

Python:

cv.cuda.HostMem.elemSize() -> retval

elemSize1()#

size_t cv::cuda::HostMem::elemSize1()

Python:

cv.cuda.HostMem.elemSize1() -> retval

empty()#

bool cv::cuda::HostMem::empty()

Python:

cv.cuda.HostMem.empty() -> retval

isContinuous()#

bool cv::cuda::HostMem::isContinuous()

Python:

cv.cuda.HostMem.isContinuous() -> retval

operator=()#

HostMem & cv::cuda::HostMem::operator=(const HostMem & m)

release()#

void cv::cuda::HostMem::release()

decrements reference counter and released memory if needed.

reshape()#

HostMem cv::cuda::HostMem::reshape(
int cn,
int rows = 0 )

Python:

cv.cuda.HostMem.reshape(cn[, rows]) -> retval

creates alternative HostMem header for the same data, with different number of channels and/or different number of rows

size()#

Size cv::cuda::HostMem::size()

Python:

cv.cuda.HostMem.size() -> retval

step1()#

size_t cv::cuda::HostMem::step1()

Python:

cv.cuda.HostMem.step1() -> retval

swap()#

void cv::cuda::HostMem::swap(HostMem & b)

Python:

cv.cuda.HostMem.swap(b)

swaps with other smart pointer

type()#

int cv::cuda::HostMem::type()

Python:

cv.cuda.HostMem.type() -> retval

Member Data Documentation#

alloc_type#

AllocType cv::cuda::HostMem::alloc_type

cols#

int cv::cuda::HostMem::cols

data#

uchar * cv::cuda::HostMem::data

dataend#

const uchar * cv::cuda::HostMem::dataend

datastart#

uchar * cv::cuda::HostMem::datastart

flags#

int cv::cuda::HostMem::flags

refcount#

int * cv::cuda::HostMem::refcount

rows#

int cv::cuda::HostMem::rows

step#

size_t cv::cuda::HostMem::step

Source file#

The documentation for this class was generated from the following file: