OpenCV
4.3.0
Open Source Computer Vision
|
This class is a typed wrapper over a regular GComputation. More...
#include <opencv2/gapi/gtyped.hpp>
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:
Here:
apply()
in fact takes arbitrary number of arguments (as vectors) so user can pass wrong number of inputs/outputs here. C++ compiler wouldn't notice that since the cv::GComputation API is polymorphic, and only a run-time error will be generated.Now the same code written with typed API:
The key difference is:
GComputationT<>
signature.apply()
does not require any extra specifiers to separate input arguments from the output onesGCompiledT
(compilation product) takes input/output arguments with no extra specifiers as well.