Per-element Operations#

Detailed Description#

Function Documentation#

add()#

void cv::cann::add(
const AscendMat & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
int dtype = -1,
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.

add()#

void cv::cann::add(
const AscendMat & src1,
const Scalar & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
int dtype = -1,
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.

add()#

void cv::cann::add(
const InputArray src1,
const InputArray src2,
OutputArray dst,
const InputArray mask = noArray(),
int dtype = -1,
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Computes a matrix-matrix or matrix-scalar sum.

See also

cv::add cuda::add

Parameters

  • src1 — First source matrix or scalar.

  • src2 — Second source matrix or scalar. Matrix should have the same size and type as src1 .

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • mask — Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.

  • dtype — Optional depth of the output array.

  • stream — AscendStream for the asynchronous version.

add()#

void cv::cann::add(
const Scalar & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
int dtype = -1,
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.

addWeighted()#

void cv::cann::addWeighted(
const AscendMat & src1,
double alpha,
const AscendMat & src2,
double beta,
double gamma,
AscendMat & dst,
int dtype = -1,
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.

addWeighted()#

void cv::cann::addWeighted(
const InputArray src1,
double alpha,
const InputArray src2,
double beta,
double gamma,
OutputArray dst,
int dtype = -1,
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Computes the weighted sum of two arrays.

The function addWeighted calculates the weighted sum of two arrays as follows:

\[ \texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} ) \]

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.

Note

src must be one of the following types: int32, int16, float16, float32.

Parameters

  • src1 — First source array.

  • alpha — Weight for the first array elements.

  • src2 — Second source array of the same size and channel number as src1 .

  • beta — Weight for the second array elements.

  • dst — Destination array that has the same size and number of channels as the input arrays.

  • gamma — Scalar added to each sum.

  • dtype — Optional depth of the destination array. When both input arrays have the same depth, dtype can be set to -1, which will be equivalent to src1.depth().

  • stream — Stream for the asynchronous version.

bitwise_and()#

void cv::cann::bitwise_and(
const AscendMat & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

bitwise_and()#

void cv::cann::bitwise_and(
const AscendMat & src1,
const Scalar & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
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.

bitwise_and()#

void cv::cann::bitwise_and(
const InputArray src1,
const InputArray src2,
OutputArray dst,
const InputArray mask = noArray(),
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Performs a per-element bitwise conjunction of two matrices (or of matrix and scalar).

Note

src must be one of the following types: int32, int16, uint16

Parameters

  • src1 — First source matrix or scalar.

  • src2 — Second source matrix or scalar.

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • mask — Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.

  • stream — AscendStream for the asynchronous version.

bitwise_and()#

void cv::cann::bitwise_and(
const Scalar & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
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.

bitwise_not()#

void cv::cann::bitwise_not(
const AscendMat & src,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
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.

bitwise_not()#

void cv::cann::bitwise_not(
const InputArray src,
OutputArray dst,
const InputArray mask = noArray(),
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Performs a per-element bitwise inversion.

Note

src must be one of the following types: int32, int16, uint16

Parameters

  • src — First source matrix.

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • mask — Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.

  • stream — AscendStream for the asynchronous version.

bitwise_or()#

void cv::cann::bitwise_or(
const AscendMat & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

bitwise_or()#

void cv::cann::bitwise_or(
const AscendMat & src1,
const Scalar & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
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.

bitwise_or()#

void cv::cann::bitwise_or(
const InputArray src1,
const InputArray src2,
OutputArray dst,
const InputArray mask = noArray(),
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Performs a per-element bitwise disjunction of two matrices (or of matrix and scalar).

Note

src must be one of the following types: int32, int16, uint16

Parameters

  • src1 — First source matrix or scalar.

  • src2 — Second source matrix or scalar.

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • mask — Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.

  • stream — AscendStream for the asynchronous version.

bitwise_or()#

void cv::cann::bitwise_or(
const Scalar & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
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.

bitwise_xor()#

void cv::cann::bitwise_xor(
const AscendMat & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

bitwise_xor()#

void cv::cann::bitwise_xor(
const AscendMat & src1,
const Scalar & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
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.

bitwise_xor()#

void cv::cann::bitwise_xor(
const InputArray src1,
const InputArray src2,
OutputArray dst,
const InputArray mask = noArray(),
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Performs a per-element bitwise exclusive or operation of two matrices (or of matrix and scalar).

Note

src must be one of the following types: int32, int16, uint16

Parameters

  • src1 — First source matrix or scalar.

  • src2 — Second source matrix or scalar.

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • mask — Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.

  • stream — AscendStream for the asynchronous version.

bitwise_xor()#

void cv::cann::bitwise_xor(
const Scalar & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
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.

divide()#

void cv::cann::divide(
const AscendMat & src1,
const AscendMat & src2,
AscendMat & dst,
float scale = 1,
int dtype = -1,
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

divide()#

void cv::cann::divide(
const AscendMat & src1,
const Scalar & src2,
AscendMat & dst,
float scale = 1,
int dtype = -1,
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.

divide()#

void cv::cann::divide(
const InputArray src1,
const InputArray src2,
OutputArray dst,
float scale = 1,
int dtype = -1,
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Computes a matrix-matrix or matrix-scalar division.

Note

when scale == 1, src must be one of the following types: float16, float32, double, uint16, int8, uint8, int16, int32, int64; when scale != 1, src must be one of the following types: int32, int16, float16, float32.

Parameters

  • src1 — First source matrix or scalar.

  • src2 — Second source matrix or scalar. Matrix should have the same size and type as src1 .

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • scale — Optional scale factor.

  • dtype — Optional depth of the output array.

  • stream — AscendStream for the asynchronous version.

divide()#

void cv::cann::divide(
const Scalar & src1,
const AscendMat & src2,
AscendMat & dst,
float scale = 1,
int dtype = -1,
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.

multiply()#

void cv::cann::multiply(
const AscendMat & src1,
const AscendMat & src2,
AscendMat & dst,
float scale = 1,
int dtype = -1,
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.

multiply()#

void cv::cann::multiply(
const AscendMat & src1,
const Scalar & src2,
AscendMat & dst,
float scale = 1,
int dtype = -1,
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.

multiply()#

void cv::cann::multiply(
const InputArray src1,
const InputArray src2,
OutputArray dst,
float scale = 1,
int dtype = -1,
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Computes a matrix-matrix or matrix-scalar per-element product.

Note

when scale != 1, src must be one of the following types: float16, float32, int32

Parameters

  • src1 — First source matrix or scalar.

  • src2 — Second source matrix or scalar. Matrix should have the same size and type as src1 .

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • scale — Optional scale factor.

  • dtype — Optional depth of the output array.

  • stream — AscendStream for the asynchronous version.

multiply()#

void cv::cann::multiply(
const Scalar & src1,
const AscendMat & src2,
AscendMat & dst,
float scale = 1,
int dtype = -1,
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.

subtract()#

void cv::cann::subtract(
const AscendMat & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
int dtype = -1,
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.

subtract()#

void cv::cann::subtract(
const AscendMat & src1,
const Scalar & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
int dtype = -1,
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.

subtract()#

void cv::cann::subtract(
const InputArray src1,
const InputArray src2,
OutputArray dst,
const InputArray mask = noArray(),
int dtype = -1,
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Computes a matrix-matrix or matrix-scalar difference.

Parameters

  • src1 — First source matrix or scalar.

  • src2 — Second source matrix or scalar. Matrix should have the same size and type as src1 .

  • dst — Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by dtype or src1 depth.

  • mask — Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.

  • dtype — Optional depth of the output array.

  • stream — AscendStream for the asynchronous version.

subtract()#

void cv::cann::subtract(
const Scalar & src1,
const AscendMat & src2,
AscendMat & dst,
const AscendMat & mask = AscendMat(),
int dtype = -1,
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.

threshold()#

double cv::cann::threshold(
const AscendMat & src,
AscendMat & dst,
double thresh,
double maxval,
int type,
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.

threshold()#

double cv::cann::threshold(
const InputArray src,
OutputArray dst,
double thresh,
double maxval,
int type,
AscendStream & stream = AscendStream::Null() )

#include <opencv2/cann_interface.hpp>

Applies a fixed-level threshold to each array element.

Note

src must be one of the following types: float16, float32.

Parameters

  • src — Source array (single-channel).

  • dst — Destination array with the same size and type as src .

  • thresh — Threshold value.

  • maxval — Maximum value to use with THRESH_BINARY and THRESH_BINARY_INV threshold types.

  • type — Threshold type. For details, see threshold . The THRESH_MASK, THRESH_OTSU and THRESH_TRIANGLE threshold types are not supported.

  • stream — AscendStream for the asynchronous version.