OpenCV 4.10.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
Graph API: Pixelwise operations

Detailed Description

gapi_math

Functions

GMat cv::gapi::bitwise_and (const GMat &src1, const GMat &src2)
 computes bitwise conjunction of the two matrixes (src1 & src2) Calculates the per-element bit-wise logical conjunction of two matrices of the same size.
 
GMat cv::gapi::bitwise_and (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::bitwise_not (const GMat &src)
 Inverts every bit of an array.
 
GMat cv::gapi::bitwise_or (const GMat &src1, const GMat &src2)
 computes bitwise disjunction of the two matrixes (src1 | src2) Calculates the per-element bit-wise logical disjunction of two matrices of the same size.
 
GMat cv::gapi::bitwise_or (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::bitwise_xor (const GMat &src1, const GMat &src2)
 computes bitwise logical "exclusive or" of the two matrixes (src1 ^ src2) Calculates the per-element bit-wise logical "exclusive or" of two matrices of the same size.
 
GMat cv::gapi::bitwise_xor (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::cmpEQ (const GMat &src1, const GMat &src2)
 Performs the per-element comparison of two matrices checking if elements from first matrix are equal to elements in second.
 
GMat cv::gapi::cmpEQ (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::cmpGE (const GMat &src1, const GMat &src2)
 Performs the per-element comparison of two matrices checking if elements from first matrix are greater or equal compare to elements in second.
 
GMat cv::gapi::cmpGE (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::cmpGT (const GMat &src1, const GMat &src2)
 Performs the per-element comparison of two matrices checking if elements from first matrix are greater compare to elements in second.
 
GMat cv::gapi::cmpGT (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::cmpLE (const GMat &src1, const GMat &src2)
 Performs the per-element comparison of two matrices checking if elements from first matrix are less or equal compare to elements in second.
 
GMat cv::gapi::cmpLE (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::cmpLT (const GMat &src1, const GMat &src2)
 Performs the per-element comparison of two matrices checking if elements from first matrix are less than elements in second.
 
GMat cv::gapi::cmpLT (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::cmpNE (const GMat &src1, const GMat &src2)
 Performs the per-element comparison of two matrices checking if elements from first matrix are not equal to elements in second.
 
GMat cv::gapi::cmpNE (const GMat &src1, const GScalar &src2)
 
GMat cv::gapi::select (const GMat &src1, const GMat &src2, const GMat &mask)
 Select values from either first or second of input matrices by given mask. The function set to the output matrix either the value from the first input matrix if corresponding value of mask matrix is 255, or value from the second input matrix (if value of mask matrix set to 0).
 

Function Documentation

◆ bitwise_and() [1/2]

GMat cv::gapi::bitwise_and ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.bitwise_and(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

computes bitwise conjunction of the two matrixes (src1 & src2) Calculates the per-element bit-wise logical conjunction of two matrices of the same size.

In case of floating-point matrices, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel matrices, each channel is processed independently. Output matrix must have the same size and depth as the input matrices.

Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.bitwise_and"
Parameters
src1first input matrix.
src2second input matrix.

◆ bitwise_and() [2/2]

GMat cv::gapi::bitwise_and ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.bitwise_and(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.bitwise_andS"
Parameters
src1first input matrix.
src2scalar, which will be per-lemenetly conjuncted with elements of src1.

◆ bitwise_not()

GMat cv::gapi::bitwise_not ( const GMat & src)
Python:
cv.gapi.bitwise_not(src) -> retval

#include <opencv2/gapi/core.hpp>

Inverts every bit of an array.

The function bitwise_not calculates per-element bit-wise inversion of the input matrix:

\[\texttt{dst} (I) = \neg \texttt{src} (I)\]

In case of floating-point matrices, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel matrices, each channel is processed independently. Output matrix must have the same size and depth as the input matrix.

Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.bitwise_not"
Parameters
srcinput matrix.

◆ bitwise_or() [1/2]

GMat cv::gapi::bitwise_or ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.bitwise_or(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

computes bitwise disjunction of the two matrixes (src1 | src2) Calculates the per-element bit-wise logical disjunction of two matrices of the same size.

In case of floating-point matrices, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel matrices, each channel is processed independently. Output matrix must have the same size and depth as the input matrices.

Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.bitwise_or"
Parameters
src1first input matrix.
src2second input matrix.

◆ bitwise_or() [2/2]

GMat cv::gapi::bitwise_or ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.bitwise_or(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.bitwise_orS"
Parameters
src1first input matrix.
src2scalar, which will be per-lemenetly disjuncted with elements of src1.

◆ bitwise_xor() [1/2]

GMat cv::gapi::bitwise_xor ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.bitwise_xor(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

computes bitwise logical "exclusive or" of the two matrixes (src1 ^ src2) Calculates the per-element bit-wise logical "exclusive or" of two matrices of the same size.

In case of floating-point matrices, their machine-specific bit representations (usually IEEE754-compliant) are used for the operation. In case of multi-channel matrices, each channel is processed independently. Output matrix must have the same size and depth as the input matrices.

Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.bitwise_xor"
Parameters
src1first input matrix.
src2second input matrix.

◆ bitwise_xor() [2/2]

GMat cv::gapi::bitwise_xor ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.bitwise_xor(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.bitwise_xorS"
Parameters
src1first input matrix.
src2scalar, for which per-lemenet "logical or" operation on elements of src1 will be performed.

◆ cmpEQ() [1/2]

GMat cv::gapi::cmpEQ ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.cmpEQ(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

Performs the per-element comparison of two matrices checking if elements from first matrix are equal to elements in second.

The function compares elements of two matrices src1 and src2 of the same size:

\[\texttt{dst} (I) = \texttt{src1} (I) == \texttt{src2} (I)\]

When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

\[\texttt{dst} = \texttt{src1} == \texttt{src2}\]

Output matrix of depth CV_8U must have the same size and the same number of channels as the input matrices.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpEQ"
Parameters
src1first input matrix.
src2second input matrix/scalar of the same depth as first input matrix.
See also
min, max, threshold, cmpNE

◆ cmpEQ() [2/2]

GMat cv::gapi::cmpEQ ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.cmpEQ(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpEQScalar"

◆ cmpGE() [1/2]

GMat cv::gapi::cmpGE ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.cmpGE(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

Performs the per-element comparison of two matrices checking if elements from first matrix are greater or equal compare to elements in second.

The function compares elements of two matrices src1 and src2 of the same size:

\[\texttt{dst} (I) = \texttt{src1} (I) >= \texttt{src2} (I)\]

When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

\[\texttt{dst} = \texttt{src1} >= \texttt{src2}\]

Output matrix of depth CV_8U must have the same size and the same number of channels as the input matrices.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpGE"
Parameters
src1first input matrix.
src2second input matrix/scalar of the same depth as first input matrix.
See also
min, max, threshold, cmpLE, cmpGT, cmpLT

◆ cmpGE() [2/2]

GMat cv::gapi::cmpGE ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.cmpGE(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpLGEcalar"

◆ cmpGT() [1/2]

GMat cv::gapi::cmpGT ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.cmpGT(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

Performs the per-element comparison of two matrices checking if elements from first matrix are greater compare to elements in second.

The function compares elements of two matrices src1 and src2 of the same size:

\[\texttt{dst} (I) = \texttt{src1} (I) > \texttt{src2} (I)\]

When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

\[\texttt{dst} = \texttt{src1} > \texttt{src2}\]

Output matrix of depth CV_8U must have the same size and the same number of channels as the input matrices/matrix.

Supported input matrix data types are CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpGT"
Parameters
src1first input matrix.
src2second input matrix/scalar of the same depth as first input matrix.
See also
min, max, threshold, cmpLE, cmpGE, cmpLT

◆ cmpGT() [2/2]

GMat cv::gapi::cmpGT ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.cmpGT(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpGTScalar"

◆ cmpLE() [1/2]

GMat cv::gapi::cmpLE ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.cmpLE(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

Performs the per-element comparison of two matrices checking if elements from first matrix are less or equal compare to elements in second.

The function compares elements of two matrices src1 and src2 of the same size:

\[\texttt{dst} (I) = \texttt{src1} (I) <= \texttt{src2} (I)\]

When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

\[\texttt{dst} = \texttt{src1} <= \texttt{src2}\]

Output matrix of depth CV_8U must have the same size and the same number of channels as the input matrices.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpLE"
Parameters
src1first input matrix.
src2second input matrix/scalar of the same depth as first input matrix.
See also
min, max, threshold, cmpGT, cmpGE, cmpLT

◆ cmpLE() [2/2]

GMat cv::gapi::cmpLE ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.cmpLE(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpLEScalar"

◆ cmpLT() [1/2]

GMat cv::gapi::cmpLT ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.cmpLT(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

Performs the per-element comparison of two matrices checking if elements from first matrix are less than elements in second.

The function compares elements of two matrices src1 and src2 of the same size:

\[\texttt{dst} (I) = \texttt{src1} (I) < \texttt{src2} (I)\]

When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

\[\texttt{dst} = \texttt{src1} < \texttt{src2}\]

Output matrix of depth CV_8U must have the same size and the same number of channels as the input matrices/matrix.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpLT"
Parameters
src1first input matrix.
src2second input matrix/scalar of the same depth as first input matrix.
See also
min, max, threshold, cmpLE, cmpGE, cmpGT

◆ cmpLT() [2/2]

GMat cv::gapi::cmpLT ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.cmpLT(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpLTScalar"

◆ cmpNE() [1/2]

GMat cv::gapi::cmpNE ( const GMat & src1,
const GMat & src2 )
Python:
cv.gapi.cmpNE(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

Performs the per-element comparison of two matrices checking if elements from first matrix are not equal to elements in second.

The function compares elements of two matrices src1 and src2 of the same size:

\[\texttt{dst} (I) = \texttt{src1} (I) != \texttt{src2} (I)\]

When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

\[\texttt{dst} = \texttt{src1} != \texttt{src2}\]

Output matrix of depth CV_8U must have the same size and the same number of channels as the input matrices.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpNE"
Parameters
src1first input matrix.
src2second input matrix/scalar of the same depth as first input matrix.
See also
min, max, threshold, cmpEQ

◆ cmpNE() [2/2]

GMat cv::gapi::cmpNE ( const GMat & src1,
const GScalar & src2 )
Python:
cv.gapi.cmpNE(src1, src2) -> retval

#include <opencv2/gapi/core.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Function textual ID is "org.opencv.core.pixelwise.compare.cmpNEScalar"

◆ select()

GMat cv::gapi::select ( const GMat & src1,
const GMat & src2,
const GMat & mask )
Python:
cv.gapi.select(src1, src2, mask) -> retval

#include <opencv2/gapi/core.hpp>

Select values from either first or second of input matrices by given mask. The function set to the output matrix either the value from the first input matrix if corresponding value of mask matrix is 255, or value from the second input matrix (if value of mask matrix set to 0).

Input mask matrix must be of CV_8UC1 type, two other inout matrices and output matrix should be of the same type. The size should be the same for all input and output matrices. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

Note
Function textual ID is "org.opencv.core.pixelwise.select"
Parameters
src1first input matrix.
src2second input matrix.
maskmask input matrix.