OpenCV  4.10.0-dev
Open Source Computer Vision
No Matches
cv::GComputationT< typename > Class Template Reference

This class is a typed wrapper over a regular GComputation. More...

Collaboration diagram for cv::GComputationT< typename >:

Detailed Description

class cv::GComputationT< typename >

This class is a typed wrapper over a regular GComputation.

std::function<>-like template parameter specifies the graph signature so methods so the object's constructor, methods like apply() and the derived GCompiledT::operator() also become typed.

There is no need to use cv::gin() or cv::gout() modifiers with objects of this class. Instead, all input arguments are followed by all output arguments in the order from the template argument signature.

Refer to the following example. Regular (untyped) code is written this way:

// Untyped G-API ///////////////////////////////////////////////////////////
cv::GComputation cvtU([]()
cv::GMat in1, in2;
cv::GMat out = cv::gapi::add(in1, in2);
return cv::GComputation({in1, in2}, {out});
std::vector<cv::Mat> u_ins = {in_mat1, in_mat2};
std::vector<cv::Mat> u_outs = {out_mat_untyped};
cvtU.apply(u_ins, u_outs);
GComputation class represents a captured computation graph. GComputation objects form boundaries for ...
Definition gcomputation.hpp:121
void apply(GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args={})
Compile graph on-the-fly and immediately execute it on the inputs data vectors.
GMat class represents image or tensor data in the graph.
Definition gmat.hpp:68
GMat add(const GMat &src1, const GMat &src2, int ddepth=-1)
Calculates the per-element sum of two matrices.


Now the same code written with typed API:

// Typed G-API /////////////////////////////////////////////////////////////
return m1+m2;
cvtT.apply(in_mat1, in_mat2, out_mat_typed1);
auto cvtTC = cvtT.compile(cv::descr_of(in_mat1), cv::descr_of(in_mat2));
cvtTC(in_mat1, in_mat2, out_mat_typed2);
This class is a typed wrapper over a regular GComputation.
Definition gtyped.hpp:85
GArrayDesc descr_of(const std::vector< U > &)
Definition garray.hpp:44

The key difference is:

The documentation for this class was generated from the following file: