OpenCV  4.0.1
Open Source Computer Vision
Classes | Typedefs | Functions
G-API Graph Compilation Arguments

Compilation arguments: a set of data structures which can be passed to control compilation process. More...

Classes

struct  cv::GCompileArg
 Represents an arbitrary compilation argument. More...
 
class  cv::gapi::GKernelPackage
 A container class for heterogeneous kernel implementation collections. More...
 
struct  cv::graph_dump_path
 Ask G-API to dump compiled graph in Graphviz format under the given file name. More...
 

Typedefs

using cv::GCompileArgs = std::vector< GCompileArg >
 
using cv::gapi::GLookupOrder = std::vector< GBackend >
 Priority list of backends to use during kernel resolution process. More...
 

Functions

template<typename... Ts>
GCompileArgs cv::compile_args (Ts &&... args)
 
template<typename... KK>
GKernelPackage cv::gapi::kernels ()
 Create a kernel package object containing kernels specified in variadic template argument. More...
 
GLookupOrder cv::gapi::lookup_order (std::initializer_list< GBackend > &&list)
 Create a backend lookup order – priority list of backends to use during graph compilation process. More...
 

Detailed Description

Compilation arguments: a set of data structures which can be passed to control compilation process.

G-API comes with a number of graph compilation options which can be passed to cv::GComputation::apply() or cv::GComputation::compile(). Known compilation options are listed in this page, while extra backends may introduce their own compilation options (G-API transparently accepts everything which can be passed to cv::compile_args(), it depends on underlying backends if an option would be interpreted or not).

For example, if an example computation is executed like this:

cv::GComputation sobelEdge(cv::GIn(in), cv::GOut(out));
sobelEdge.apply(input, output);

Extra parameter specifying which kernels to compile with can be passed like this:

sobelEdge.apply(input, output, cv::compile_args(kernels));

Typedef Documentation

§ GCompileArgs

using cv::GCompileArgs = typedef std::vector<GCompileArg>

§ GLookupOrder

using cv::gapi::GLookupOrder = typedef std::vector<GBackend>

Priority list of backends to use during kernel resolution process.

Priority is descending – the first backend in the list has the top priority, and the last one has the lowest priority.

If there's multiple implementations available for a kernel at the moment of graph compilation, a kernel (and thus a backend) will be selected according to this order (if the parameter is passed).

Default order is not specified (and by default, only CPU(OpenCV) backend is involved in graph compilation).

Function Documentation

§ compile_args()

template<typename... Ts>
GCompileArgs cv::compile_args ( Ts &&...  args)

Wraps a list of arguments (a parameter pack) into a vector of compilation arguments (cv::GCompileArg).

§ kernels()

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

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

In G-API, kernel implementations 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) to the system. Example:

< CustomAdd
, CustomFilter2D
, CustomRGB2YUV
>();

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

§ lookup_order()

GLookupOrder cv::gapi::lookup_order ( std::initializer_list< GBackend > &&  list)
inline

Create a backend lookup order – priority list of backends to use during graph compilation process.

See also
GLookupOrder, G-API Standard backends