OpenCV  4.5.5
Open Source Computer Vision
cv::GComputationT< typename > Class Template Reference

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

#include <opencv2/gapi/gtyped.hpp>

Detailed Description

template<typename>
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);

Here:

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);

The key difference is:


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