cv::gapi namespace#

G-API framework » G-API Graph Compilation Arguments | G-API framework » G-API Main Classes | G-API framework » G-API Data Types » G-API Metadata Descriptors | G-API framework » G-API Serialization functionality

Namespaces#

Classes#

Name

struct GNetPackage

struct GNetParam

struct Generic

struct KalmanParams

struct use_only

class GBackend

class GFunctor

Enumerations#

enum class cv::gapi::StereoOutputFormat {
    cv::gapi::StereoOutputFormat::DEPTH_FLOAT16,
    cv::gapi::StereoOutputFormat::DEPTH_FLOAT32,
    cv::gapi::StereoOutputFormat::DISPARITY_FIXED16_11_5,
    cv::gapi::StereoOutputFormat::DISPARITY_FIXED16_12_4,
    cv::gapi::StereoOutputFormat::DEPTH_16F = DEPTH_FLOAT16,
    cv::gapi::StereoOutputFormat::DEPTH_32F = DEPTH_FLOAT32,
    cv::gapi::StereoOutputFormat::DISPARITY_16Q_10_5 = DISPARITY_FIXED16_11_5,
    cv::gapi::StereoOutputFormat::DISPARITY_16Q_11_4 = DISPARITY_FIXED16_12_4
}

Typedef Documentation#

GKernelPackage#

using cv::gapi::GKernelPackage = cv::GKernelPackage#

Enumeration Type Documentation#

StereoOutputFormat#

enum class cv::gapi::StereoOutputFormat

DEPTH_FLOAT16
Python: cv.gapi.StereoOutputFormat_DEPTH_FLOAT16

Floating point 16 bit value, CV_16FC1. This identifier is deprecated, use DEPTH_16F instead.

DEPTH_FLOAT32
Python: cv.gapi.StereoOutputFormat_DEPTH_FLOAT32

Floating point 32 bit value, CV_32FC1 This identifier is deprecated, use DEPTH_16F instead.

DISPARITY_FIXED16_11_5
Python: cv.gapi.StereoOutputFormat_DISPARITY_FIXED16_11_5

16 bit signed: first bit for sign, 10 bits for integer part, 5 bits for fractional part. This identifier is deprecated, use DISPARITY_16Q_10_5 instead.

DISPARITY_FIXED16_12_4
Python: cv.gapi.StereoOutputFormat_DISPARITY_FIXED16_12_4

16 bit signed: first bit for sign, 11 bits for integer part, 4 bits for fractional part. This identifier is deprecated, use DISPARITY_16Q_11_4 instead.

DEPTH_16F
Python: cv.gapi.StereoOutputFormat_DEPTH_16F

Same as DEPTH_FLOAT16.

DEPTH_32F
Python: cv.gapi.StereoOutputFormat_DEPTH_32F

Same as DEPTH_FLOAT32.

DISPARITY_16Q_10_5
Python: cv.gapi.StereoOutputFormat_DISPARITY_16Q_10_5

Same as DISPARITY_FIXED16_11_5.

DISPARITY_16Q_11_4
Python: cv.gapi.StereoOutputFormat_DISPARITY_16Q_11_4

Same as DISPARITY_FIXED16_12_4.

Function Documentation#

combine()#

template<typename ...Ps>
cv::GKernelPackage cv::gapi::combine(const cv::GKernelPackage &a, const cv::GKernelPackage &b, Ps&&... rest)#

Combines multiple G-API kernel packages into one.

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

This function successively combines the passed kernel packages using a right fold. Calling combine(a, b, c) is equal to combine(a, combine(b, c)).

Returns:

The resulting kernel package

combine()#

cv::GKernelPackage cv::gapi::combine(const cv::GKernelPackage &lhs, const cv::GKernelPackage &rhs)#

deserialize()#

Warning

doxygenfunction: Unable to resolve function “cv::gapi::deserialize” with arguments (const std::vector<char>&) in doxygen xml output for project “opencv” from directory: /media/abhishek/hugedrive21/opencv_abhishek/build/doc/doxygen/xml_for_sphinx. Potential matches:

- template<> cv::GComputation deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<typename T, typename ...Types> std::enable_if<std::is_same<T, GCompileArgs>::value, GCompileArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T, typename AtLeastOneAdapterT, typename ...AdapterTypes> std::enable_if<std::is_same<T, GRunArgs>::value, GRunArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T> T deserialize(const std::vector<char> &bytes)

deserialize()#

Warning

doxygenfunction: Unable to resolve function “cv::gapi::deserialize” with arguments (const std::vector<char>&) in doxygen xml output for project “opencv” from directory: /media/abhishek/hugedrive21/opencv_abhishek/build/doc/doxygen/xml_for_sphinx. Potential matches:

- template<> cv::GComputation deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<typename T, typename ...Types> std::enable_if<std::is_same<T, GCompileArgs>::value, GCompileArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T, typename AtLeastOneAdapterT, typename ...AdapterTypes> std::enable_if<std::is_same<T, GRunArgs>::value, GRunArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T> T deserialize(const std::vector<char> &bytes)

deserialize()#

Warning

doxygenfunction: Unable to resolve function “cv::gapi::deserialize” with arguments (const std::vector<char>&) in doxygen xml output for project “opencv” from directory: /media/abhishek/hugedrive21/opencv_abhishek/build/doc/doxygen/xml_for_sphinx. Potential matches:

- template<> cv::GComputation deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<typename T, typename ...Types> std::enable_if<std::is_same<T, GCompileArgs>::value, GCompileArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T, typename AtLeastOneAdapterT, typename ...AdapterTypes> std::enable_if<std::is_same<T, GRunArgs>::value, GRunArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T> T deserialize(const std::vector<char> &bytes)

equalizeHist()#

GMat cv::gapi::equalizeHist(const GMat &src)#

gapi_feature

The function equalizes the histogram of the input image using the following algorithm:

  • Calculate the histogram \(H\) for src .

  • Normalize the histogram so that the sum of histogram bins is 255.

  • Compute the integral of the histogram:

    \[H'_i = \sum _{0 \le j < i} H(j)\]

  • Transform the image using \(H'\) as a look-up table: \(\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\)

The algorithm normalizes the brightness and increases the contrast of the image.

Note

  • The returned image is of the same size and type as input.

  • Function textual ID is “org.opencv.imgproc.equalizeHist”

Parameters:

src – Source 8-bit single channel image.

getCompileArg()#

template<typename T>
inline cv::util::optional<T> cv::gapi::getCompileArg(const cv::GCompileArgs &args)#

Retrieves particular compilation argument by its type from cv::GCompileArgs.

infer()#

template<typename Net, typename ...Args>
Net::Result cv::gapi::infer(Args&&... args)#

Calculates response for the specified network (template parameter) given the input data.

See also

G_API_NET()

Template Parameters:

A – network type defined with G_API_NET() macro.

Parameters:

args – network’s input parameters as specified in G_API_NET() macro.

Returns:

an object of return type as defined in G_API_NET(). If a network has multiple return values (defined with a tuple), a tuple of objects of appropriate type is returned.

infer()#

template<typename T = Generic>
cv::GInferListOutputs cv::gapi::infer(const std::string &tag, const cv::GArray<cv::Rect> &rois, const cv::GInferInputs &inputs)#

Calculates responses for the specified network for every region in the source image.

Parameters:
  • tag – a network tag

  • rois – a list of rectangles describing regions of interest in the source image. Usually an output of object detector or tracker.

  • inputs – networks’s inputs

Returns:

a cv::GInferListOutputs

infer()#

template<typename T = Generic>
cv::GInferOutputs cv::gapi::infer(const std::string &tag, const cv::GInferInputs &inputs)#

Calculates response for generic network.

Parameters:
  • tag – a network tag

  • inputs – networks’s inputs

Returns:

a GInferOutputs

infer()#

template<typename T = Generic>
cv::GInferOutputs cv::gapi::infer(const std::string &tag, const cv::GOpaque<cv::Rect> &roi, const cv::GInferInputs &inputs)#

Calculates response for the generic network for the specified region in the source image. Currently expects a single-input network only.

Parameters:
  • tag – a network tag

  • roi – a an object describing the region of interest in the source image. May be calculated in the same graph dynamically.

  • inputs – networks’s inputs

Returns:

a cv::GInferOutputs

infer()#

template<typename Net, typename ...Args>
Net::ResultL cv::gapi::infer(cv::GArray<cv::Rect> roi, Args&&... args)#

Calculates responses for the specified network (template parameter) for every region in the source image.

See also

G_API_NET()

Template Parameters:

A – network type defined with G_API_NET() macro.

Parameters:
  • roi – a list of rectangles describing regions of interest in the source image. Usually an output of object detector or tracker.

  • args – network’s input parameters as specified in G_API_NET() macro. NOTE: verified to work reliably with 1-input topologies only.

Returns:

a list of objects of return type as defined in G_API_NET(). If a network has multiple return values (defined with a tuple), a tuple of GArray<> objects is returned with the appropriate types inside.

infer()#

template<typename Net, typename T>
Net::Result cv::gapi::infer(cv::GOpaque<cv::Rect> roi, T in)#

Calculates response for the specified network (template parameter) for the specified region in the source image. Currently expects a single-input network only.

See also

G_API_NET()

Template Parameters:

A – network type defined with G_API_NET() macro.

Parameters:
  • in – input image where to take ROI from.

  • roi – an object describing the region of interest in the source image. May be calculated in the same graph dynamically.

Returns:

an object of return type as defined in G_API_NET(). If a network has multiple return values (defined with a tuple), a tuple of objects of appropriate type is returned.

infer2()#

template<typename T = Generic, typename Input>
std::enable_if<cv::detail::accepted_infer_types<Input>::value, cv::GInferListOutputs>::type cv::gapi::infer2(const std::string &tag, const Input &in, const cv::GInferListInputs &inputs)#

Calculates responses for the specified network for every region in the source image, extended version.

Parameters:
  • tag – a network tag

  • in – a source image containing regions of interest.

  • inputs – networks’s inputs

Returns:

a cv::GInferListOutputs

infer2()#

template<typename Net, typename T, typename ...Args>
Net::ResultL cv::gapi::infer2(T image, cv::GArray<Args>... args)#

Calculates responses for the specified network (template parameter) for every region in the source image, extended version.

See also

G_API_NET()

Template Parameters:

A – network type defined with G_API_NET() macro.

Parameters:
  • image – A source image containing regions of interest

  • args – GArray<> objects of cv::Rect or cv::GMat, one per every network input:

    • If a cv::GArray<cv::Rect> is passed, the appropriate regions are taken from image and preprocessed to this particular network input;

    • If a cv::GArray<cv::GMat> is passed, the underlying data traited as tensor (no automatic preprocessing happen).

Returns:

a list of objects of return type as defined in G_API_NET(). If a network has multiple return values (defined with a tuple), a tuple of GArray<> objects is returned with the appropriate types inside.

island()#

void cv::gapi::island(const std::string &name, GProtoInputArgs &&ins, GProtoOutputArgs &&outs)#

Define an tagged island (subgraph) within a computation.

Declare an Island tagged with name and defined from ins to outs (exclusively, as ins/outs are data objects, and regioning is done on operations level). Throws if any operation between ins and outs are already assigned to another island.

Islands allow to partition graph into subgraphs, fine-tuning the way it is scheduled by the underlying executor.

The way how an island is defined is similar to how cv::GComputation is defined on input/output data objects. Same rules apply here as well &#8212; if there’s no functional dependency between inputs and outputs or there’s not enough input data objects were specified to properly calculate all outputs, an exception is thrown.

Use cv::GIn() / cv::GOut() to specify input/output vectors.

Parameters:
  • name – name of the Island to create

  • ins – vector of input data objects where the subgraph begins

  • outs – vector of output data objects where the subgraph ends.

kmeans()#

std::tuple<GOpaque<double>, GArray<int>, GArray<Point2f>> cv::gapi::kmeans(const GArray<Point2f> &data, const int K, const GArray<int> &bestLabels, const TermCriteria &criteria, const int attempts, const KmeansFlags flags)#

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.kmeans2D”

kmeans()#

std::tuple<GOpaque<double>, GArray<int>, GArray<Point3f>> cv::gapi::kmeans(const GArray<Point3f> &data, const int K, const GArray<int> &bestLabels, const TermCriteria &criteria, const int attempts, const KmeansFlags flags)#

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.kmeans3D”

kmeans()#

std::tuple<GOpaque<double>, GMat, GMat> cv::gapi::kmeans(const GMat &data, const int K, const GMat &bestLabels, const TermCriteria &criteria, const int attempts, const KmeansFlags flags)#

Finds centers of clusters and groups input samples around the clusters.

The function kmeans implements a k-means algorithm that finds the centers of K clusters and groups the input samples around the clusters. As an output, \(\texttt{bestLabels}_i\) contains a 0-based cluster index for the \(i^{th}\) sample.

Note

  • Function textual ID is “org.opencv.core.kmeansND”

  • In case of an N-dimensional points’ set given, input GMat can have the following traits: 2 dimensions, a single row or column if there are N channels, or N columns if there is a single channel. Mat should have CV_32F depth.

  • Although, if GMat with height != 1, width != 1, channels != 1 given as data, n-dimensional samples are considered given in amount of A, where A = height, n = width * channels.

  • In case of GMat given as data:

    • the output labels are returned as 1-channel GMat with sizes width = 1, height = A, where A is samples amount, or width = bestLabels.width, height = bestLabels.height if bestLabels given;

    • the cluster centers are returned as 1-channel GMat with sizes width = n, height = K, where n is samples’ dimensionality and K is clusters’ amount.

  • As one of possible usages, if you want to control the initial labels for each attempt by yourself, you can utilize just the core of the function. To do that, set the number of attempts to 1, initialize labels each time using a custom algorithm, pass them with the ( flags = KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best (most-compact) clustering.

Parameters:
  • data – Data for clustering. An array of N-Dimensional points with float coordinates is needed. Function can take GArray<Point2f>, GArray<Point3f> for 2D and 3D cases or GMat for any dimensionality and channels.

  • K – Number of clusters to split the set by.

  • bestLabels – Optional input integer array that can store the supposed initial cluster indices for every sample. Used when ( flags = KMEANS_USE_INITIAL_LABELS ) flag is set.

  • criteria – The algorithm termination criteria, that is, the maximum number of iterations and/or the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster centers moves by less than criteria.epsilon on some iteration, the algorithm stops.

  • attempts – Flag to specify the number of times the algorithm is executed using different initial labellings. The algorithm returns the labels that yield the best compactness (see the first function return value).

  • flags – Flag that can take values of cv::KmeansFlags .

Returns:

  • Compactness measure that is computed as

    \[\sum _i \| \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} \| ^2\]
    after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function.

  • Integer array that stores the cluster indices for every sample.

  • Array of the cluster centers.

kmeans()#

std::tuple<GOpaque<double>, GMat, GMat> cv::gapi::kmeans(const GMat &data, const int K, const TermCriteria &criteria, const int attempts, const KmeansFlags flags)#

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.kmeansNDNoInit”

  • KMEANS_USE_INITIAL_LABELS flag must not be set while using this overload.

networks()#

template<typename ...Args>
cv::gapi::GNetPackage cv::gapi::networks(Args&&... args)#

operator!=()#

inline bool cv::gapi::operator!=(const GBackend &lhs, const GBackend &rhs)#

operator+=()#

inline cv::gapi::GNetPackage &cv::gapi::operator+=(cv::gapi::GNetPackage &lhs, const cv::gapi::GNetPackage &rhs)#

parseSSD()#

GArray<Rect> cv::gapi::parseSSD(const GMat &in, const GOpaque<Size> &inSz, const float confidenceThreshold, const bool alignmentToSquare, const bool filterOutOfBounds)#

Parses output of SSD network.

Extracts detection information (box, confidence) from SSD output and filters it by given confidence and by going out of bounds.

Note

Function textual ID is “org.opencv.nn.parsers.parseSSD”

Parameters:
  • in – Input CV_32F tensor with {1,1,N,7} dimensions.

  • inSz – Size to project detected boxes to (size of the input image).

  • confidenceThreshold – If confidence of the detection is smaller than confidence threshold, detection is rejected.

  • alignmentToSquare – If provided true, bounding boxes are extended to squares. The center of the rectangle remains unchanged, the side of the square is the larger side of the rectangle.

  • filterOutOfBounds – If provided true, out-of-frame boxes are filtered.

Returns:

a vector of detected bounding boxes.

parseSSD()#

std::tuple<GArray<Rect>, GArray<int>> cv::gapi::parseSSD(const GMat &in, const GOpaque<Size> &inSz, const float confidenceThreshold = 0.5f, const int filterLabel = -1)#

Parses output of SSD network.

Extracts detection information (box, confidence, label) from SSD output and filters it by given confidence and label.

Note

Function textual ID is “org.opencv.nn.parsers.parseSSD_BL”

Parameters:
  • in – Input CV_32F tensor with {1,1,N,7} dimensions.

  • inSz – Size to project detected boxes to (size of the input image).

  • confidenceThreshold – If confidence of the detection is smaller than confidence threshold, detection is rejected.

  • filterLabel – If provided (!= -1), only detections with given label will get to the output.

Returns:

a tuple with a vector of detected boxes and a vector of appropriate labels.

parseYolo()#

std::tuple<GArray<Rect>, GArray<int>> cv::gapi::parseYolo(const GMat &in, const GOpaque<Size> &inSz, const float confidenceThreshold = 0.5f, const float nmsThreshold = 0.5f, const std::vector<float> &anchors = nn::parsers::GParseYolo::defaultAnchors())#

Parses output of Yolo network.

Extracts detection information (box, confidence, label) from Yolo output, filters it by given confidence and performs non-maximum suppression for overlapping boxes.

Note

Function textual ID is “org.opencv.nn.parsers.parseYolo”

Note

The default anchor values are specified for YOLO v2 Tiny as described in Intel Open Model Zoo documentation.

Parameters:
  • in – Input CV_32F tensor with {1,13,13,N} dimensions, N should satisfy:

    \[\texttt{N} = (\texttt{num_classes} + \texttt{5}) * \texttt{5},\]
    where num_classes - a number of classes Yolo network was trained with.

  • inSz – Size to project detected boxes to (size of the input image).

  • confidenceThreshold – If confidence of the detection is smaller than confidence threshold, detection is rejected.

  • nmsThreshold – Non-maximum suppression threshold which controls minimum relative box intersection area required for rejecting the box with a smaller confidence. If 1.f, nms is not performed and no boxes are rejected.

  • anchors – Anchors Yolo network was trained with.

Returns:

a tuple with a vector of detected boxes and a vector of appropriate labels.

stereo()#

GMat cv::gapi::stereo(const GMat &left, const GMat &right, const StereoOutputFormat of = StereoOutputFormat::DEPTH_FLOAT32)#

Computes disparity/depth map for the specified stereo-pair. The function computes disparity or depth map depending on passed StereoOutputFormat argument.

Parameters:
  • left – 8-bit single-channel left image of CV_8UC1 type.

  • right – 8-bit single-channel right image of CV_8UC1 type.

  • of – enum to specified output kind: depth or disparity and corresponding type

transpose()#

GMat cv::gapi::transpose(const GMat &src)#

Transposes a matrix.

The function transposes the matrix:

\[\texttt{dst} (i,j) = \texttt{src} (j,i)\]

Note

  • Function textual ID is “org.opencv.core.transpose”

  • No complex conjugation is done in case of a complex matrix. It should be done separately if needed.

Parameters:

src – input array.

absDiff()#

GMat cv::gapi::absDiff(const GMat &src1, const GMat &src2)#

Calculates the per-element absolute difference between two matrices.

The function absDiff calculates absolute difference between two matrices of the same size and depth:

\[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2}(I)|)\]
where I is a multi-dimensional index of matrix elements. In case of multi-channel matrices, each channel is processed independently. Output matrix must have the same size and depth as input matrices.

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

See also

abs

Note

Function textual ID is “org.opencv.core.matrixop.absdiff”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix.

absDiffC()#

GMat cv::gapi::absDiffC(const GMat &src, const GScalar &c)#

Calculates absolute value of matrix elements.

The function abs calculates absolute difference between matrix elements and given scalar value:

\[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{matC}(I)|)\]
where matC is constructed from given scalar c and has the same sizes and depth as input matrix src.

Output matrix must be of the same size and depth as src.

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

See also

min, max

Note

Function textual ID is “org.opencv.core.matrixop.absdiffC”

Parameters:
  • src – input matrix.

  • c – scalar to be subtracted.

add()#

GMat cv::gapi::add(const GMat &src1, const GMat &src2, int ddepth = -1)#

Calculates the per-element sum of two matrices.

The function add calculates sum of two matrices of the same size and the same number of channels:

\[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\]

The function can be replaced with matrix expressions:

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

The input matrices and the output matrix can all have the same or different depths. For example, you can add a 16-bit unsigned matrix to a 8-bit signed matrix and store the sum as a 32-bit floating-point matrix. Depth of the output matrix is determined by the ddepth parameter. If src1.depth() == src2.depth(), ddepth can be set to the default -1. In this case, the output matrix will have the same depth as the input matrices.

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

See also

sub, addWeighted

Note

Function textual ID is “org.opencv.core.math.add”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix.

  • ddepth – optional depth of the output matrix.

addC()#

GMat cv::gapi::addC(const GMat &src1, const GScalar &c, int ddepth = -1)#

Calculates the per-element sum of matrix and given scalar.

The function addC adds a given scalar value to each element of given matrix. The function can be replaced with matrix expressions:

\f[\texttt{dst} =  \texttt{src1} + \texttt{c}\f]

Depth of the output matrix is determined by the ddepth parameter. If ddepth is set to default -1, the depth of output matrix will be the same as the depth of input matrix. The matrices can be single or multi channel. Output matrix must have the same size and number of channels as the input matrix.

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

See also

sub, addWeighted

Note

Function textual ID is “org.opencv.core.math.addC”

Parameters:
  • src1 – first input matrix.

  • c – scalar value to be added.

  • ddepth – optional depth of the output matrix.

addC()#

GMat cv::gapi::addC(const GScalar &c, const GMat &src1, int ddepth = -1)#

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

addWeighted()#

GMat cv::gapi::addWeighted(const GMat &src1, double alpha, const GMat &src2, double beta, double gamma, int ddepth = -1)#

Calculates the weighted sum of two matrices.

The function addWeighted calculates the weighted sum of two matrices 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 matrices, each channel is processed independently.

The function can be replaced with a matrix expression:

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

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

See also

add, sub

Note

Function textual ID is “org.opencv.core.matrixop.addweighted”

Parameters:
  • src1 – first input matrix.

  • alpha – weight of the first matrix elements.

  • src2 – second input matrix of the same size and channel number as src1.

  • beta – weight of the second matrix elements.

  • gamma – scalar added to each sum.

  • ddepth – optional depth of the output matrix.

BackgroundSubtractor()#

GMat cv::gapi::BackgroundSubtractor(const GMat &src, const cv::gapi::video::BackgroundSubtractorParams &bsParams)#

Gaussian Mixture-based or K-nearest neighbours-based Background/Foreground Segmentation Algorithm. The operation generates a foreground mask.

Note

Functional textual ID is “org.opencv.video.BackgroundSubtractor”

Parameters:
  • src – input image: Floating point frame is used without scaling and should be in range [0,255].

  • bsParams – Set of initialization parameters for Background Subtractor kernel.

Returns:

Output image is foreground mask, i.e. 8-bit unsigned 1-channel (binary) matrix CV_8UC1.

BayerGR2RGB()#

GMat cv::gapi::BayerGR2RGB(const GMat &src_gr)#

Converts an image from BayerGR color space to RGB. The function converts an input image from BayerGR color space to RGB. The conventional ranges for G, R, and B channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

YUV2BGR, NV12toRGB

Note

Function textual ID is “org.opencv.imgproc.colorconvert.bayergr2rgb”

Parameters:

src_gr – input image: 8-bit unsigned 1-channel image CV_8UC1.

BGR2Gray()#

GMat cv::gapi::BGR2Gray(const GMat &src)#

Converts an image from BGR color space to gray-scaled.

The conventional ranges for B, G, and R channel values are 0 to 255. Resulting gray color value computed as

\[\texttt{dst} (I)= \texttt{0.114} * \texttt{src}(I).B + \texttt{0.587} * \texttt{src}(I).G + \texttt{0.299} * \texttt{src}(I).R \]

See also

BGR2LUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.bgr2gray”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC1.

BGR2I420()#

GMat cv::gapi::BGR2I420(const GMat &src)#

Converts an image from BGR color space to I420 color space.

The function converts an input image from BGR color space to I420. The conventional ranges for R, G, and B channel values are 0 to 255.

Output image must be 8-bit unsigned 1-channel image. CV_8UC1. Width of I420 output image must be the same as width of input image. Height of I420 output image must be equal 3/2 from height of input image.

See also

I4202BGR

Note

Function textual ID is “org.opencv.imgproc.colorconvert.bgr2i420”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

BGR2LUV()#

GMat cv::gapi::BGR2LUV(const GMat &src)#

Converts an image from BGR color space to LUV color space.

The function converts an input image from BGR color space to LUV. The conventional ranges for B, G, and R channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

RGB2Lab, RGB2LUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.bgr2luv”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

BGR2RGB()#

GMat cv::gapi::BGR2RGB(const GMat &src)#

Converts an image from BGR color space to RGB color space.

The function converts an input image from BGR color space to RGB. The conventional ranges for B, G, and R channel values are 0 to 255.

Output image is 8-bit unsigned 3-channel image CV_8UC3.

See also

RGB2BGR

Note

Function textual ID is “org.opencv.imgproc.colorconvert.bgr2rgb”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

BGR2YUV()#

GMat cv::gapi::BGR2YUV(const GMat &src)#

Converts an image from BGR color space to YUV color space.

The function converts an input image from BGR color space to YUV. The conventional ranges for B, G, and R channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

YUV2BGR

Note

Function textual ID is “org.opencv.imgproc.colorconvert.bgr2yuv”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

bilateralFilter()#

GMat cv::gapi::bilateralFilter(const GMat &src, int d, double sigmaColor, double sigmaSpace, int borderType = BORDER_DEFAULT)#

Applies the bilateral filter to an image.

The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters.

Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look “cartoonish”.

Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering.

This filter does not work inplace.

Note

Function textual ID is “org.opencv.imgproc.filters.bilateralfilter”

Parameters:
  • src – Source 8-bit or floating-point, 1-channel or 3-channel image.

  • d – Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from sigmaSpace.

  • sigmaColor – Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting in larger areas of semi-equal color.

  • sigmaSpace – Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see sigmaColor ). When d>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is proportional to sigmaSpace.

  • borderType – border mode used to extrapolate pixels outside of the image, see BorderTypes

Returns:

Destination image of the same size and type as src.

bind()#

cv::GRunArg cv::gapi::bind(cv::GRunArgP &out)#

Wraps output GRunArgsP available during graph execution to GRunArgs which can be serialized.

GRunArgsP is pointer-to-value, so to be serialized they need to be binded to real values which this function does.

Example of usage:

    std::vector<cv::GRunArgP> graph_outs;
    cv::GRunArgs out_args;

    for (auto &&out : graph_outs) {
        out_args.emplace_back(cv::gapi::bind(out));
    }
    const auto sargsout = cv::gapi::serialize(out_args);

See also

serialize

Parameters:

out – output GRunArgsP available during graph execution.

Returns:

the same GRunArgsP wrapped in serializable GRunArgs.

bind()#

cv::GRunArgsP cv::gapi::bind(cv::GRunArgs &out_args)#

Wraps deserialized output GRunArgs to GRunArgsP which can be used by GCompiled.

Since it’s impossible to get modifiable output arguments from deserialization it needs to be wrapped by this function.

Example of usage:

    cv::GCompiled compd;
    std::vector<char> bytes;
    auto graph = cv::gapi::deserialize<cv::GComputation>(bytes);
    auto meta = cv::gapi::deserialize<cv::GMetaArgs>(bytes);

    compd = graph.compile(std::move(meta), cv::compile_args());
    auto in_args  = cv::gapi::deserialize<cv::GRunArgs>(bytes);
    auto out_args = cv::gapi::deserialize<cv::GRunArgs>(bytes);
    compd(std::move(in_args), cv::gapi::bind(out_args));

See also

deserialize

Parameters:

out_args – deserialized GRunArgs.

Returns:

the same GRunArgs wrapped in GRunArgsP.

bitwise_and()#

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.

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:
  • src1 – first input matrix.

  • src2 – second input matrix.

bitwise_and()#

GMat cv::gapi::bitwise_and(const GMat &src1, const GScalar &src2)#

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:
  • src1 – first input matrix.

  • src2 – scalar, which will be per-lemenetly conjuncted with elements of src1.

bitwise_not()#

GMat cv::gapi::bitwise_not(const GMat &src)#

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:

src – input matrix.

bitwise_or()#

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.

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:
  • src1 – first input matrix.

  • src2 – second input matrix.

bitwise_or()#

GMat cv::gapi::bitwise_or(const GMat &src1, const GScalar &src2)#

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:
  • src1 – first input matrix.

  • src2 – scalar, which will be per-lemenetly disjuncted with elements of src1.

bitwise_xor()#

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.

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:
  • src1 – first input matrix.

  • src2 – second input matrix.

bitwise_xor()#

GMat cv::gapi::bitwise_xor(const GMat &src1, const GScalar &src2)#

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:
  • src1 – first input matrix.

  • src2 – scalar, for which per-lemenet “logical or” operation on elements of src1 will be performed.

blur()#

GMat cv::gapi::blur(const GMat &src, const Size &ksize, const Point &anchor = Point(-1, -1), int borderType = BORDER_DEFAULT, const Scalar &borderValue = Scalar(0))#

Blurs an image using the normalized box filter.

The function smooths an image using the kernel:

\[\begin{split}\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\end{split}\]

The call blur(src, ksize, anchor, borderType) is equivalent to boxFilter(src, src.type(), ksize, anchor, true, borderType).

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.blur”

Parameters:
  • src – Source image.

  • ksize – blurring kernel size.

  • anchor – anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.

  • borderType – border mode used to extrapolate pixels outside of the image, see cv::BorderTypes

  • borderValue – border value in case of constant border type

boundingRect()#

GOpaque<Rect> cv::gapi::boundingRect(const GArray<Point2f> &src)#

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

Calculates the up-right bounding rectangle of a point set.

Note

Function textual ID is “org.opencv.imgproc.shape.boundingRectVector32F”

Parameters:

src – Input 2D point set, stored in std::vector<cv::Point2f>.

boundingRect()#

GOpaque<Rect> cv::gapi::boundingRect(const GArray<Point2i> &src)#

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

Calculates the up-right bounding rectangle of a point set.

Note

Function textual ID is “org.opencv.imgproc.shape.boundingRectVector32S”

Parameters:

src – Input 2D point set, stored in std::vector<cv::Point2i>.

boundingRect()#

GOpaque<Rect> cv::gapi::boundingRect(const GMat &src)#

Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image.

The function calculates and returns the minimal up-right bounding rectangle for the specified point set or non-zero pixels of gray-scale image.

Note

  • Function textual ID is “org.opencv.imgproc.shape.boundingRectMat”

  • In case of a 2D points’ set given, Mat should be 2-dimensional, have a single row or column if there are 2 channels, or have 2 columns if there is a single channel. Mat should have either CV_32S or CV_32F depth

Parameters:

src – Input gray-scale image CV_8UC1; or input set of CV_32S or CV_32F 2D points stored in Mat.

boxFilter()#

GMat cv::gapi::boxFilter(const GMat &src, int dtype, const Size &ksize, const Point &anchor = Point(-1, -1), bool normalize = true, int borderType = BORDER_DEFAULT, const Scalar &borderValue = Scalar(0))#

Blurs an image using the box filter.

The function smooths an image using the kernel:

\[\begin{split}\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\end{split}\]

where

\[\begin{split}\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise} \end{cases}\end{split}\]

Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use cv::integral.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.boxfilter”

Parameters:
  • src – Source image.

  • dtype – the output image depth (-1 to set the input image data type).

  • ksize – blurring kernel size.

  • anchor – Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor is at the kernel center.

  • normalize – flag, specifying whether the kernel is normalized by its area or not.

  • borderType – Pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of constant border type

buildOpticalFlowPyramid()#

std::tuple<GArray<GMat>, GScalar> cv::gapi::buildOpticalFlowPyramid(const GMat &img, const Size &winSize, const GScalar &maxLevel, bool withDerivatives = true, int pyrBorder = BORDER_REFLECT_101, int derivBorder = BORDER_CONSTANT, bool tryReuseInputImage = true)#

Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.

Note

Function textual ID is “org.opencv.video.buildOpticalFlowPyramid”

Parameters:
  • img – 8-bit input image.

  • winSize – window size of optical flow algorithm. Must be not less than winSize argument of calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.

  • maxLevel – 0-based maximal pyramid level number.

  • withDerivatives – set to precompute gradients for the every pyramid level. If pyramid is constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.

  • pyrBorder – the border mode for pyramid layers.

  • derivBorder – the border mode for gradients.

  • tryReuseInputImage – put ROI of input image into the pyramid if possible. You can pass false to force data copying.

Returns:

  • output pyramid.

  • number of levels in constructed pyramid. Can be less than maxLevel.

calcOpticalFlowPyrLK()#

std::tuple<GArray<Point2f>, GArray<uchar>, GArray<float>> cv::gapi::calcOpticalFlowPyrLK(const GArray<GMat> &prevPyr, const GArray<GMat> &nextPyr, const GArray<Point2f> &prevPts, const GArray<Point2f> &predPts, const Size &winSize = Size(21, 21), const GScalar &maxLevel = 3, const TermCriteria &criteria = TermCriteria(TermCriteria::COUNT | TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThresh = 1e-4)#

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.video.calcOpticalFlowPyrLKForPyr”

calcOpticalFlowPyrLK()#

std::tuple<GArray<Point2f>, GArray<uchar>, GArray<float>> cv::gapi::calcOpticalFlowPyrLK(const GMat &prevImg, const GMat &nextImg, const GArray<Point2f> &prevPts, const GArray<Point2f> &predPts, const Size &winSize = Size(21, 21), const GScalar &maxLevel = 3, const TermCriteria &criteria = TermCriteria(TermCriteria::COUNT | TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThresh = 1e-4)#

Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.

See Bouguet00 .

Note

Function textual ID is “org.opencv.video.calcOpticalFlowPyrLK”

Parameters:
  • prevImg – first 8-bit input image (GMat) or pyramid (GArray<GMat>) constructed by buildOpticalFlowPyramid.

  • nextImg – second input image (GMat) or pyramid (GArray<GMat>) of the same size and the same type as prevImg.

  • prevPtsGArray of 2D points for which the flow needs to be found; point coordinates must be single-precision floating-point numbers.

  • predPtsGArray of 2D points initial for the flow search; make sense only when OPTFLOW_USE_INITIAL_FLOW flag is passed; in that case the vector must have the same size as in the input.

  • winSize – size of the search window at each pyramid level.

  • maxLevel – 0-based maximal pyramid level number; if set to 0, pyramids are not used (single level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel.

  • criteria – parameter, specifying the termination criteria of the iterative search algorithm (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon).

  • flags – operation flags:

    • OPTFLOW_USE_INITIAL_FLOW uses initial estimations, stored in nextPts; if the flag is not set, then prevPts is copied to nextPts and is considered the initial estimate.

    • OPTFLOW_LK_GET_MIN_EIGENVALS use minimum eigen values as an error measure (see minEigThreshold description); if the flag is not set, then L1 distance between patches around the original and a moved point, divided by number of pixels in a window, is used as a error measure.

  • minEigThresh – the algorithm calculates the minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in Bouguet00), divided by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding feature is filtered out and its flow is not processed, so it allows to remove bad points and get a performance boost.

Returns:

  • GArray of 2D points (with single-precision floating-point coordinates) containing the calculated new positions of input features in the second image.

  • status GArray (of unsigned chars); each element of the vector is set to 1 if the flow for the corresponding features has been found, otherwise, it is set to 0.

  • GArray of errors (doubles); each element of the vector is set to an error for the corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn’t found then the error is not defined (use the status parameter to find such cases).

Canny()#

GMat cv::gapi::Canny(const GMat &image, double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false)#

Finds edges in an image using the Canny algorithm.

The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http://en.wikipedia.org/wiki/Canny_edge_detector

Note

Function textual ID is “org.opencv.imgproc.feature.canny”

Parameters:
  • image – 8-bit input image.

  • threshold1 – first threshold for the hysteresis procedure.

  • threshold2 – second threshold for the hysteresis procedure.

  • apertureSize – aperture size for the Sobel operator.

  • L2gradient – a flag, indicating whether a more accurate \(L_2\) norm \(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough ( L2gradient=false ).

cartToPolar()#

std::tuple<GMat, GMat> cv::gapi::cartToPolar(const GMat &x, const GMat &y, bool angleInDegrees = false)#

Calculates the magnitude and angle of 2D vectors.

The function cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)):

\[\begin{split}\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\end{split}\]

The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

First output is a matrix of magnitudes of the same size and depth as input x. Second output is a matrix of angles that has the same size and depth as x; the angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).

See also

polarToCart

Note

Function textual ID is “org.opencv.core.math.cartToPolar”

Parameters:
  • x – matrix of CV_32FC1 x-coordinates.

  • y – array of CV_32FC1 y-coordinates.

  • angleInDegrees – a flag, indicating whether the angles are measured in radians (which is by default), or in degrees.

cmpEQ()#

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.

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.

See also

min, max, threshold, cmpNE

Note

Function textual ID is “org.opencv.core.pixelwise.compare.cmpEQ”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix/scalar of the same depth as first input matrix.

cmpEQ()#

GMat cv::gapi::cmpEQ(const GMat &src1, const GScalar &src2)#

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()#

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.

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.

See also

min, max, threshold, cmpLE, cmpGT, cmpLT

Note

Function textual ID is “org.opencv.core.pixelwise.compare.cmpGE”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix/scalar of the same depth as first input matrix.

cmpGE()#

GMat cv::gapi::cmpGE(const GMat &src1, const GScalar &src2)#

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()#

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.

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.

See also

min, max, threshold, cmpLE, cmpGE, cmpLT

Note

Function textual ID is “org.opencv.core.pixelwise.compare.cmpGT”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix/scalar of the same depth as first input matrix.

cmpGT()#

GMat cv::gapi::cmpGT(const GMat &src1, const GScalar &src2)#

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()#

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.

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.

See also

min, max, threshold, cmpGT, cmpGE, cmpLT

Note

Function textual ID is “org.opencv.core.pixelwise.compare.cmpLE”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix/scalar of the same depth as first input matrix.

cmpLE()#

GMat cv::gapi::cmpLE(const GMat &src1, const GScalar &src2)#

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()#

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.

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.

See also

min, max, threshold, cmpLE, cmpGE, cmpGT

Note

Function textual ID is “org.opencv.core.pixelwise.compare.cmpLT”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix/scalar of the same depth as first input matrix.

cmpLT()#

GMat cv::gapi::cmpLT(const GMat &src1, const GScalar &src2)#

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()#

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.

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.

See also

min, max, threshold, cmpEQ

Note

Function textual ID is “org.opencv.core.pixelwise.compare.cmpNE”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix/scalar of the same depth as first input matrix.

cmpNE()#

GMat cv::gapi::cmpNE(const GMat &src1, const GScalar &src2)#

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”

concatHor()#

GMat cv::gapi::concatHor(const GMat &src1, const GMat &src2)#

Applies horizontal concatenation to given matrices.

The function horizontally concatenates two GMat matrices (with the same number of rows).

GMat A = { 1, 4,
           2, 5,
           3, 6 };
GMat B = { 7, 10,
           8, 11,
           9, 12 };

GMat C = gapi::concatHor(A, B);
//C:
//[1, 4, 7, 10;
// 2, 5, 8, 11;
// 3, 6, 9, 12]
Output matrix must the same number of rows and depth as the src1 and src2, and the sum of cols of the src1 and src2. Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

See also

concatVert

Note

Function textual ID is “org.opencv.imgproc.transform.concatHor”

Parameters:
  • src1 – first input matrix to be considered for horizontal concatenation.

  • src2 – second input matrix to be considered for horizontal concatenation.

concatHor()#

GMat cv::gapi::concatHor(const std::vector<GMat> &v)#

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The function horizontally concatenates given number of GMat matrices (with the same number of columns). Output matrix must the same number of columns and depth as the input matrices, and the sum of rows of input matrices.

Parameters:

v – vector of input matrices to be concatenated horizontally.

concatVert()#

GMat cv::gapi::concatVert(const GMat &src1, const GMat &src2)#

Applies vertical concatenation to given matrices.

The function vertically concatenates two GMat matrices (with the same number of cols).

GMat A = { 1, 7,
           2, 8,
           3, 9 };
GMat B = { 4, 10,
           5, 11,
           6, 12 };

GMat C = gapi::concatVert(A, B);
//C:
//[1, 7;
// 2, 8;
// 3, 9;
// 4, 10;
// 5, 11;
// 6, 12]

Output matrix must the same number of cols and depth as the src1 and src2, and the sum of rows of the src1 and src2. Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1.

See also

concatHor

Note

Function textual ID is “org.opencv.imgproc.transform.concatVert”

Parameters:
  • src1 – first input matrix to be considered for vertical concatenation.

  • src2 – second input matrix to be considered for vertical concatenation.

concatVert()#

GMat cv::gapi::concatVert(const std::vector<GMat> &v)#

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The function vertically concatenates given number of GMat matrices (with the same number of columns). Output matrix must the same number of columns and depth as the input matrices, and the sum of rows of input matrices.

Parameters:

v – vector of input matrices to be concatenated vertically.

convertTo()#

GMat cv::gapi::convertTo(const GMat &src, int rdepth, double alpha = 1, double beta = 0)#

Converts a matrix to another data depth with optional scaling.

The method converts source pixel values to the target data depth. saturate_cast<> is applied at the end to avoid possible overflows:

\[m(x,y) = saturate \_ cast<rType>( \alpha (*this)(x,y) + \beta )\]
Output matrix must be of the same size as input one.

Note

Function textual ID is “org.opencv.core.transform.convertTo”

Parameters:
  • src – input matrix to be converted from.

  • rdepth – desired output matrix depth or, rather, the depth since the number of channels are the same as the input has; if rdepth is negative, the output matrix will have the same depth as the input.

  • alpha – optional scale factor.

  • beta – optional delta added to the scaled values.

copy()#

GFrame cv::gapi::copy(const GFrame &in)#

Makes a copy of the input frame. Note that this copy may be not real (no actual data copied). Use this function to maintain graph contracts, e.g when graph’s input needs to be passed directly to output, like in Streaming mode.

Note

Function textual ID is “org.opencv.streaming.copy”

Parameters:

in – Input frame

Returns:

Copy of the input

copy()#

GMat cv::gapi::copy(const GMat &in)#

Makes a copy of the input image. Note that this copy may be not real (no actual data copied). Use this function to maintain graph contracts, e.g when graph’s input needs to be passed directly to output, like in Streaming mode.

Note

Function textual ID is “org.opencv.streaming.copy”

Parameters:

in – Input image

Returns:

Copy of the input

countNonZero()#

GOpaque<int> cv::gapi::countNonZero(const GMat &src)#

Counts non-zero array elements.

The function returns the number of non-zero elements in src :

\[\sum _{I: \; \texttt{src} (I) \ne0 } 1\]

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

See also

mean, min, max

Note

Function textual ID is “org.opencv.core.matrixop.countNonZero”

Parameters:

src – input single-channel matrix.

crop()#

GMat cv::gapi::crop(const GMat &src, const Rect &rect)#

Crops a 2D matrix.

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

resize

Note

Function textual ID is “org.opencv.core.transform.crop”

Parameters:
  • src – input matrix.

  • rect – a rect to crop a matrix to

deserialize()#

Warning

doxygenfunction: Unable to resolve function “cv::gapi::deserialize” with arguments (const std::vector<char>&) in doxygen xml output for project “opencv” from directory: /media/abhishek/hugedrive21/opencv_abhishek/build/doc/doxygen/xml_for_sphinx. Potential matches:

- template<> cv::GComputation deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<typename T, typename ...Types> std::enable_if<std::is_same<T, GCompileArgs>::value, GCompileArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T, typename AtLeastOneAdapterT, typename ...AdapterTypes> std::enable_if<std::is_same<T, GRunArgs>::value, GRunArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T> T deserialize(const std::vector<char> &bytes)

deserialize()#

Warning

doxygenfunction: Unable to resolve function “cv::gapi::deserialize” with arguments (const std::vector<char>&) in doxygen xml output for project “opencv” from directory: /media/abhishek/hugedrive21/opencv_abhishek/build/doc/doxygen/xml_for_sphinx. Potential matches:

- template<> cv::GComputation deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<typename T, typename ...Types> std::enable_if<std::is_same<T, GCompileArgs>::value, GCompileArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T, typename AtLeastOneAdapterT, typename ...AdapterTypes> std::enable_if<std::is_same<T, GRunArgs>::value, GRunArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T> T deserialize(const std::vector<char> &bytes)

deserialize()#

Warning

doxygenfunction: Unable to resolve function “cv::gapi::deserialize” with arguments (const std::vector<char>&) in doxygen xml output for project “opencv” from directory: /media/abhishek/hugedrive21/opencv_abhishek/build/doc/doxygen/xml_for_sphinx. Potential matches:

- template<> cv::GComputation deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<typename T, typename ...Types> std::enable_if<std::is_same<T, GCompileArgs>::value, GCompileArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T, typename AtLeastOneAdapterT, typename ...AdapterTypes> std::enable_if<std::is_same<T, GRunArgs>::value, GRunArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T> T deserialize(const std::vector<char> &bytes)

deserialize()#

Warning

doxygenfunction: Unable to resolve function “cv::gapi::deserialize” with arguments (const std::vector<char>&) in doxygen xml output for project “opencv” from directory: /media/abhishek/hugedrive21/opencv_abhishek/build/doc/doxygen/xml_for_sphinx. Potential matches:

- template<> cv::GComputation deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GMetaArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> cv::GRunArgs deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<> std::vector<std::string> deserialize(const std::vector<char> &bytes)
- template<typename T, typename ...Types> std::enable_if<std::is_same<T, GCompileArgs>::value, GCompileArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T, typename AtLeastOneAdapterT, typename ...AdapterTypes> std::enable_if<std::is_same<T, GRunArgs>::value, GRunArgs>::type deserialize(const std::vector<char> &bytes)
- template<typename T> T deserialize(const std::vector<char> &bytes)

dilate()#

GMat cv::gapi::dilate(const GMat &src, const Mat &kernel, const Point &anchor = Point(-1, -1), int iterations = 1, int borderType = BORDER_CONSTANT, const Scalar &borderValue = morphologyDefaultBorderValue())#

Dilates an image by using a specific structuring element.

The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken:

\[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\]

Dilation can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.dilate”

Parameters:
  • src – input image.

  • kernel – structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular structuring element is used. Kernel can be created using getStructuringElement

  • anchor – position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.

  • iterations – number of times dilation is applied.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of a constant border

dilate3x3()#

GMat cv::gapi::dilate3x3(const GMat &src, int iterations = 1, int borderType = BORDER_CONSTANT, const Scalar &borderValue = morphologyDefaultBorderValue())#

Dilates an image by using 3 by 3 rectangular structuring element.

The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken:

\[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\]

Dilation can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

See also

dilate, erode3x3

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.dilate”

Parameters:
  • src – input image.

  • iterations – number of times dilation is applied.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of a constant border

div()#

GMat cv::gapi::div(const GMat &src1, const GMat &src2, double scale, int ddepth = -1)#

Performs per-element division of two matrices.

The function divides one matrix by another:

\[\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\]

For integer types when src2(I) is zero, dst(I) will also be zero. Floating point case returns Inf/NaN (according to IEEE).

Different channels of multi-channel matrices are processed independently. The matrices can be single or multi channel. Output matrix must have the same size and depth as src.

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

See also

mul, add, sub

Note

Function textual ID is “org.opencv.core.math.div”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix of the same size and depth as src1.

  • scale – scalar factor.

  • ddepth – optional depth of the output matrix; you can only pass -1 when src1.depth() == src2.depth().

divC()#

GMat cv::gapi::divC(const GMat &src, const GScalar &divisor, double scale, int ddepth = -1)#

Divides matrix by scalar.

The function divC divides each element of matrix src by given scalar value:

\[\texttt{dst(I) = saturate(src(I)*scale/divisor)}\]

When divisor is zero, dst(I) will also be zero. Different channels of multi-channel matrices are processed independently. The matrices can be single or multi channel. Output matrix must have the same size and depth as src.

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

See also

add, sub, div, addWeighted

Note

Function textual ID is “org.opencv.core.math.divC”

Parameters:
  • src – input matrix.

  • divisor – number to be divided by.

  • ddepth – optional depth of the output matrix. If -1, the depth of output matrix will be the same as input matrix depth.

  • scale – scale factor.

divRC()#

GMat cv::gapi::divRC(const GScalar &divident, const GMat &src, double scale, int ddepth = -1)#

Divides scalar by matrix.

The function divRC divides given scalar by each element of matrix src and keep the division result in new matrix of the same size and type as src:

\[\texttt{dst(I) = saturate(divident*scale/src(I))}\]

When src(I) is zero, dst(I) will also be zero. Different channels of multi-channel matrices are processed independently. The matrices can be single or multi channel. Output matrix must have the same size and depth as src.

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

See also

add, sub, div, addWeighted

Note

Function textual ID is “org.opencv.core.math.divRC”

Parameters:
  • src – input matrix.

  • divident – number to be divided.

  • ddepth – optional depth of the output matrix. If -1, the depth of output matrix will be the same as input matrix depth.

  • scale – scale factor

erode()#

GMat cv::gapi::erode(const GMat &src, const Mat &kernel, const Point &anchor = Point(-1, -1), int iterations = 1, int borderType = BORDER_CONSTANT, const Scalar &borderValue = morphologyDefaultBorderValue())#

Erodes an image by using a specific structuring element.

The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:

\[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\]

Erosion can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

See also

dilate, morphologyEx

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.erode”

Parameters:
  • src – input image

  • kernel – structuring element used for erosion; if element=Mat(), a 3 x 3 rectangular structuring element is used. Kernel can be created using getStructuringElement.

  • anchor – position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.

  • iterations – number of times erosion is applied.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of a constant border

erode3x3()#

GMat cv::gapi::erode3x3(const GMat &src, int iterations = 1, int borderType = BORDER_CONSTANT, const Scalar &borderValue = morphologyDefaultBorderValue())#

Erodes an image by using 3 by 3 rectangular structuring element.

The function erodes the source image using the rectangular structuring element with rectangle center as an anchor. Erosion can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

See also

erode, dilate3x3

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.erode”

Parameters:
  • src – input image

  • iterations – number of times erosion is applied.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of a constant border

filter2D()#

GMat cv::gapi::filter2D(const GMat &src, int ddepth, const Mat &kernel, const Point &anchor = Point(-1, -1), const Scalar &delta = Scalar(0), int borderType = BORDER_DEFAULT, const Scalar &borderValue = Scalar(0))#

Convolves an image with the kernel.

The function applies an arbitrary linear filter to an image. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode.

The function does actually compute correlation, not the convolution:

\[\begin{split}\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' < \texttt{kernel.cols}\\{0\leq y' < \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\end{split}\]

That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using flip and set the new anchor to (kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1).

Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same size and number of channels an input image.

See also

sepFilter

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.filter2D”

Parameters:
  • src – input image.

  • ddepth – desired depth of the destination image

  • kernel – convolution kernel (or rather a correlation kernel), a single-channel floating point matrix; if you want to apply different kernels to different channels, split the image into separate color planes using split and process them individually.

  • anchor – anchor of the kernel that indicates the relative position of a filtered point within the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor is at the kernel center.

  • delta – optional value added to the filtered pixels before storing them in dst.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of constant border type

findContours()#

GArray<GArray<Point>> cv::gapi::findContours(const GMat &src, const RetrievalModes mode, const ContourApproximationModes method)#

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.imgproc.shape.findContoursNoOffset”

findContours()#

GArray<GArray<Point>> cv::gapi::findContours(const GMat &src, const RetrievalModes mode, const ContourApproximationModes method, const GOpaque<Point> &offset)#

Finds contours in a binary image.

The function retrieves contours from the binary image using the algorithm Suzuki85 . The contours are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the OpenCV sample directory.

Note

Function textual ID is “org.opencv.imgproc.shape.findContours”

Parameters:
  • src – Input gray-scale image CV_8UC1. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary . You can use compare, inRange, threshold , adaptiveThreshold, Canny, and others to create a binary image out of a grayscale or color one. If mode equals to RETR_CCOMP, the input can also be a 32-bit integer image of labels ( CV_32SC1 ). If RETR_FLOODFILL then CV_32SC1 is supported only.

  • mode – Contour retrieval mode, see RetrievalModes

  • method – Contour approximation method, see ContourApproximationModes

  • offset – Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

Returns:

GArray of detected contours. Each contour is stored as a GArray of points.

findContoursH()#

std::tuple<GArray<GArray<Point>>, GArray<Vec4i>> cv::gapi::findContoursH(const GMat &src, const RetrievalModes mode, const ContourApproximationModes method)#

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.imgproc.shape.findContoursHNoOffset”

findContoursH()#

std::tuple<GArray<GArray<Point>>, GArray<Vec4i>> cv::gapi::findContoursH(const GMat &src, const RetrievalModes mode, const ContourApproximationModes method, const GOpaque<Point> &offset)#

Finds contours and their hierarchy in a binary image.

The function retrieves contours from the binary image using the algorithm Suzuki85 and calculates their hierarchy. The contours are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the OpenCV sample directory.

Note

Function textual ID is “org.opencv.imgproc.shape.findContoursH”

Parameters:
  • src – Input gray-scale image CV_8UC1. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary . You can use compare, inRange, threshold , adaptiveThreshold, Canny, and others to create a binary image out of a grayscale or color one. If mode equals to RETR_CCOMP, the input can also be a 32-bit integer image of labels ( CV_32SC1 ). If RETR_FLOODFILL &#8212; CV_32SC1 supports only.

  • mode – Contour retrieval mode, see RetrievalModes

  • method – Contour approximation method, see ContourApproximationModes

  • offset – Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

Returns:

  • GArray of detected contours. Each contour is stored as a GArray of points.

  • Optional output GArray of cv::Vec4i, containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i], the elements hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

fitLine2D()#

GOpaque<Vec4f> cv::gapi::fitLine2D(const GArray<Point2d> &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

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.imgproc.shape.fitLine2DVector64F”

fitLine2D()#

GOpaque<Vec4f> cv::gapi::fitLine2D(const GArray<Point2f> &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

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.imgproc.shape.fitLine2DVector32F”

fitLine2D()#

GOpaque<Vec4f> cv::gapi::fitLine2D(const GArray<Point2i> &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

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.imgproc.shape.fitLine2DVector32S”

fitLine2D()#

GOpaque<Vec4f> cv::gapi::fitLine2D(const GMat &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

Fits a line to a 2D point set.

The function fits a line to a 2D point set by minimizing \(\sum_i \rho(r_i)\) where \(r_i\) is a distance between the \(i^{th}\) point, the line and \(\rho(r)\) is a distance function, one of the following:

  • DIST_L2

    \[\rho (r) = r^2/2 \quad \text{(the simplest and the fastest least-squares method)}\]

  • DIST_L1

    \[\rho (r) = r\]

  • DIST_L12

    \[\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\]

  • DIST_FAIR

    \[\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} \quad C=1.3998\]

  • DIST_WELSCH

    \[\rho \left (r \right ) = \frac{C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\]

  • DIST_HUBER

    \[\rho (r) = \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\]

The algorithm is based on the M-estimator ( http://en.wikipedia.org/wiki/M-estimator ) technique that iteratively fits the line using the weighted least-squares algorithm. After each iteration the weights \(w_i\) are adjusted to be inversely proportional to \(\rho(r_i)\) .

Note

  • Function textual ID is “org.opencv.imgproc.shape.fitLine2DMat”

  • In case of an N-dimensional points’ set given, Mat should be 2-dimensional, have a single row or column if there are N channels, or have N columns if there is a single channel.

Parameters:
  • src – Input set of 2D points stored in one of possible containers: Mat, std::vector<cv::Point2i>, std::vector<cv::Point2f>, std::vector<cv::Point2d>.

  • distType – Distance used by the M-estimator, see DistanceTypes. DIST_USER and DIST_C are not supported.

  • param – Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

  • reps – Sufficient accuracy for the radius (distance between the coordinate origin and the line). 1.0 would be a good default value for reps. If it is 0, a default value is chosen.

  • aeps – Sufficient accuracy for the angle. 0.01 would be a good default value for aeps. If it is 0, a default value is chosen.

Returns:

Output line parameters: a vector of 4 elements (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is a point on the line.

fitLine3D()#

GOpaque<Vec6f> cv::gapi::fitLine3D(const GArray<Point3d> &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

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.imgproc.shape.fitLine3DVector64F”

fitLine3D()#

GOpaque<Vec6f> cv::gapi::fitLine3D(const GArray<Point3f> &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

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.imgproc.shape.fitLine3DVector32F”

fitLine3D()#

GOpaque<Vec6f> cv::gapi::fitLine3D(const GArray<Point3i> &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

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.imgproc.shape.fitLine3DVector32S”

fitLine3D()#

GOpaque<Vec6f> cv::gapi::fitLine3D(const GMat &src, const DistanceTypes distType, const double param = 0., const double reps = 0., const double aeps = 0.)#

Fits a line to a 3D point set.

The function fits a line to a 3D point set by minimizing \(\sum_i \rho(r_i)\) where \(r_i\) is a distance between the \(i^{th}\) point, the line and \(\rho(r)\) is a distance function, one of the following:

  • DIST_L2

    \[\rho (r) = r^2/2 \quad \text{(the simplest and the fastest least-squares method)}\]

  • DIST_L1

    \[\rho (r) = r\]

  • DIST_L12

    \[\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\]

  • DIST_FAIR

    \[\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} \quad C=1.3998\]

  • DIST_WELSCH

    \[\rho \left (r \right ) = \frac{C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\]

  • DIST_HUBER

    \[\rho (r) = \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\]

The algorithm is based on the M-estimator ( http://en.wikipedia.org/wiki/M-estimator ) technique that iteratively fits the line using the weighted least-squares algorithm. After each iteration the weights \(w_i\) are adjusted to be inversely proportional to \(\rho(r_i)\) .

Note

  • Function textual ID is “org.opencv.imgproc.shape.fitLine3DMat”

  • In case of an N-dimensional points’ set given, Mat should be 2-dimensional, have a single row or column if there are N channels, or have N columns if there is a single channel.

Parameters:
  • src – Input set of 3D points stored in one of possible containers: Mat, std::vector<cv::Point3i>, std::vector<cv::Point3f>, std::vector<cv::Point3d>.

  • distType – Distance used by the M-estimator, see DistanceTypes. DIST_USER and DIST_C are not supported.

  • param – Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

  • reps – Sufficient accuracy for the radius (distance between the coordinate origin and the line). 1.0 would be a good default value for reps. If it is 0, a default value is chosen.

  • aeps – Sufficient accuracy for the angle. 0.01 would be a good default value for aeps. If it is 0, a default value is chosen.

Returns:

Output line parameters: a vector of 6 elements (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is a point on the line.

flip()#

GMat cv::gapi::flip(const GMat &src, int flipCode)#

Flips a 2D matrix around vertical, horizontal, or both axes.

The function flips the matrix in one of three different ways (row and column indices are 0-based):

\[\begin{split}\texttt{dst} _{ij} = \left\{ \begin{array}{l l} \texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\ \texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\ \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\ \end{array} \right.\end{split}\]
The example scenarios of using the function are the following: Vertical flipping of the image (flipCode == 0) to switch between top-left and bottom-left image origin. This is a typical operation in video processing on Microsoft Windows* OS. Horizontal flipping of the image with the subsequent horizontal shift and absolute difference calculation to check for a vertical-axis symmetry (flipCode > 0). Simultaneous horizontal and vertical flipping of the image with the subsequent shift and absolute difference calculation to check for a central symmetry (flipCode < 0). Reversing the order of point arrays (flipCode > 0 or flipCode == 0). Output image must be of the same depth as input one, size should be correct for given flipCode.

See also

remap

Note

Function textual ID is “org.opencv.core.transform.flip”

Parameters:
  • src – input matrix.

  • flipCode – a flag to specify how to flip the array; 0 means flipping around the x-axis and positive value (for example, 1) means flipping around y-axis. Negative value (for example, -1) means flipping around both axes.

gaussianBlur()#

GMat cv::gapi::gaussianBlur(const GMat &src, const Size &ksize, double sigmaX, double sigmaY = 0, int borderType = BORDER_DEFAULT, const Scalar &borderValue = Scalar(0))#

Blurs an image using a Gaussian filter.

The function filter2Ds the source image with the specified Gaussian kernel. Output image must have the same type and number of channels an input image.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.gaussianBlur”

Parameters:
  • src – input image;

  • ksize – Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero’s and then they are computed from sigma.

  • sigmaX – Gaussian kernel standard deviation in X direction.

  • sigmaY – Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, respectively (see cv::getGaussianKernel for details); to fully control the result regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of constant border type

goodFeaturesToTrack()#

GArray<Point2f> cv::gapi::goodFeaturesToTrack(const GMat &image, int maxCorners, double qualityLevel, double minDistance, const Mat &mask = Mat(), int blockSize = 3, bool useHarrisDetector = false, double k = 0.04)#

Determines strong corners on an image.

The function finds the most prominent corners in the image or in the specified image region, as described in Shi94

  • Function calculates the corner quality measure at every source image pixel using the cornerMinEigenVal or cornerHarris .

  • Function performs a non-maximum suppression (the local maximums in 3 x 3 neighborhood are retained).

  • The corners with the minimal eigenvalue less than \(\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\) are rejected.

  • The remaining corners are sorted by the quality measure in the descending order.

  • Function throws away each corner for which there is a stronger corner at a distance less than maxDistance.

The function can be used to initialize a point-based tracker of an object.

Note

  • If the function is called with different values A and B of the parameter qualityLevel , and A > B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector with qualityLevel=B .

  • Function textual ID is “org.opencv.imgproc.feature.goodFeaturesToTrack”

Parameters:
  • image – Input 8-bit or floating-point 32-bit, single-channel image.

  • maxCorners – Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned. maxCorners <= 0 implies that no limit on the maximum is set and all detected corners are returned.

  • qualityLevel – Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected.

  • minDistance – Minimum possible Euclidean distance between the returned corners.

  • mask – Optional region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.

  • blockSize – Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See cornerEigenValsAndVecs .

  • useHarrisDetector – Parameter indicating whether to use a Harris detector (see cornerHarris) or cornerMinEigenVal.

  • k – Free parameter of the Harris detector.

Returns:

vector of detected corners.

I4202BGR()#

GMat cv::gapi::I4202BGR(const GMat &src)#

Converts an image from I420 color space to BGR color space.

The function converts an input image from I420 color space to BGR. The conventional ranges for B, G, and R channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image. CV_8UC3. Width of BGR output image must be the same as width of input image. Height of BGR output image must be equal 2/3 from height of input image.

See also

BGR2I420

Note

Function textual ID is “org.opencv.imgproc.colorconvert.i4202bgr”

Parameters:

src – input image: 8-bit unsigned 1-channel image CV_8UC1.

I4202RGB()#

GMat cv::gapi::I4202RGB(const GMat &src)#

Converts an image from I420 color space to BGR color space.

The function converts an input image from I420 color space to BGR. The conventional ranges for B, G, and R channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image. CV_8UC3. Width of RGB output image must be the same as width of input image. Height of RGB output image must be equal 2/3 from height of input image.

See also

RGB2I420

Note

Function textual ID is “org.opencv.imgproc.colorconvert.i4202rgb”

Parameters:

src – input image: 8-bit unsigned 1-channel image CV_8UC1.

inRange()#

GMat cv::gapi::inRange(const GMat &src, const GScalar &threshLow, const GScalar &threshUp)#

Applies a range-level threshold to each matrix element.

The function applies range-level thresholding to a single- or multiple-channel matrix. It sets output pixel value to OxFF if the corresponding pixel value of input matrix is in specified range,or 0 otherwise.

Input and output matrices must be CV_8UC1.

See also

threshold

Note

Function textual ID is “org.opencv.core.matrixop.inRange”

Parameters:
  • src – input matrix (CV_8UC1).

  • threshLow – lower boundary value.

  • threshUp – upper boundary value.

integral()#

std::tuple<GMat, GMat> cv::gapi::integral(const GMat &src, int sdepth = -1, int sqdepth = -1)#

Calculates the integral of an image.

The function calculates one or more integral images for the source image as follows:

\[\texttt{sum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)\]

\[\texttt{sqsum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)^2\]

The function return integral image as \((W+1)\times (H+1)\) , 32-bit integer or floating-point (32f or 64f) and integral image for squared pixel values; it is \((W+1)\times (H+)\), double-precision floating-point (64f) array.

Note

Function textual ID is “org.opencv.core.matrixop.integral”

Parameters:
  • src – input image.

  • sdepth – desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or CV_64F.

  • sqdepth – desired depth of the integral image of squared pixel values, CV_32F or CV_64F.

KalmanFilter()#

GMat cv::gapi::KalmanFilter(const GMat &measurement, const GOpaque<bool> &haveMeasurement, const cv::gapi::KalmanParams &kfParams)#

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The case of Standard Kalman filter algorithm when there is no control in a dynamic system. In this case the controlMatrix is empty and control vector is absent.

See also

cv::KalmanFilter

Note

Function textual ID is “org.opencv.video.KalmanFilterNoControl”

Parameters:
  • measurement – input matrix: 32-bit or 64-bit float 1-channel matrix containing measurements.

  • haveMeasurement – dynamic input flag that indicates whether we get measurements at a particular iteration.

  • kfParams – Set of initialization parameters for Kalman filter kernel.

Returns:

Output matrix is predicted or corrected state. They can be 32-bit or 64-bit float 1-channel matrix CV_32FC1 or CV_64FC1.

KalmanFilter()#

GMat cv::gapi::KalmanFilter(const GMat &measurement, const GOpaque<bool> &haveMeasurement, const GMat &control, const cv::gapi::KalmanParams &kfParams)#

Standard Kalman filter algorithm http://en.wikipedia.org/wiki/Kalman_filter.

If measurement matrix is given (haveMeasurements == true), corrected state will be returned which corresponds to the pipeline cv::KalmanFilter::predict(control) -> cv::KalmanFilter::correct(measurement). Otherwise, predicted state will be returned which corresponds to the call of cv::KalmanFilter::predict(control).

See also

cv::KalmanFilter

Note

Functional textual ID is “org.opencv.video.KalmanFilter”

Parameters:
  • measurement – input matrix: 32-bit or 64-bit float 1-channel matrix containing measurements.

  • haveMeasurement – dynamic input flag that indicates whether we get measurements at a particular iteration .

  • control – input matrix: 32-bit or 64-bit float 1-channel matrix contains control data for changing dynamic system.

  • kfParams – Set of initialization parameters for Kalman filter kernel.

Returns:

Output matrix is predicted or corrected state. They can be 32-bit or 64-bit float 1-channel matrix CV_32FC1 or CV_64FC1.

kernels()#

template<typename ...KK>
GKernelPackage cv::gapi::kernels()#

Create a kernel package object containing kernels and transformations specified in variadic template argument.

In G-API, kernel implementations and transformations are types. Every backend has its own kernel API (like GAPI_OCV_KERNEL() and GAPI_FLUID_KERNEL()) but all of that APIs define a new type for each kernel implementation.

Use this function to pass kernel implementations (defined in either way) and transformations to the system. Example:

    cv::GKernelPackage pkg = cv::gapi::kernels
        < CustomAdd
        , CustomFilter2D
        , CustomRGB2YUV
        >();

Note that kernels() itself is a function returning object, not a type, so having () at the end is important &#8212; it must be a function call.

kernels()#

template<typename ...FF>
GKernelPackage cv::gapi::kernels(FF&... functors)#

Laplacian()#

GMat cv::gapi::Laplacian(const GMat &src, int ddepth, int ksize = 1, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)#

Calculates the Laplacian of an image.

The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator:

\[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\]

This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image with the following \(3 \times 3\) aperture:

\[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\]

See also

Sobel, Scharr

Note

Function textual ID is “org.opencv.imgproc.filters.laplacian”

Parameters:
  • src – Source image.

  • ddepth – Desired depth of the destination image.

  • ksize – Aperture size used to compute the second-derivative filters. See getDerivKernels for details. The size must be positive and odd.

  • scale – Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See getDerivKernels for details.

  • delta – Optional delta value that is added to the results prior to storing them in dst .

  • borderType – Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.

Returns:

Destination image of the same size and the same number of channels as src.

LUT()#

GMat cv::gapi::LUT(const GMat &src, const Mat &lut)#

Performs a look-up table transform of a matrix.

The function LUT fills the output matrix with values from the look-up table. Indices of the entries are taken from the input matrix. That is, the function processes each element of src as follows:

\[\texttt{dst} (I) \leftarrow \texttt{lut(src(I))}\]

Supported matrix data types are CV_8UC1. Output is a matrix of the same size and number of channels as src, and the same depth as lut.

Note

Function textual ID is “org.opencv.core.transform.LUT”

Parameters:
  • src – input matrix of 8-bit elements.

  • lut – look-up table of 256 elements; in case of multi-channel input array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the input matrix.

LUV2BGR()#

GMat cv::gapi::LUV2BGR(const GMat &src)#

Converts an image from LUV color space to BGR color space.

The function converts an input image from LUV color space to BGR. The conventional ranges for B, G, and R channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

BGR2LUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.luv2bgr”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

mask()#

GMat cv::gapi::mask(const GMat &src, const GMat &mask)#

Applies a mask to a matrix.

The function mask set value from given matrix if the corresponding pixel value in mask matrix set to true, and set the matrix value to 0 otherwise.

Supported src matrix data types are CV_8UC1, CV_16SC1, CV_16UC1. Supported mask data type is CV_8UC1.

Note

Function textual ID is “org.opencv.core.math.mask”

Parameters:
  • src – input matrix.

  • mask – input mask matrix.

max()#

GMat cv::gapi::max(const GMat &src1, const GMat &src2)#

Calculates per-element maximum of two matrices.

The function max calculates the per-element maximum of two matrices of the same size, number of channels and depth:

\[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\]
where I is a multi-dimensional index of matrix elements. In case of multi-channel matrices, each channel is processed independently. Output matrix must be of the same size and depth as src1.

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

See also

min, compare, cmpEQ, cmpGT, cmpGE

Note

Function textual ID is “org.opencv.core.matrixop.max”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix of the same size and depth as src1.

mean()#

GScalar cv::gapi::mean(const GMat &src)#

Calculates an average (mean) of matrix elements.

The function mean calculates the mean value M of matrix elements, independently for each channel, and return it.

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

See also

countNonZero, min, max

Note

Function textual ID is “org.opencv.core.math.mean”

Parameters:

src – input matrix.

medianBlur()#

GMat cv::gapi::medianBlur(const GMat &src, int ksize)#

Blurs an image using the median filter.

The function smoothes an image using the median filter with the \(\texttt{ksize} \times \texttt{ksize}\) aperture. Each channel of a multi-channel image is processed independently. Output image must have the same type, size, and number of channels as the input image.

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest. The median filter uses cv::BORDER_REPLICATE internally to cope with border pixels, see cv::BorderTypes

  • Function textual ID is “org.opencv.imgproc.filters.medianBlur”

Parameters:
  • src – input matrix (image)

  • ksize – aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 …

merge3()#

GMat cv::gapi::merge3(const GMat &src1, const GMat &src2, const GMat &src3)#

Creates one 3-channel matrix out of 3 single-channel ones.

The function merges several matrices to make a single multi-channel matrix. That is, each element of the output matrix will be a concatenation of the elements of the input matrices, where elements of i-th input matrix are treated as mv[i].channels()-element vectors. Output matrix must be of CV_8UC3 type.

The function split3 does the reverse operation.

See also

merge4, split4, split3

Note

  • Function textual ID is “org.opencv.core.transform.merge3”

Parameters:
  • src1 – first input CV_8UC1 matrix to be merged.

  • src2 – second input CV_8UC1 matrix to be merged.

  • src3 – third input CV_8UC1 matrix to be merged.

merge4()#

GMat cv::gapi::merge4(const GMat &src1, const GMat &src2, const GMat &src3, const GMat &src4)#

Creates one 4-channel matrix out of 4 single-channel ones.

The function merges several matrices to make a single multi-channel matrix. That is, each element of the output matrix will be a concatenation of the elements of the input matrices, where elements of i-th input matrix are treated as mv[i].channels()-element vectors. Output matrix must be of CV_8UC4 type.

The function split4 does the reverse operation.

See also

merge3, split4, split3

Note

  • Function textual ID is “org.opencv.core.transform.merge4”

Parameters:
  • src1 – first input CV_8UC1 matrix to be merged.

  • src2 – second input CV_8UC1 matrix to be merged.

  • src3 – third input CV_8UC1 matrix to be merged.

  • src4 – fourth input CV_8UC1 matrix to be merged.

min()#

GMat cv::gapi::min(const GMat &src1, const GMat &src2)#

Calculates per-element minimum of two matrices.

The function min calculates the per-element minimum of two matrices of the same size, number of channels and depth:

\[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\]
where I is a multi-dimensional index of matrix elements. In case of multi-channel matrices, each channel is processed independently. Output matrix must be of the same size and depth as src1.

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

See also

max, cmpEQ, cmpLT, cmpLE

Note

Function textual ID is “org.opencv.core.matrixop.min”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix of the same size and depth as src1.

morphologyEx()#

GMat cv::gapi::morphologyEx(const GMat &src, const MorphTypes op, const Mat &kernel, const Point &anchor = Point(-1, -1), const int iterations = 1, const BorderTypes borderType = BORDER_CONSTANT, const Scalar &borderValue = morphologyDefaultBorderValue())#

Performs advanced morphological transformations.

The function can perform advanced morphological transformations using an erosion and dilation as basic operations.

Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.

Note

  • Function textual ID is “org.opencv.imgproc.filters.morphologyEx”

  • The number of iterations is the number of times erosion or dilatation operation will be applied. For instance, an opening operation (MORPH_OPEN) with two iterations is equivalent to apply successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).

Parameters:
  • src – Input image.

  • op – Type of a morphological operation, see MorphTypes

  • kernel – Structuring element. It can be created using getStructuringElement.

  • anchor – Anchor position within the element. Both negative values mean that the anchor is at the kernel center.

  • iterations – Number of times erosion and dilation are applied.

  • borderType – Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.

  • borderValue – Border value in case of a constant border. The default value has a special meaning.

mul()#

GMat cv::gapi::mul(const GMat &src1, const GMat &src2, double scale = 1.0, int ddepth = -1)#

Calculates the per-element scaled product of two matrices.

The function mul calculates the per-element product of two matrices:

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

If src1.depth() == src2.depth(), ddepth can be set to the default -1. In this case, the output matrix will have the same depth as the input matrices. The matrices can be single or multi channel. Output matrix must have the same size as input matrices.

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

See also

add, sub, div, addWeighted

Note

Function textual ID is “org.opencv.core.math.mul”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix of the same size and the same depth as src1.

  • scale – optional scale factor.

  • ddepth – optional depth of the output matrix.

mulC()#

GMat cv::gapi::mulC(const GMat &src, const GScalar &multiplier, int ddepth = -1)#

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

mulC()#

GMat cv::gapi::mulC(const GMat &src, double multiplier, int ddepth = -1)#

Multiplies matrix by scalar.

The function mulC multiplies each element of matrix src by given scalar value:

\[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I) \cdot \texttt{multiplier} )\]

The matrices can be single or multi channel. Output matrix must have the same size as src.

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

See also

add, sub, div, addWeighted

Note

Function textual ID is “org.opencv.core.math.mulC”

Parameters:
  • src – input matrix.

  • multiplier – factor to be multiplied.

  • ddepth – optional depth of the output matrix. If -1, the depth of output matrix will be the same as input matrix depth.

mulC()#

GMat cv::gapi::mulC(const GScalar &multiplier, const GMat &src, int ddepth = -1)#

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

normalize()#

GMat cv::gapi::normalize(const GMat &src, double alpha, double beta, int norm_type, int ddepth = -1)#

Normalizes the norm or value range of an array.

The function normalizes scale and shift the input array elements so that

\[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\]
(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
\[\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\]
when normType=NORM_MINMAX (for dense arrays only).

See also

norm, Mat::convertTo

Note

Function textual ID is “org.opencv.core.normalize”

Parameters:
  • src – input array.

  • alpha – norm value to normalize to or the lower range boundary in case of the range normalization.

  • beta – upper range boundary in case of the range normalization; it is not used for the norm normalization.

  • norm_type – normalization type (see cv::NormTypes).

  • ddepth – when negative, the output array has the same type as src; otherwise, it has the same number of channels as src and the depth =ddepth.

normInf()#

GScalar cv::gapi::normInf(const GMat &src)#

Calculates the absolute infinite norm of a matrix.

This version of normInf calculates the absolute infinite norm of src.

As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\). The \( L_{\infty} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\) is calculated as follows

\[\begin{align*} \| r(-1) \|_{L_\infty} &= \max(|-1|,|2|) = 2 \end{align*}\]
and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
\[\begin{align*} \| r(0.5) \|_{L_\infty} &= \max(|0.5|,|0.5|) = 0.5. \end{align*}\]

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

See also

normL1, normL2

Note

Function textual ID is “org.opencv.core.matrixop.norminf”

Parameters:

src – input matrix.

normL1()#

GScalar cv::gapi::normL1(const GMat &src)#

Calculates the absolute L1 norm of a matrix.

This version of normL1 calculates the absolute L1 norm of src.

As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\). The \( L_{1} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\) is calculated as follows

\[\begin{split}\begin{align*} \| r(-1) \|_{L_1} &= |-1| + |2| = 3 \\ \end{align*}\end{split}\]
and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
\[\begin{split}\begin{align*} \| r(0.5) \|_{L_1} &= |0.5| + |0.5| = 1 \\ \end{align*}\end{split}\]

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

See also

normL2, normInf

Note

Function textual ID is “org.opencv.core.matrixop.norml1”

Parameters:

src – input matrix.

normL2()#

GScalar cv::gapi::normL2(const GMat &src)#

Calculates the absolute L2 norm of a matrix.

This version of normL2 calculates the absolute L2 norm of src.

As example for one array consider the function \(r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\). The \( L_{2} \) norm for the sample value \(r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\) is calculated as follows

\[\begin{split}\begin{align*} \| r(-1) \|_{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\ \end{align*}\end{split}\]
and for \(r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\) the calculation is
\[\begin{split}\begin{align*} \| r(0.5) \|_{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\ \end{align*}\end{split}\]

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

See also

normL1, normInf

Note

Function textual ID is “org.opencv.core.matrixop.norml2”

Parameters:

src – input matrix.

NV12toBGR()#

GMat cv::gapi::NV12toBGR(const GMat &src_y, const GMat &src_uv)#

Converts an image from NV12 (YUV420p) color space to BGR. The function converts an input image from NV12 color space to RGB. The conventional ranges for Y, U, and V channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

YUV2BGR, NV12toRGB

Note

Function textual ID is “org.opencv.imgproc.colorconvert.nv12tobgr”

Parameters:
  • src_y – input image: 8-bit unsigned 1-channel image CV_8UC1.

  • src_uv – input image: 8-bit unsigned 2-channel image CV_8UC2.

NV12toBGRp()#

GMatP cv::gapi::NV12toBGRp(const GMat &src_y, const GMat &src_uv)#

Converts an image from NV12 (YUV420p) color space to BGR. The function converts an input image from NV12 color space to BGR. The conventional ranges for Y, U, and V channel values are 0 to 255.

Output image must be 8-bit unsigned planar 3-channel image CV_8UC1. Planar image memory layout is three planes laying in the memory contiguously, so the image height should be plane_height*plane_number, image type is CV_8UC1.

Note

Function textual ID is “org.opencv.imgproc.colorconvert.nv12torgbp”

Parameters:
  • src_y – input image: 8-bit unsigned 1-channel image CV_8UC1.

  • src_uv – input image: 8-bit unsigned 2-channel image CV_8UC2.

NV12toGray()#

GMat cv::gapi::NV12toGray(const GMat &src_y, const GMat &src_uv)#

Converts an image from NV12 (YUV420p) color space to gray-scaled. The function converts an input image from NV12 color space to gray-scaled. The conventional ranges for Y, U, and V channel values are 0 to 255.

Output image must be 8-bit unsigned 1-channel image CV_8UC1.

See also

YUV2RGB, NV12toBGR

Note

Function textual ID is “org.opencv.imgproc.colorconvert.nv12togray”

Parameters:
  • src_y – input image: 8-bit unsigned 1-channel image CV_8UC1.

  • src_uv – input image: 8-bit unsigned 2-channel image CV_8UC2.

NV12toRGB()#

GMat cv::gapi::NV12toRGB(const GMat &src_y, const GMat &src_uv)#

Converts an image from NV12 (YUV420p) color space to RGB. The function converts an input image from NV12 color space to RGB. The conventional ranges for Y, U, and V channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

YUV2RGB, NV12toBGR

Note

Function textual ID is “org.opencv.imgproc.colorconvert.nv12torgb”

Parameters:
  • src_y – input image: 8-bit unsigned 1-channel image CV_8UC1.

  • src_uv – input image: 8-bit unsigned 2-channel image CV_8UC2.

NV12toRGBp()#

GMatP cv::gapi::NV12toRGBp(const GMat &src_y, const GMat &src_uv)#

Converts an image from NV12 (YUV420p) color space to RGB. The function converts an input image from NV12 color space to RGB. The conventional ranges for Y, U, and V channel values are 0 to 255.

Output image must be 8-bit unsigned planar 3-channel image CV_8UC1. Planar image memory layout is three planes laying in the memory contiguously, so the image height should be plane_height*plane_number, image type is CV_8UC1.

Note

Function textual ID is “org.opencv.imgproc.colorconvert.nv12torgbp”

Parameters:
  • src_y – input image: 8-bit unsigned 1-channel image CV_8UC1.

  • src_uv – input image: 8-bit unsigned 2-channel image CV_8UC2.

phase()#

GMat cv::gapi::phase(const GMat &x, const GMat &y, bool angleInDegrees = false)#

Calculates the rotation angle of 2D vectors.

The function cv::phase calculates the rotation angle of each 2D vector that is formed from the corresponding elements of x and y :

\[\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\]

The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 , the corresponding angle(I) is set to 0.

Parameters:
  • x – input floating-point array of x-coordinates of 2D vectors.

  • y – input array of y-coordinates of 2D vectors; it must have the same size and the same type as x.

  • angleInDegrees – when true, the function calculates the angle in degrees, otherwise, they are measured in radians.

Returns:

array of vector angles; it has the same size and same type as x.

polarToCart()#

std::tuple<GMat, GMat> cv::gapi::polarToCart(const GMat &magnitude, const GMat &angle, bool angleInDegrees = false)#

Calculates x and y coordinates of 2D vectors from their magnitude and angle.

The function polarToCart calculates the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle:

\[\begin{split}\begin{array}{l} \texttt{x} (I) = \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) = \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\end{split}\]

The relative accuracy of the estimated coordinates is about 1e-6.

First output is a matrix of x-coordinates of 2D vectors. Second output is a matrix of y-coordinates of 2D vectors. Both output must have the same size and depth as input matrices.

See also

cartToPolar, exp, log, pow, sqrt

Note

Function textual ID is “org.opencv.core.math.polarToCart”

Parameters:
  • magnitude – input floating-point CV_32FC1 matrix (1xN) of magnitudes of 2D vectors;

  • angle – input floating-point CV_32FC1 matrix (1xN) of angles of 2D vectors.

  • angleInDegrees – when true, the input angles are measured in degrees, otherwise, they are measured in radians.

remap()#

GMat cv::gapi::remap(const GMat &src, const Mat &map1, const Mat &map2, int interpolation, int borderMode = BORDER_CONSTANT, const Scalar &borderValue = Scalar())#

Applies a generic geometrical transformation to an image.

The function remap transforms the source image using the specified map:

\[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\]

where values of pixels with non-integer coordinates are computed using one of available interpolation methods. \(map_x\) and \(map_y\) can be encoded as separate floating-point maps in \(map_1\) and \(map_2\) respectively, or interleaved floating-point maps of \((x,y)\) in \(map_1\), or fixed-point maps created by using convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (2x) remapping operations. In the converted case, \(map_1\) contains pairs (cvFloor(x), cvFloor(y)) and \(map_2\) contains indices in a table of interpolation coefficients. Output image must be of the same size and depth as input one.

Note

  • Function textual ID is “org.opencv.core.transform.remap”

  • Due to current implementation limitations the size of an input and output images should be less than 32767x32767.

Parameters:
  • src – Source image.

  • map1 – The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2.

  • map2 – The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.

  • interpolation – Interpolation method (see cv::InterpolationFlags). The methods INTER_AREA and INTER_LINEAR_EXACT are not supported by this function.

  • borderMode – Pixel extrapolation method (see cv::BorderTypes). When borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that corresponds to the “outliers” in the source image are not modified by the function.

  • borderValue – Value used in case of a constant border. By default, it is 0.

resize()#

GMat cv::gapi::resize(const GMat &src, const Size &dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR)#

Resizes an image.

The function resizes the image src down to or up to the specified size.

Output image size will have the size dsize (when dsize is non-zero) or the size computed from src.size(), fx, and fy; the depth of output is the same as of src.

If you want to resize src so that it fits the pre-created dst, you may call the function as follows:

// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);
If you want to decimate the image by factor of 2 in each direction, you can call the function this way:
// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);
To shrink an image, it will generally look best with cv::INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with cv::INTER_CUBIC (slow) or cv::INTER_LINEAR (faster but still looks OK).

Note

Function textual ID is “org.opencv.imgproc.transform.resize”

Parameters:
  • src – input image.

  • dsize – output image size; if it equals zero, it is computed as:

    \[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\]
    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

    \[\texttt{(double)dsize.width/src.cols}\]

  • fy – scale factor along the vertical axis; when it equals 0, it is computed as

    \[\texttt{(double)dsize.height/src.rows}\]

  • interpolation – interpolation method, see cv::InterpolationFlags

resizeP()#

GMatP cv::gapi::resizeP(const GMatP &src, const Size &dsize, int interpolation = cv::INTER_LINEAR)#

Resizes a planar image.

The function resizes the image src down to or up to the specified size. Planar image memory layout is three planes laying in the memory contiguously, so the image height should be plane_height*plane_number, image type is CV_8UC1.

Output image size will have the size dsize, the depth of output is the same as of src.

Note

Function textual ID is “org.opencv.imgproc.transform.resizeP”

Parameters:
  • src – input image, must be of CV_8UC1 type;

  • dsize – output image size;

  • interpolation – interpolation method, only cv::INTER_LINEAR is supported at the moment

RGB2Gray()#

GMat cv::gapi::RGB2Gray(const GMat &src)#

Converts an image from RGB color space to gray-scaled.

The conventional ranges for R, G, and B channel values are 0 to 255. Resulting gray color value computed as

\[\texttt{dst} (I)= \texttt{0.299} * \texttt{src}(I).R + \texttt{0.587} * \texttt{src}(I).G + \texttt{0.114} * \texttt{src}(I).B \]

See also

RGB2YUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.rgb2gray”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC1.

RGB2Gray()#

GMat cv::gapi::RGB2Gray(const GMat &src, float rY, float gY, float bY)#

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

\[\texttt{dst} (I)= \texttt{rY} * \texttt{src}(I).R + \texttt{gY} * \texttt{src}(I).G + \texttt{bY} * \texttt{src}(I).B \]

See also

RGB2YUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.rgb2graycustom”

Parameters:
  • src – input image: 8-bit unsigned 3-channel image CV_8UC1.

  • rY – float multiplier for R channel.

  • gY – float multiplier for G channel.

  • bY – float multiplier for B channel.

RGB2HSV()#

GMat cv::gapi::RGB2HSV(const GMat &src)#

Converts an image from RGB color space to HSV. The function converts an input image from RGB color space to HSV. The conventional ranges for R, G, and B channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

YUV2BGR, NV12toRGB

Note

Function textual ID is “org.opencv.imgproc.colorconvert.rgb2hsv”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

RGB2I420()#

GMat cv::gapi::RGB2I420(const GMat &src)#

Converts an image from RGB color space to I420 color space.

The function converts an input image from RGB color space to I420. The conventional ranges for R, G, and B channel values are 0 to 255.

Output image must be 8-bit unsigned 1-channel image. CV_8UC1. Width of I420 output image must be the same as width of input image. Height of I420 output image must be equal 3/2 from height of input image.

See also

I4202RGB

Note

Function textual ID is “org.opencv.imgproc.colorconvert.rgb2i420”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

RGB2Lab()#

GMat cv::gapi::RGB2Lab(const GMat &src)#

Converts an image from RGB color space to Lab color space.

The function converts an input image from BGR color space to Lab. The conventional ranges for R, G, and B channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC1.

See also

RGB2YUV, RGB2LUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.rgb2lab”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC1.

RGB2YUV()#

GMat cv::gapi::RGB2YUV(const GMat &src)#

Converts an image from RGB color space to YUV color space.

The function converts an input image from RGB color space to YUV. The conventional ranges for R, G, and B channel values are 0 to 255.

In case of linear transformations, the range does not matter. But in case of a non-linear transformation, an input RGB image should be normalized to the proper value range to get the correct results, like here, at RGB \(\rightarrow\) Y*u*v* transformation. Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

YUV2RGB, RGB2Lab

Note

Function textual ID is “org.opencv.imgproc.colorconvert.rgb2yuv”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

RGB2YUV422()#

GMat cv::gapi::RGB2YUV422(const GMat &src)#

Converts an image from RGB color space to YUV422. The function converts an input image from RGB color space to YUV422. The conventional ranges for R, G, and B channel values are 0 to 255.

Output image must be 8-bit unsigned 2-channel image CV_8UC2.

See also

YUV2BGR, NV12toRGB

Note

Function textual ID is “org.opencv.imgproc.colorconvert.rgb2yuv422”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

select()#

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).

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:
  • src1 – first input matrix.

  • src2 – second input matrix.

  • mask – mask input matrix.

sepFilter()#

GMat cv::gapi::sepFilter(const GMat &src, int ddepth, const Mat &kernelX, const Mat &kernelY, const Point &anchor, const Scalar &delta, int borderType = BORDER_DEFAULT, const Scalar &borderValue = Scalar(0))#

Applies a separable linear filter to a matrix(image).

The function applies a separable linear filter to the matrix. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result is returned.

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

. Output image must have the same type, size, and number of channels as the input image.

when ddepth=-1, the output image will have the same depth as the source)

Note

  • In case of floating-point computation, rounding to nearest even is procedeed if hardware supports it (if not - to nearest value).

  • Function textual ID is “org.opencv.imgproc.filters.sepfilter”

Parameters:
  • src – Source image.

  • ddepth – desired depth of the destination image (the following combinations of src.depth() and ddepth are supported:

     src.depth() = CV_8U, ddepth = -1/CV_16S/CV_32F/CV_64F
     src.depth() = CV_16U/CV_16S, ddepth = -1/CV_32F/CV_64F
     src.depth() = CV_32F, ddepth = -1/CV_32F/CV_64F
     src.depth() = CV_64F, ddepth = -1/CV_64F
    

  • kernelX – Coefficients for filtering each row.

  • kernelY – Coefficients for filtering each column.

  • anchor – Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor is at the kernel center.

  • delta – Value added to the filtered results before storing them.

  • borderType – Pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of constant border type

serialize()#

std::vector<char> cv::gapi::serialize(const cv::GCompileArgs &ca)#

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

Parameters:

ca – GCompileArgs to serialize.

serialize()#

std::vector<char> cv::gapi::serialize(const cv::GComputation &c)#

Serialize a graph represented by GComputation into an array of bytes.

Check different overloads for more examples.

Parameters:

cGComputation to serialize.

Returns:

serialized vector of bytes.

serialize()#

std::vector<char> cv::gapi::serialize(const cv::GMetaArgs &ma)#

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

Parameters:

ma – GMetaArgs to serialize.

serialize()#

std::vector<char> cv::gapi::serialize(const cv::GRunArgs &ra)#

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

Parameters:

ra – GRunArgs to serialize.

serialize()#

std::vector<char> cv::gapi::serialize(const std::vector<std::string> &vs)#

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

Parameters:

vs – std::vector<std::string> to serialize.

Sobel()#

GMat cv::gapi::Sobel(const GMat &src, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT, const Scalar &borderValue = Scalar(0))#

Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.

In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\) kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first or the second x- or y- derivatives.

There is also the special value ksize = FILTER_SCHARR (-1) that corresponds to the \(3\times3\) Scharr filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is

\[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\]

for the x-derivative, or transposed for the y-derivative.

The function calculates an image derivative by convolving the image with the appropriate kernel:

\[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\]

The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of:

\[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\]

The second case corresponds to a kernel of:

\[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\]

Note

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.sobel”

Parameters:
  • src – input image.

  • ddepth – output image depth, see combinations; in the case of 8-bit input images it will result in truncated derivatives.

  • dx – order of the derivative x.

  • dy – order of the derivative y.

  • ksize – size of the extended Sobel kernel; it must be odd.

  • scale – optional scale factor for the computed derivative values; by default, no scaling is applied (see cv::getDerivKernels for details).

  • delta – optional delta value that is added to the results prior to storing them in dst.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of constant border type

SobelXY()#

std::tuple<GMat, GMat> cv::gapi::SobelXY(const GMat &src, int ddepth, int order, int ksize = 3, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT, const Scalar &borderValue = Scalar(0))#

Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.

In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\) kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first or the second x- or y- derivatives.

There is also the special value ksize = FILTER_SCHARR (-1) that corresponds to the \(3\times3\) Scharr filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is

\[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\]

for the x-derivative, or transposed for the y-derivative.

The function calculates an image derivative by convolving the image with the appropriate kernel:

\[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\]

The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of:

\[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\]

The second case corresponds to a kernel of:

\[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\]

Note

  • First returned matrix correspons to dx derivative while the second one to dy.

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is “org.opencv.imgproc.filters.sobelxy”

Parameters:
  • src – input image.

  • ddepth – output image depth, see combinations; in the case of 8-bit input images it will result in truncated derivatives.

  • order – order of the derivatives.

  • ksize – size of the extended Sobel kernel; it must be odd.

  • scale – optional scale factor for the computed derivative values; by default, no scaling is applied (see cv::getDerivKernels for details).

  • delta – optional delta value that is added to the results prior to storing them in dst.

  • borderType – pixel extrapolation method, see cv::BorderTypes

  • borderValue – border value in case of constant border type

split3()#

std::tuple<GMat, GMat, GMat> cv::gapi::split3(const GMat &src)#

Divides a 3-channel matrix into 3 single-channel matrices.

The function splits a 3-channel matrix into 3 single-channel matrices:

\[\texttt{mv} [c](I) = \texttt{src} (I)_c\]

All output matrices must be of CV_8UC1 type.

The function merge3 does the reverse operation.

See also

split4, merge3, merge4

Note

  • Function textual ID is “org.opencv.core.transform.split3”

Parameters:

src – input CV_8UC3 matrix.

split4()#

std::tuple<GMat, GMat, GMat, GMat> cv::gapi::split4(const GMat &src)#

Divides a 4-channel matrix into 4 single-channel matrices.

The function splits a 4-channel matrix into 4 single-channel matrices:

\[\texttt{mv} [c](I) = \texttt{src} (I)_c\]

All output matrices must be of CV_8UC1 type.

The function merge4 does the reverse operation.

See also

split3, merge3, merge4

Note

  • Function textual ID is “org.opencv.core.transform.split4”

Parameters:

src – input CV_8UC4 matrix.

sqrt()#

GMat cv::gapi::sqrt(const GMat &src)#

Calculates a square root of array elements.

The function cv::gapi::sqrt calculates a square root of each input array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in std::sqrt .

Parameters:

src – input floating-point array.

Returns:

output array of the same size and type as src.

sub()#

GMat cv::gapi::sub(const GMat &src1, const GMat &src2, int ddepth = -1)#

Calculates the per-element difference between two matrices.

The function sub calculates difference between two matrices, when both matrices have the same size and the same number of channels:

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

The function can be replaced with matrix expressions:

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

The input matrices and the output matrix can all have the same or different depths. For example, you can subtract two 8-bit unsigned matrices store the result as a 16-bit signed matrix. Depth of the output matrix is determined by the ddepth parameter. If src1.depth() == src2.depth(), ddepth can be set to the default -1. In this case, the output matrix will have the same depth as the input matrices. The matrices can be single or multi channel.

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

See also

add, addC

Note

Function textual ID is “org.opencv.core.math.sub”

Parameters:
  • src1 – first input matrix.

  • src2 – second input matrix.

  • ddepth – optional depth of the output matrix.

subC()#

GMat cv::gapi::subC(const GMat &src, const GScalar &c, int ddepth = -1)#

Calculates the per-element difference between matrix and given scalar.

The function can be replaced with matrix expressions:

\[\texttt{dst} = \texttt{src} - \texttt{c}\]

Depth of the output matrix is determined by the ddepth parameter. If ddepth is set to default -1, the depth of output matrix will be the same as the depth of input matrix. The matrices can be single or multi channel. Output matrix must have the same size as src.

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

See also

add, addC, subRC

Note

Function textual ID is “org.opencv.core.math.subC”

Parameters:
  • src – first input matrix.

  • c – scalar value to subtracted.

  • ddepth – optional depth of the output matrix.

subRC()#

GMat cv::gapi::subRC(const GScalar &c, const GMat &src, int ddepth = -1)#

Calculates the per-element difference between given scalar and the matrix.

The function can be replaced with matrix expressions:

\[\texttt{dst} = \texttt{c} - \texttt{src}\]

Depth of the output matrix is determined by the ddepth parameter. If ddepth is set to default -1, the depth of output matrix will be the same as the depth of input matrix. The matrices can be single or multi channel. Output matrix must have the same size as src.

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

See also

add, addC, subC

Note

Function textual ID is “org.opencv.core.math.subRC”

Parameters:
  • c – scalar value to subtract from.

  • src – input matrix to be subtracted.

  • ddepth – optional depth of the output matrix.

sum()#

GScalar cv::gapi::sum(const GMat &src)#

Calculates sum of all matrix elements.

The function sum calculates sum of all matrix elements, independently for each channel.

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

See also

countNonZero, mean, min, max

Note

Function textual ID is “org.opencv.core.matrixop.sum”

Parameters:

src – input matrix.

threshold()#

std::tuple<GMat, GScalar> cv::gapi::threshold(const GMat &src, const GScalar &maxval, int type)#

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function applicable for all threshold types except cv::THRESH_OTSU and cv::THRESH_TRIANGLE

Note

Function textual ID is “org.opencv.core.matrixop.thresholdOT”

threshold()#

GMat cv::gapi::threshold(const GMat &src, const GScalar &thresh, const GScalar &maxval, int type)#

Applies a fixed-level threshold to each matrix element.

The function applies fixed-level thresholding to a single- or multiple-channel matrix. The function is typically used to get a bi-level (binary) image out of a grayscale image ( cmp functions could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by type parameter.

Also, the special values cv::THRESH_OTSU or cv::THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu’s or Triangle algorithm and uses it instead of the specified thresh . The function returns the computed threshold value in addititon to thresholded matrix. The Otsu’s and Triangle methods are implemented only for 8-bit matrices.

Input image should be single channel only in case of cv::THRESH_OTSU or cv::THRESH_TRIANGLE flags. Output matrix must be of the same size and depth as src.

See also

min, max, cmpGT, cmpLE, cmpGE, cmpLT

Note

Function textual ID is “org.opencv.core.matrixop.threshold”

Parameters:
  • src – input matrix (CV_8UC1, CV_8UC3, or CV_32FC1).

  • thresh – threshold value.

  • maxval – maximum value to use with the cv::THRESH_BINARY and cv::THRESH_BINARY_INV thresholding types.

  • type – thresholding type (see the cv::ThresholdTypes).

warpAffine()#

GMat cv::gapi::warpAffine(const GMat &src, const Mat &M, const Size &dsize, int flags = cv::INTER_LINEAR, int borderMode = cv::BORDER_CONSTANT, const Scalar &borderValue = Scalar())#

Applies an affine transformation to an image.

The function warpAffine transforms the source image using the specified matrix:

\[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\]

when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invertAffineTransform and then put in the formula above instead of M. The function cannot operate in-place.

Parameters:
  • src – input image.

  • M\(2\times 3\) transformation matrix.

  • dsize – size of the output image.

  • flags – combination of interpolation methods (see InterpolationFlags) and the optional flag WARP_INVERSE_MAP that means that M is the inverse transformation ( \(\texttt{dst}\rightarrow\texttt{src}\) ).

  • borderMode – pixel extrapolation method (see BorderTypes); borderMode=BORDER_TRANSPARENT isn’t supported

  • borderValue – value used in case of a constant border; by default, it is 0.

warpPerspective()#

GMat cv::gapi::warpPerspective(const GMat &src, const Mat &M, const Size &dsize, int flags = cv::INTER_LINEAR, int borderMode = cv::BORDER_CONSTANT, const Scalar &borderValue = Scalar())#

Applies a perspective transformation to an image.

The function warpPerspective transforms the source image using the specified matrix:

\[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\]

when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert and then put in the formula above instead of M. The function cannot operate in-place.

Parameters:
  • src – input image.

  • M\(3\times 3\) transformation matrix.

  • dsize – size of the output image.

  • flags – combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation ( \(\texttt{dst}\rightarrow\texttt{src}\) ).

  • borderMode – pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).

  • borderValue – value used in case of a constant border; by default, it equals 0.

YUV2BGR()#

GMat cv::gapi::YUV2BGR(const GMat &src)#

Converts an image from YUV color space to BGR color space.

The function converts an input image from YUV color space to BGR. The conventional ranges for B, G, and R channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

BGR2YUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.yuv2bgr”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.

YUV2RGB()#

GMat cv::gapi::YUV2RGB(const GMat &src)#

Converts an image from YUV color space to RGB. The function converts an input image from YUV color space to RGB. The conventional ranges for Y, U, and V channel values are 0 to 255.

Output image must be 8-bit unsigned 3-channel image CV_8UC3.

See also

RGB2Lab, RGB2YUV

Note

Function textual ID is “org.opencv.imgproc.colorconvert.yuv2rgb”

Parameters:

src – input image: 8-bit unsigned 3-channel image CV_8UC3.