Core Operations on Matrices#
Detailed Description#
Enumerations#
enum cv::cann::InterpolationFlags {
cv::cann::INTER_NEAREST = 0,
cv::cann::INTER_LINEAR = 1,
cv::cann::INTER_CUBIC = 2,
cv::cann::INTER_AREA = 3,
cv::cann::INTER_MAX = 7
}interpolation algorithm View details
Enumeration Type Documentation#
InterpolationFlags#
enum cv::cann::InterpolationFlags
#include <opencv2/cann_interface.hpp>
interpolation algorithm
Enumerator:
|
nearest neighbor interpolation |
|
bilinear interpolation |
|
bicubic interpolation |
|
resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method. |
|
mask for interpolation codes |
Function Documentation#
copyMakeBorder()#
void cv::cann::copyMakeBorder(
const AscendMat & src,
AscendMat & dst,
int top,
int bottom,
int left,
int right,
int borderType,
const Scalar & value = Scalar() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
copyMakeBorder()#
void cv::cann::copyMakeBorder(
const InputArray src,
OutputArray dst,
int top,
int bottom,
int left,
int right,
int borderType,
const Scalar & value = Scalar() )
#include <opencv2/cann_interface.hpp>
Forms a border and fills it with specified bordertype around the copy of input image.
Note
The input images must be uint8, and only GRAY and BGR images are supported. The resolution of input and output images must in range of [106, 40964096].
Only the following devices are supported: Atlas Inference Series products, Atlas 200/500 A2 Inference products and Atlas A2 Training Series products/Atlas 300I A2 Inference products.
See also
Parameters
src— Source image.dst— Destination image of the same type as src and the size Size(src.cols+left+right, src.rows+top+bottom).top— Number of pixels for top paddingbottom— Number of pixels for bottom paddingleft— Number of pixels for left paddingright— Number of pixels for right padding Parameter specifying how many pixels in each direction from the source image rectangle to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs to be built.borderType— Border type. only cv::BorderTypes::BORDER_CONSTANT and cv::BorderTypes::BORDER_REPLICATE are supported.value— Border BGR or YUV value if borderType==BORDER_CONSTANT.
crop()#
AscendMat cv::cann::crop(
const AscendMat & src,
const Rect & rect,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
crop()#
AscendMat cv::cann::crop(
InputArray src,
const Rect & rect,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
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.
See also
Parameters
src— input array.rect— a rect to crop a array tostream— AscendStream for the asynchronous version.
cropResize()#
void cv::cann::cropResize(
const AscendMat & src,
AscendMat & dst,
const Rect & rect,
Size dsize,
double fx,
double fy,
int interpolation )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
cropResize()#
void cv::cann::cropResize(
const InputArray src,
OutputArray dst,
const Rect & rect,
Size dsize,
double fx,
double fy,
int interpolation )
#include <opencv2/cann_interface.hpp>
crop a sub image from a big one, and resize it to certain size.
Note
The input images must be uint8, and only GRAY and BGR images are supported. The resolution of input and output images must in range of [106, 40964096].
Only the following devices are supported: Atlas Inference Series products, Atlas 200/500 A2 Inference products and Atlas A2 Training Series products/Atlas 300I A2 Inference products.
See also
Parameters
src— input array.dst— output array. it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src.rect— a rect to crop a array todsize— output image size; if it equals zero, it is computed as cv::resize do.fx— scale factor along the horizontal axis; when it equals 0, it is computed as\[ (𝚍𝚘𝚞𝚋𝚕𝚎)𝚍𝚜𝚒𝚣𝚎.𝚠𝚒𝚍𝚝𝚑/𝚜𝚛𝚌.𝚌𝚘𝚕𝚜 \]fy— scale factor along the vertical axis; when it equals 0, it is computed as\[ (𝚍𝚘𝚞𝚋𝚕𝚎)𝚍𝚜𝚒𝚣𝚎.𝚑𝚎𝚒𝚐𝚑𝚝/𝚜𝚛𝚌.𝚛𝚘𝚠𝚜 \]interpolation— interpolation method, only support INTER_NEAREST and INTER_LINEAR here. (see cv.cann.InterpolationFlags)
cropResizeMakeBorder()#
void cv::cann::cropResizeMakeBorder(
const AscendMat & src,
AscendMat & dst,
const Rect & rect,
Size dsize,
double fx,
double fy,
int interpolation,
int top,
int left,
const int borderType,
Scalar value = Scalar() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
cropResizeMakeBorder()#
void cv::cann::cropResizeMakeBorder(
const InputArray src,
OutputArray dst,
const Rect & rect,
Size dsize,
double fx,
double fy,
int interpolation,
int top,
int left,
const int borderType,
Scalar value = Scalar() )
#include <opencv2/cann_interface.hpp>
crop a sub image from a big one, resize it to certain size, and form the top/left border and fills it with specified bordertype.
Note
The input images must be uint8, and only GRAY and BGR images are supported. The resolution of input and output images must in range of [106, 40964096].
Only the following devices are supported: Atlas Inference Series products, Atlas 200/500 A2 Inference products and Atlas A2 Training Series products/Atlas 300I A2 Inference products.
See also
cv::gapi::crop, cv::resize, cv::cann::resize, cv::BorderTypes
Parameters
src— input array.dst— output array; it has the size Size(dsize.height + top, dsize.width + left).rect— a rect to crop a array todsize— resize size;fx— scale factor along the horizontal axis;fy— scale factor along the vertical axis;interpolation— interpolation method, only INTER_NEAREST and INTER_LINEAR are supported. (see cv.cann.InterpolationFlags)borderType— border extrapolate method, only cv::BorderTypes::BORDER_CONSTANT and cv::BorderTypes::BORDER_REPLICATE are supported.value— Border BGR or YUV value if borderType==BORDER_CONSTANT.top— Number of pixels for top paddingleft— Number of pixels for left padding
flip()#
void cv::cann::flip(
const AscendMat & src,
AscendMat & dst,
int flipCode,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
flip()#
void cv::cann::flip(
InputArray src,
OutputArray dst,
int flipCode,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
Flips a 2D matrix around vertical, horizontal, or both axes.
Note
src must be one of the following types: float16,float,int64,int32,int16,uint16
See also
Parameters
src— Source matrix.dst— Destination matrix.flipCode— Flip mode for the source:0 Flips around x-axis.
0 Flips around y-axis.
< 0 Flips around both axes.
stream— AscendStream for the asynchronous version.
merge()#
void cv::cann::merge(
const AscendMat * src,
size_t n,
AscendMat & dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
Makes a multi-channel matrix out of several single-channel matrices.
Note
src must be one of the following types: float16, float32, double, int32, int16, int8, int64, uint8, uint16, uint32, uint64.
See also
Parameters
src— Array/vector of source matrices.n— Number of source matrices.dst— Destination matrix.stream— AscendStream for the asynchronous version.
merge()#
void cv::cann::merge(
const AscendMat * src,
size_t n,
OutputArray & dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
merge()#
void cv::cann::merge(
const std::vector< AscendMat > & src,
AscendMat & dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
merge()#
void cv::cann::merge(
const std::vector< AscendMat > & src,
OutputArray & dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
resize()#
void cv::cann::resize(
const AscendMat & src,
AscendMat & dst,
Size dsize,
double fx,
double fy,
int interpolation,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
resize()#
void cv::cann::resize(
InputArray src,
OutputArray dst,
Size dsize,
double fx,
double fy,
int interpolation,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
Resizes an image src down to or up to the specified size.
Note
There are some constraints for the input datatype: when resampling using nearest neighbor or bilinear interpolation: Input images must be uint8, and only GRAY and BGR images are supported. The resolution of input and output images must in range of [106, 40964096]. bicubic interpolation: Input images can be of different types, output images must be float or uint8. pixel area interpolation: Input images can be of different types but output images are always float.
Only the following devices are supported when resampling using nearest neighbor or bilinear interpolation: Atlas Inference Series products, Atlas 200/500 A2 Inference products and Atlas A2 Training Series products/Atlas 300I A2 Inference products
See also
Parameters
src— input imagedst— output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src.dsize— output image size; if it equals zero, it is computed as:\[ 𝚍𝚜𝚒𝚣𝚎 = 𝚂𝚒𝚣𝚎(𝚛𝚘𝚞𝚗𝚍(𝚏𝚡*𝚜𝚛𝚌.𝚌𝚘𝚕𝚜), 𝚛𝚘𝚞𝚗𝚍(𝚏𝚢*𝚜𝚛𝚌.𝚛𝚘𝚠𝚜)) \]Either dsize or both fx and fy must be non-zero.
fx— scale factor along the horizontal axis; when it equals 0, it is computed as\[ (𝚍𝚘𝚞𝚋𝚕𝚎)𝚍𝚜𝚒𝚣𝚎.𝚠𝚒𝚍𝚝𝚑/𝚜𝚛𝚌.𝚌𝚘𝚕𝚜 \]fy— scale factor along the vertical axis; when it equals 0, it is computed as\[ (𝚍𝚘𝚞𝚋𝚕𝚎)𝚍𝚜𝚒𝚣𝚎.𝚑𝚎𝚒𝚐𝚑𝚝/𝚜𝚛𝚌.𝚛𝚘𝚠𝚜 \]interpolation— interpolation method(see cv.cann.InterpolationFlags)stream— AscendStream for the asynchronous version.
rotate()#
void cv::cann::rotate(
const AscendMat & src,
AscendMat & dst,
int rotateMode,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
rotate()#
void cv::cann::rotate(
InputArray src,
OutputArray dst,
int rotateCode,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
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).
Note
src must be one of the following types: float16,float,int64,int32,int16,uint16
See also
Parameters
src— input array.dst— output array of the same type as src. The size is the same with ROTATE_180, and the rows and cols are switched for ROTATE_90_CLOCKWISE and ROTATE_90_COUNTERCLOCKWISE.rotateCode— an enum to specify how to rotate the array; see the enum RotateFlagsstream— AscendStream for the asynchronous version.
split()#
void cv::cann::split(
const AscendMat & src,
AscendMat * dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
Copies each plane of a multi-channel matrix into an array.
Note
src must be one of the types:float16, float32, double, int64, int32, uint8, uint16, uint32, uint64, int8, int16, bool
See also
Parameters
src— Source matrix.dst— Destination array/vector of single-channel matrices.stream— AscendStream for the asynchronous version.
split()#
void cv::cann::split(
const AscendMat & src,
std::vector< AscendMat > & dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
split()#
void cv::cann::split(
const InputArray src,
AscendMat * dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
split()#
void cv::cann::split(
const InputArray src,
std::vector< AscendMat > & dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
transpose()#
void cv::cann::transpose(
const AscendMat & src,
AscendMat & dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
transpose()#
void cv::cann::transpose(
InputArray src,
OutputArray dst,
AscendStream & stream = AscendStream::Null() )
#include <opencv2/cann_interface.hpp>
Transposes a matrix.
Note
src must be one of the following types: float16,float,int8,int16,int32,int64,uint8,uint16,uint32,uint64,bool
See also
Parameters
src— Source matrix.dst— Destination matrix.stream— AscendStream for the asynchronous version.