OpenCV
4.2.0
Open Source Computer Vision
|
A container class for heterogeneous kernel implementation collections and graph transformations. More...
#include <opencv2/gapi/gkernel.hpp>
Public Member Functions | |
std::vector< GBackend > | backends () const |
Lists all backends which are included into package. More... | |
const std::vector< GTransform > & | get_transformations () const |
Returns vector of transformations included in the package. More... | |
template<typename KImpl > | |
void | include () |
Put a new kernel implementation or a new transformation KImpl into the package. More... | |
template<typename KImpl > | |
bool | includes () const |
Test if a particular kernel implementation KImpl is included in this kernel package. More... | |
template<typename KAPI > | |
bool | includesAPI () const |
template<typename KAPI > | |
GBackend | lookup () const |
Find a kernel (by its API) More... | |
void | remove (const GBackend &backend) |
Remove all kernels associated with the given backend from the package. More... | |
template<typename KAPI > | |
void | remove () |
Remove all kernels implementing the given API from the package. More... | |
std::size_t | size () const |
Returns total number of kernels in the package (across all backends included) More... | |
Friends | |
GKernelPackage | combine (const GKernelPackage &lhs, const GKernelPackage &rhs) |
Create a new package based on lhs and rhs . More... | |
A container class for heterogeneous kernel implementation collections and graph transformations.
GKernelPackage is a special container class which stores kernel implementations and graph transformations. Objects of this class are created and passed to cv::GComputation::compile() to specify which kernels to use and which transformations to apply in the compiled graph. GKernelPackage may contain kernels of different backends, e.g. be heterogeneous.
The most easy way to create a kernel package is to use function cv::gapi::kernels(). This template functions takes kernel implementations in form of type list (variadic template) and generates a kernel package atop of that.
Kernel packages can be also generated programmatically, starting with an empty package (created with the default constructor) and then by populating it with kernels via call to GKernelPackage::include(). Note this method is also a template one since G-API kernel and transformation implementations are types, not objects.
Finally, two kernel packages can be combined into a new one with function cv::gapi::combine().
std::vector<GBackend> cv::gapi::GKernelPackage::backends | ( | ) | const |
Lists all backends which are included into package.
const std::vector<GTransform>& cv::gapi::GKernelPackage::get_transformations | ( | ) | const |
Returns vector of transformations included in the package.
|
inline |
Put a new kernel implementation or a new transformation KImpl into the package.
|
inline |
Test if a particular kernel implementation KImpl is included in this kernel package.
|
inline |
Check if package contains ANY implementation of a kernel API by API type.
|
inline |
Find a kernel (by its API)
Returns implementation corresponding id. Throws if nothing found.
void cv::gapi::GKernelPackage::remove | ( | const GBackend & | backend | ) |
Remove all kernels associated with the given backend from the package.
Does nothing if there's no kernels of this backend in the package.
backend | backend which kernels to remove |
|
inline |
Remove all kernels implementing the given API from the package.
Does nothing if there's no kernels implementing the given interface.
std::size_t cv::gapi::GKernelPackage::size | ( | ) | const |
Returns total number of kernels in the package (across all backends included)
|
friend |
Create a new package based on lhs
and rhs
.
lhs | "Left-hand-side" package in the process |
rhs | "Right-hand-side" package in the process |