OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
cv::cuda::HostMem 類參考

一個帶引用計數的類,封裝了 CUDA 的特殊記憶體型別分配函式。 更多...

#include <opencv2/core/cuda.hpp>

cv::cuda::HostMem 協作圖

公共型別

列舉  AllocType {
  PAGE_LOCKED = 1 ,
  SHARED = 2 ,
  WRITE_COMBINED = 4
}
 

公共成員函式

 HostMem (const HostMem &m)
 
 HostMem (HostMem::AllocType alloc_type=HostMem::AllocType::PAGE_LOCKED)
 
 HostMem (InputArray arr, HostMem::AllocType alloc_type=HostMem::AllocType::PAGE_LOCKED)
 從宿主記憶體建立並複製資料
 
 HostMem (int rows, int cols, int type, HostMem::AllocType alloc_type=HostMem::AllocType::PAGE_LOCKED)
 
 HostMem (Size size, int type, HostMem::AllocType alloc_type=HostMem::AllocType::PAGE_LOCKED)
 
 ~HostMem ()
 
int channels () const
 
HostMem clone () const
 返回矩陣的深複製,即資料被複制
 
void create (int rows, int cols, int type)
 分配新的矩陣資料,除非矩陣已具有指定的尺寸和型別。
 
void create (Size size, int type)
 
GpuMat createGpuMatHeader () const
 將 CPU 記憶體對映到 GPU 地址空間併為其建立不帶引用計數的 cuda::GpuMat 頭。
 
Mat createMatHeader () const
 返回一個停用 HostMem 資料引用計數的矩陣頭。
 
int depth () const
 
size_t elemSize () const
 
size_t elemSize1 () const
 
bool empty () const
 
bool isContinuous () const
 
HostMemoperator= (const HostMem &m)
 
void release ()
 減少引用計數並在需要時釋放記憶體。
 
HostMem reshape (int cn, int rows=0) const
 
Size size () const
 
size_t step1 () const
 
void swap (HostMem &b)
 與其它智慧指標交換
 
int type () const
 

靜態公共成員函式

static MatAllocatorgetAllocator (HostMem::AllocType alloc_type=HostMem::AllocType::PAGE_LOCKED)
 

公共屬性

AllocType alloc_type
 
int cols
 
uchardata
 
const uchardataend
 
uchardatastart
 
int flags
 
int * refcount
 
int rows
 
size_t step
 

詳細描述

一個帶引用計數的類,封裝了 CUDA 的特殊記憶體型別分配函式。

其介面也與 Mat 類似,但具有額外的記憶體型別引數。

  • PAGE_LOCKED 設定頁面鎖定記憶體型別,通常用於從/到 GPU 的快速非同步資料上傳/下載。
  • SHARED 指定零複製記憶體分配,如果支援,可以實現將宿主記憶體對映到 GPU 地址空間。
  • WRITE_COMBINED 設定寫組合緩衝區,該緩衝區不被 CPU 快取。此類緩衝區用於在 GPU 僅讀取資料時向 GPU 提供資料。優點是更好地利用 CPU 快取。
注意
此類記憶體型別的分配大小通常受到限制。有關更多詳細資訊,請參閱 CUDA 2.2 Pinned Memory APIs 文件或 CUDA C Programming Guide

成員列舉文件

◆ AllocType

列舉器
PAGE_LOCKED 
SHARED 
WRITE_COMBINED 

建構函式 & 解構函式文件

◆ HostMem() [1/5]

cv::cuda::HostMem::HostMem ( HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED)
顯式
Python
cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(行數, 列數, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(尺寸, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem 物件>

◆ HostMem() [2/5]

cv::cuda::HostMem::HostMem ( const HostMem & m)
Python
cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(行數, 列數, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(尺寸, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem 物件>

◆ HostMem() [3/5]

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 物件>
cv.cuda.HostMem(行數, 列數, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(尺寸, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem 物件>

◆ HostMem() [4/5]

cv::cuda::HostMem::HostMem ( Size size,
int type,
HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED )
Python
cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(行數, 列數, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(尺寸, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem 物件>

◆ HostMem() [5/5]

cv::cuda::HostMem::HostMem ( InputArray arr,
HostMem::AllocType alloc_type = HostMem::AllocType::PAGE_LOCKED )
顯式
Python
cv.cuda.HostMem([, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(行數, 列數, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(尺寸, 型別[, alloc_type]) -> <cuda_HostMem 物件>
cv.cuda.HostMem(arr[, alloc_type]) -> <cuda_HostMem 物件>

從宿主記憶體建立並複製資料

◆ ~HostMem()

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

成員函式文件

◆ channels()

int cv::cuda::HostMem::channels ( ) const
Python
cv.cuda.HostMem.channels() -> retval

◆ clone()

HostMem cv::cuda::HostMem::clone ( ) const
Python
cv.cuda.HostMem.clone() -> retval

返回矩陣的深複製,即資料被複制

◆ create() [1/2]

void cv::cuda::HostMem::create ( int rows,
int cols,
int type )
Python
cv.cuda.HostMem.create(rows, cols, type) ->

分配新的矩陣資料,除非矩陣已具有指定的尺寸和型別。

◆ create() [2/2]

void cv::cuda::HostMem::create ( Size size,
int type )
Python
cv.cuda.HostMem.create(rows, cols, type) ->

◆ createGpuMatHeader()

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

將 CPU 記憶體對映到 GPU 地址空間併為其建立不帶引用計數的 cuda::GpuMat 頭。

這隻有在記憶體使用 SHARED 標誌分配且硬體支援時才能完成。筆記型電腦通常共享影片和 CPU 記憶體,因此可以對映地址空間,從而消除額外的複製。

◆ createMatHeader()

Mat cv::cuda::HostMem::createMatHeader ( ) const
Python
cv.cuda.HostMem.createMatHeader() -> retval

返回一個停用 HostMem 資料引用計數的矩陣頭。

◆ depth()

int cv::cuda::HostMem::depth ( ) const
Python
cv.cuda.HostMem.depth() -> retval

◆ elemSize()

size_t cv::cuda::HostMem::elemSize ( ) const
Python
cv.cuda.HostMem.elemSize() -> retval

◆ elemSize1()

size_t cv::cuda::HostMem::elemSize1 ( ) const
Python
cv.cuda.HostMem.elemSize1() -> retval

◆ empty()

bool cv::cuda::HostMem::empty ( ) const
Python
cv.cuda.HostMem.empty() -> retval

◆ getAllocator()

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

◆ isContinuous()

bool cv::cuda::HostMem::isContinuous ( ) const
Python
cv.cuda.HostMem.isContinuous() -> retval

◆ operator=()

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

◆ release()

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

減少引用計數並在需要時釋放記憶體。

◆ reshape()

HostMem cv::cuda::HostMem::reshape ( int cn,
int rows = 0 ) const
Python
cv.cuda.HostMem.reshape(cn[, rows]) -> retval

為相同資料建立另一個 HostMem 頭,具有不同的通道數和/或不同的行數

◆ size()

Size cv::cuda::HostMem::size ( ) const
Python
cv.cuda.HostMem.size() -> retval

◆ step1()

size_t cv::cuda::HostMem::step1 ( ) const
Python
cv.cuda.HostMem.step1() -> retval

◆ swap()

void cv::cuda::HostMem::swap ( HostMem & b)
Python
cv.cuda.HostMem.swap(b) ->

與其它智慧指標交換

◆ type()

int cv::cuda::HostMem::type ( ) const
Python
cv.cuda.HostMem.type() -> retval

成員資料文件

◆ 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

此類的文件是從以下檔案生成的