Trait opencv::hub_prelude::GCompiledTraitConst
source · pub trait GCompiledTraitConst {
fn as_raw_GCompiled(&self) -> *const c_void;
fn to_bool(&self) -> Result<bool> { ... }
fn can_reshape(&self) -> Result<bool> { ... }
}
Expand description
\addtogroup gapi_main_classes /
Represents a compiled computation (graph). Can only be used with image / data formats & resolutions it was compiled for, with some exceptions.
This class represents a product of graph compilation (calling cv::GComputation::compile()). Objects of this class actually do data processing, and graph execution is incapsulated into objects of this class. Execution model itself depends on kernels and backends which were using during the compilation, see @ref gapi_compile_args for details.
In a general case, GCompiled objects can be applied to data only in that formats/resolutions they were compiled for (see @ref gapi_meta_args). However, if the underlying backends allow, a compiled object can be reshaped to handle data (images) of different resolution, though formats and types must remain the same.
GCompiled is very similar to std::function<>
in its semantics –
running it looks like a function call in the user code.
At the moment, GCompiled objects are not reentrant – generally, the objects are stateful since graph execution itself is a stateful process and this state is now maintained in GCompiled’s own memory (not on the process stack).
At the same time, two different GCompiled objects produced from the single cv::GComputation are completely independent and can be used concurrently.
See also
GStreamingCompiled
Required Methods
fn as_raw_GCompiled(&self) -> *const c_void
Provided Methods
sourcefn to_bool(&self) -> Result<bool>
fn to_bool(&self) -> Result<bool>
Check if compiled object is valid (non-empty)
Returns
true if the object is runnable (valid), false otherwise
sourcefn can_reshape(&self) -> Result<bool>
fn can_reshape(&self) -> Result<bool>
Check if the underlying backends support reshape or not.
Returns
true if supported, false otherwise.