OpenCV 5.0.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::dnn::BackendWrapper Class Referenceabstract

Derivatives of this class wraps cv::Mat for different backends and targets. More...

#include <opencv2/dnn/dnn.hpp>

Collaboration diagram for cv::dnn::BackendWrapper:

Public Member Functions

 BackendWrapper (const Ptr< BackendWrapper > &base, const MatShape &shape)
 Make wrapper for reused cv::Mat.
 
 BackendWrapper (int backendId, int targetId)
 
 BackendWrapper (int targetId, const cv::Mat &m)
 Wrap cv::Mat for specific backend and target.
 
virtual ~BackendWrapper ()
 Virtual destructor to make polymorphism.
 
virtual void copyToHost ()=0
 Transfer data to CPU host memory.
 
int getHostMatDepth ()
 
virtual void setHostDirty ()=0
 Indicate that an actual data is on CPU.
 

Public Attributes

int backendId
 Backend identifier.
 
int targetId
 Target identifier.
 

Protected Attributes

int hostMatDepth = -1
 

Detailed Description

Derivatives of this class wraps cv::Mat for different backends and targets.

Constructor & Destructor Documentation

◆ BackendWrapper() [1/3]

cv::dnn::BackendWrapper::BackendWrapper ( int backendId,
int targetId )

◆ BackendWrapper() [2/3]

cv::dnn::BackendWrapper::BackendWrapper ( int targetId,
const cv::Mat & m )

Wrap cv::Mat for specific backend and target.

Parameters
[in]targetIdTarget identifier.
[in]mcv::Mat for wrapping.

Make CPU->GPU data transfer if it's require for the target.

◆ BackendWrapper() [3/3]

cv::dnn::BackendWrapper::BackendWrapper ( const Ptr< BackendWrapper > & base,
const MatShape & shape )

Make wrapper for reused cv::Mat.

Parameters
[in]baseWrapper of cv::Mat that will be reused.
[in]shapeSpecific shape.

Initialize wrapper from another one. It'll wrap the same host CPU memory and mustn't allocate memory on device(i.e. GPU). It might has different shape. Use in case of CPU memory reusing for reuse associated memory on device too.

◆ ~BackendWrapper()

virtual cv::dnn::BackendWrapper::~BackendWrapper ( )
virtual

Virtual destructor to make polymorphism.

Member Function Documentation

◆ copyToHost()

virtual void cv::dnn::BackendWrapper::copyToHost ( )
pure virtual

Transfer data to CPU host memory.

◆ getHostMatDepth()

int cv::dnn::BackendWrapper::getHostMatDepth ( )
inline

◆ setHostDirty()

virtual void cv::dnn::BackendWrapper::setHostDirty ( )
pure virtual

Indicate that an actual data is on CPU.

Member Data Documentation

◆ backendId

int cv::dnn::BackendWrapper::backendId

Backend identifier.

◆ hostMatDepth

int cv::dnn::BackendWrapper::hostMatDepth = -1
protected

◆ targetId

int cv::dnn::BackendWrapper::targetId

Target identifier.


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