![]() |
OpenCV 4.12.0
开源计算机视觉
|
表示一个已编译的计算(图)。只能用于为其编译的图像/数据格式和分辨率,但有一些例外。更多...
#include <opencv2/gapi/gcompiled.hpp>
公共成员函数 | |
| GCompiled () | |
| 构造一个空对象。 | |
| bool | canReshape () const |
| 检查底层后端是否支持 reshape。 | |
| const GMetaArgs & | metas () const |
| 此图编译时使用的元数据向量。 | |
| operator bool () const | |
| 检查编译对象是否有效(非空) | |
| void | operator() (const std::vector< cv::Mat > &ins, const std::vector< cv::Mat > &outs) |
| 执行具有任意数量输入/输出的计算。 | |
| void | operator() (cv::Mat in, cv::Mat &out) |
| 执行一元计算。 | |
| void | operator() (cv::Mat in, cv::Scalar &out) |
| 执行一元计算。 | |
| void | operator() (cv::Mat in1, cv::Mat in2, cv::Mat &out) |
| 执行二元计算。 | |
| void | operator() (cv::Mat in1, cv::Mat in2, cv::Scalar &out) |
| 执行二元计算。 | |
| void | operator() (GRunArgs &&ins, GRunArgsP &&outs) |
| 运行已编译的计算,通用版本。 | |
| const GMetaArgs & | outMetas () const |
| 图输出的元数据描述向量。 | |
| void | prepareForNewStream () |
| 为新的视频流准备内部内核状态。 | |
| void | reshape (const GMetaArgs &inMetas, const GCompileArgs &args) |
| 调整已编译的图以支持新的图像分辨率。 | |
表示一个已编译的计算(图)。只能用于为其编译的图像/数据格式和分辨率,但有一些例外。
此类表示图编译的结果(调用 cv::GComputation::compile())。此类的对象实际执行数据处理,图执行封装在此类的对象中。执行模型本身取决于编译期间使用的内核和后端,有关详细信息,请参见G-API 图编译参数。
在一般情况下,GCompiled对象只能应用于为其编译的格式/分辨率的数据(参见G-API 元数据描述符)。但是,如果底层后端允许,则可以调整已编译的对象以处理不同分辨率的数据(图像),但格式和类型必须保持相同。
GCompiled在其语义上非常类似于std::function<> – 运行它看起来像用户代码中的函数调用。
目前,GCompiled对象不是可重入的 – 通常,对象是有状态的,因为图执行本身是一个有状态的过程,并且此状态现在维护在GCompiled自己的内存中(而不是在进程堆栈上)。
同时,从单个cv::GComputation生成的两个不同的GCompiled对象是完全独立的,可以并发使用。
| cv::GCompiled::GCompiled | ( | ) |
构造一个空对象。
| bool cv::GCompiled::canReshape | ( | ) | const |
检查底层后端是否支持 reshape。
| const GMetaArgs & cv::GCompiled::metas | ( | ) | const |
此图编译时使用的元数据向量。
|
显式 |
检查编译对象是否有效(非空)
| void cv::GCompiled::operator() | ( | const std::vector< cv::Mat > & | ins, |
| const std::vector< cv::Mat > & | outs ) |
执行具有任意数量输入/输出的计算。
这是一个重载的成员函数,为了方便起见而提供。它与上述函数的不同之处仅在于它接受的参数。
ins/outs 向量中的元素数量必须与用于定义源GComputation的输入/输出数量匹配。
| void cv::GCompiled::operator() | ( | cv::Mat | in, |
| cv::Scalar & | out ) |
执行一元计算。
这是一个重载的成员函数,为了方便起见而提供。它与上述函数的不同之处仅在于它接受的参数。
| in | 一元计算的输入 cv::Mat |
| 输出3D仿射变换矩阵,尺寸为\(3 \times 4\),形式如下 | 一元计算过程的输出 cv::Scalar。 |
| void cv::GCompiled::operator() | ( | cv::Mat | in1, |
| cv::Mat | in2, | ||
| cv::Scalar & | out ) |
执行二元计算。
这是一个重载的成员函数,为了方便起见而提供。它与上述函数的不同之处仅在于它接受的参数。
| in1 | 二元计算的第一个输入 cv::Mat |
| in2 | 二元计算的第二个输入 cv::Mat |
| 输出3D仿射变换矩阵,尺寸为\(3 \times 4\),形式如下 | 二元计算过程的输出 cv::Scalar。 |
| const GMetaArgs & cv::GCompiled::outMetas | ( | ) | const |
图输出的元数据描述向量。
| void cv::GCompiled::prepareForNewStream | ( | ) |
| void cv::GCompiled::reshape | ( | const GMetaArgs & | inMetas, |
| const GCompileArgs & | args ) |
调整已编译的图以支持新的图像分辨率。
如果发生错误,则抛出异常。
| inMetas | 要调整的新元数据。向量大小和元数据形状必须与计算的协议匹配。 |
| args | 要使用的编译参数。 |