OpenCV  4.9.0
Open Source Computer Vision
Classes | Enumerations | Functions
cv::cann Namespace Reference

Classes

class  AscendEvent
 AscendEvent to synchronize between different streams. More...
 
struct  AscendEventAccessor
 Class that enables getting aclrtAscendEvent from cann::AscendEvent. More...
 
class  AscendMat
 
class  AscendStream
 In AscendCL Stream(AscendStream) is a task queue. Stream is used to manage the parallelism of tasks. The tasks inside a Stream are executed sequentially, that is, the Stream executes sequentially according to the sent tasks; the tasks in different Streams are executed in parallel. More...
 
struct  AscendStreamAccessor
 Class that enables getting aclrtAscendStream from cann::AscendStream. More...
 
struct  AscendTensor
 Parameter type for call_call interfaces. More...
 
class  OperatorRunner
 Interface to call operators in CANN package. More...
 

Enumerations

enum  InterpolationFlags {
  INTER_NEAREST = 0,
  INTER_LINEAR = 1,
  INTER_CUBIC = 2,
  INTER_AREA = 3,
  INTER_MAX = 7
}
 Resizes an image src down to or up to the specified size. More...
 

Functions

void aclrtFreeWarpper (void *data)
 
void aclrtMallocWarpper (void **data, size_t size)
 
void aclrtMemcpy2dWarpper (std::shared_ptr< uchar > &dst, size_t offset, size_t dpitch, const void *src, size_t spitch, size_t width, size_t length, AscendStream &stream)
 
void aclrtMemcpy2dWarpper (void *dst, size_t dpitch, const std::shared_ptr< uchar > &src, size_t offset, size_t spitch, size_t width, size_t length, AscendStream &stream)
 
void aclrtMemcpyWarpper (std::shared_ptr< uchar > &dst, size_t offset, const void *src, size_t size, AscendStream &stream)
 
void aclrtMemcpyWarpper (void *dst, const std::shared_ptr< uchar > &src, size_t offset, size_t size, AscendStream &stream)
 
void aclrtMemcpyWarpper (std::shared_ptr< uchar > &dst, size_t dstOffset, const std::shared_ptr< uchar > &src, size_t srcOffset, size_t size, AscendStream &stream)
 
void aclrtMemsetWarpper (std::shared_ptr< uchar > &ptr, int32_t value, size_t count, AscendStream &stream)
 
void add (const InputArray src1, const InputArray src2, OutputArray dst, const InputArray mask=noArray(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 Computes a matrix-matrix or matrix-scalar sum. More...
 
void add (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void add (const AscendMat &src1, const Scalar &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void add (const Scalar &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void addWeighted (const InputArray src1, double alpha, const InputArray src2, double beta, double gamma, OutputArray dst, int dtype=-1, AscendStream &stream=AscendStream::Null())
 Computes the weighted sum of two arrays. More...
 
void addWeighted (const AscendMat &src1, double alpha, const AscendMat &src2, double beta, double gamma, AscendMat &dst, int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void arithm_op (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, const char *op, AscendStream &stream)
 
void arithm_op (const AscendMat &src, const Scalar &sc, AscendMat &dst, const char *op, AscendStream &stream)
 
void arithm_op (const Scalar &sc, const AscendMat &src, AscendMat &dst, const char *op, AscendStream &stream)
 
void arithm_op (const AscendMat &src, AscendMat &dst, const char *op, AscendStream &stream)
 
void arithm_op (const AscendMat &src, float scalar, AscendMat &dst, const char *op, AscendStream &stream)
 
void bitwise_and (const InputArray src1, const InputArray src2, OutputArray dst, const InputArray mask=noArray(), AscendStream &stream=AscendStream::Null())
 Performs a per-element bitwise conjunction of two matrices (or of matrix and scalar). More...
 
void bitwise_and (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_and (const AscendMat &src1, const Scalar &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_and (const Scalar &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_not (const InputArray src, OutputArray dst, const InputArray mask=noArray(), AscendStream &stream=AscendStream::Null())
 Performs a per-element bitwise inversion. More...
 
void bitwise_not (const AscendMat &src, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_or (const InputArray src1, const InputArray src2, OutputArray dst, const InputArray mask=noArray(), AscendStream &stream=AscendStream::Null())
 Performs a per-element bitwise disjunction of two matrices (or of matrix and scalar). More...
 
void bitwise_or (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_or (const AscendMat &src1, const Scalar &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_or (const Scalar &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_xor (const InputArray src1, const InputArray src2, OutputArray dst, const InputArray mask=noArray(), AscendStream &stream=AscendStream::Null())
 Performs a per-element bitwise exclusive or operation of two matrices (or of matrix and scalar). More...
 
void bitwise_xor (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_xor (const AscendMat &src1, const Scalar &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void bitwise_xor (const Scalar &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), AscendStream &stream=AscendStream::Null())
 
void crop (const AscendMat &src, AscendMat &dst, const AscendMat &sizeSrcNpu, int64_t *offset, AscendStream &stream)
 
AscendMat crop (InputArray src, const Rect &rect, AscendStream &stream=AscendStream::Null())
 crop a 2D array. The function crops the matrix by given cv::Rect. Output matrix must be of the same depth as input one, size is specified by given rect size. More...
 
AscendMat crop (const AscendMat &src, const Rect &rect, AscendStream &stream=AscendStream::Null())
 
void cvtColor (const InputArray src, OutputArray dst, int code, int dstCn=0, AscendStream &stream=AscendStream::Null())
 Converts an image from one color space to another. More...
 
void cvtColor (const AscendMat &src, AscendMat &dst, int code, int dstCn=0, AscendStream &stream=AscendStream::Null())
 
void divide (const InputArray src1, const InputArray src2, OutputArray dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 Computes a matrix-matrix or matrix-scalar division. More...
 
void divide (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void divide (const AscendMat &src1, const Scalar &src2, AscendMat &dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void divide (const Scalar &src1, const AscendMat &src2, AscendMat &dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void finalizeAcl ()
 finalize AscendCL. More...
 
void flip (const AscendMat &src, std::vector< int32_t > &asixs, AscendMat &dst, AscendStream &stream)
 
void flip (InputArray src, OutputArray dst, int flipCode, AscendStream &stream=AscendStream::Null())
 Flips a 2D matrix around vertical, horizontal, or both axes. More...
 
void flip (const AscendMat &src, AscendMat &dst, int flipCode, AscendStream &stream=AscendStream::Null())
 
aclDataType getACLType (int opencvdepth)
 Type mapping between opencv and cann. More...
 
int32_t getDevice ()
 Get current Ascend device. More...
 
AscendMat getInputMat (InputArray src, AscendStream &stream)
 Get Ascend matrix object from Input array, upload matrix memory if need. (Non-Blocking call) More...
 
AscendMat getOutputMat (OutputArray dst, int rows, int cols, int type, AscendStream &stream)
 Get Ascend matrix object from Output array, upload matrix memory if need. More...
 
void initAcl ()
 init AscendCL. More...
 
std::shared_ptr< ucharmallocAndUpload (const void *data, size_t size, AscendStream &stream, AscendMat::Allocator *allocator)
 Malloc and upload raw data to devices. More...
 
void merge (const AscendMat *src, size_t n, AscendMat &dst, AscendStream &stream=AscendStream::Null())
 Makes a multi-channel matrix out of several single-channel matrices. More...
 
void merge (const std::vector< AscendMat > &src, AscendMat &dst, AscendStream &stream=AscendStream::Null())
 
void merge (const AscendMat *src, size_t n, OutputArray &dst, AscendStream &stream=AscendStream::Null())
 
void merge (const std::vector< AscendMat > &src, OutputArray &dst, AscendStream &stream=AscendStream::Null())
 
void multiply (const InputArray src1, const InputArray src2, OutputArray dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 Computes a matrix-matrix or matrix-scalar per-element product. More...
 
void multiply (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void multiply (const AscendMat &src1, const Scalar &src2, AscendMat &dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void multiply (const Scalar &src1, const AscendMat &src2, AscendMat &dst, float scale=1, int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void resetDevice ()
 Clear all context created in current Ascend device. More...
 
void resize (const AscendMat &src, AscendMat &dst, int32_t *dstSize, int interpolation, AscendStream &stream)
 
void resize (InputArray _src, OutputArray _dst, Size dsize, double inv_scale_x, double inv_scale_y, int interpolation, AscendStream &stream=AscendStream::Null())
 
void resize (const AscendMat &src, AscendMat &dst, Size dsize, double inv_scale_x, double inv_scale_y, int interpolation, AscendStream &stream=AscendStream::Null())
 
void rotate (InputArray src, OutputArray dst, int rotateCode, AscendStream &stream=AscendStream::Null())
 Rotates a 2D array in multiples of 90 degrees. The function cv::rotate rotates the array in one of three different ways: Rotate by 90 degrees clockwise (rotateCode = ROTATE_90_CLOCKWISE). Rotate by 180 degrees clockwise (rotateCode = ROTATE_180). Rotate by 270 degrees clockwise (rotateCode = ROTATE_90_COUNTERCLOCKWISE). More...
 
void rotate (const AscendMat &src, AscendMat &dst, int rotateMode, AscendStream &stream=AscendStream::Null())
 
void setDevice (int device)
 Choose Ascend npu device. More...
 
void split (const AscendMat &src, AscendMat *dst, AscendStream &stream=AscendStream::Null())
 Copies each plane of a multi-channel matrix into an array. More...
 
void split (const AscendMat &src, std::vector< AscendMat > &dst, AscendStream &stream=AscendStream::Null())
 
void split (const InputArray src, AscendMat *dst, AscendStream &stream=AscendStream::Null())
 
void split (const InputArray src, std::vector< AscendMat > &dst, AscendStream &stream=AscendStream::Null())
 
void subtract (const InputArray src1, const InputArray src2, OutputArray dst, const InputArray mask=noArray(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 Computes a matrix-matrix or matrix-scalar difference. More...
 
void subtract (const AscendMat &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void subtract (const AscendMat &src1, const Scalar &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void subtract (const Scalar &src1, const AscendMat &src2, AscendMat &dst, const AscendMat &mask=AscendMat(), int dtype=-1, AscendStream &stream=AscendStream::Null())
 
void syncOutput (const AscendMat &dst, OutputArray _dst, AscendStream &stream)
 Sync output matrix to Output array, download matrix memory if need. More...
 
double threshold (const InputArray src, OutputArray dst, double thresh, double maxval, int type, AscendStream &stream=AscendStream::Null())
 Applies a fixed-level threshold to each array element. More...
 
double threshold (const AscendMat &src, AscendMat &dst, double thresh, double maxval, int type, AscendStream &stream=AscendStream::Null())
 
void transData (const AscendMat &src, AscendMat &dst, const char *from, const char *to, AscendStream &stream)
 
void transpose (const AscendMat &src, int64_t *perm, AscendMat &dst, AscendStream &stream)
 
void transpose (InputArray src, OutputArray dst, AscendStream &stream=AscendStream::Null())
 Transposes a matrix. More...
 
void transpose (const AscendMat &src, AscendMat &dst, AscendStream &stream=AscendStream::Null())
 
AscendStream wrapStream (size_t AscendStreamAddress)
 Bindings overload to create a Stream object from the address stored in an existing CANN Runtime API stream pointer (aclrtStream). More...
 

Function Documentation

◆ aclrtFreeWarpper()

void cv::cann::aclrtFreeWarpper ( void *  data)

◆ aclrtMallocWarpper()

void cv::cann::aclrtMallocWarpper ( void **  data,
size_t  size 
)

◆ aclrtMemcpy2dWarpper() [1/2]

void cv::cann::aclrtMemcpy2dWarpper ( std::shared_ptr< uchar > &  dst,
size_t  offset,
size_t  dpitch,
const void *  src,
size_t  spitch,
size_t  width,
size_t  length,
AscendStream stream 
)

◆ aclrtMemcpy2dWarpper() [2/2]

void cv::cann::aclrtMemcpy2dWarpper ( void *  dst,
size_t  dpitch,
const std::shared_ptr< uchar > &  src,
size_t  offset,
size_t  spitch,
size_t  width,
size_t  length,
AscendStream stream 
)

◆ aclrtMemcpyWarpper() [1/3]

void cv::cann::aclrtMemcpyWarpper ( std::shared_ptr< uchar > &  dst,
size_t  offset,
const void *  src,
size_t  size,
AscendStream stream 
)

◆ aclrtMemcpyWarpper() [2/3]

void cv::cann::aclrtMemcpyWarpper ( void *  dst,
const std::shared_ptr< uchar > &  src,
size_t  offset,
size_t  size,
AscendStream stream 
)

◆ aclrtMemcpyWarpper() [3/3]

void cv::cann::aclrtMemcpyWarpper ( std::shared_ptr< uchar > &  dst,
size_t  dstOffset,
const std::shared_ptr< uchar > &  src,
size_t  srcOffset,
size_t  size,
AscendStream stream 
)

◆ aclrtMemsetWarpper()

void cv::cann::aclrtMemsetWarpper ( std::shared_ptr< uchar > &  ptr,
int32_t  value,
size_t  count,
AscendStream stream 
)

◆ arithm_op() [1/5]

void cv::cann::arithm_op ( const AscendMat src1,
const AscendMat src2,
AscendMat dst,
const char *  op,
AscendStream stream 
)

◆ arithm_op() [2/5]

void cv::cann::arithm_op ( const AscendMat src,
const Scalar sc,
AscendMat dst,
const char *  op,
AscendStream stream 
)

◆ arithm_op() [3/5]

void cv::cann::arithm_op ( const Scalar sc,
const AscendMat src,
AscendMat dst,
const char *  op,
AscendStream stream 
)

◆ arithm_op() [4/5]

void cv::cann::arithm_op ( const AscendMat src,
AscendMat dst,
const char *  op,
AscendStream stream 
)

◆ arithm_op() [5/5]

void cv::cann::arithm_op ( const AscendMat src,
float  scalar,
AscendMat dst,
const char *  op,
AscendStream stream 
)

◆ crop()

void cv::cann::crop ( const AscendMat src,
AscendMat dst,
const AscendMat sizeSrcNpu,
int64_t offset,
AscendStream stream 
)

◆ flip()

void cv::cann::flip ( const AscendMat src,
std::vector< int32_t > &  asixs,
AscendMat dst,
AscendStream stream 
)

◆ getACLType()

aclDataType cv::cann::getACLType ( int  opencvdepth)

Type mapping between opencv and cann.

◆ mallocAndUpload()

std::shared_ptr<uchar> cv::cann::mallocAndUpload ( const void *  data,
size_t  size,
AscendStream stream,
AscendMat::Allocator allocator 
)

Malloc and upload raw data to devices.

◆ resize()

void cv::cann::resize ( const AscendMat src,
AscendMat dst,
int32_t dstSize,
int  interpolation,
AscendStream stream 
)

◆ transData()

void cv::cann::transData ( const AscendMat src,
AscendMat dst,
const char *  from,
const char *  to,
AscendStream stream 
)

◆ transpose()

void cv::cann::transpose ( const AscendMat src,
int64_t perm,
AscendMat dst,
AscendStream stream 
)