pub struct GCompiled { /* private fields */ }
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 [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 [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
Implementations§
Trait Implementations§
Source§impl Boxed for GCompiled
impl Boxed for GCompiled
Source§unsafe fn from_raw(ptr: <GCompiled as OpenCVFromExtern>::ExternReceive) -> Self
unsafe fn from_raw(ptr: <GCompiled as OpenCVFromExtern>::ExternReceive) -> Self
Source§fn into_raw(self) -> <GCompiled as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <GCompiled as OpenCVTypeExternContainer>::ExternSendMut
Source§fn as_raw(&self) -> <GCompiled as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <GCompiled as OpenCVTypeExternContainer>::ExternSend
Source§fn as_raw_mut(
&mut self,
) -> <GCompiled as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <GCompiled as OpenCVTypeExternContainer>::ExternSendMut
Source§impl GCompiledTrait for GCompiled
impl GCompiledTrait for GCompiled
fn as_raw_mut_GCompiled(&mut self) -> *mut c_void
Source§fn apply(&mut self, in_: impl MatTrait, out: &mut impl MatTrait) -> Result<()>
fn apply(&mut self, in_: impl MatTrait, out: &mut impl MatTrait) -> Result<()>
Source§fn apply_1(&mut self, in_: impl MatTrait, out: &mut Scalar) -> Result<()>
fn apply_1(&mut self, in_: impl MatTrait, out: &mut Scalar) -> Result<()>
Source§fn apply_2(
&mut self,
in1: impl MatTrait,
in2: impl MatTrait,
out: &mut impl MatTrait,
) -> Result<()>
fn apply_2( &mut self, in1: impl MatTrait, in2: impl MatTrait, out: &mut impl MatTrait, ) -> Result<()>
Source§fn apply_3(
&mut self,
in1: impl MatTrait,
in2: impl MatTrait,
out: &mut Scalar,
) -> Result<()>
fn apply_3( &mut self, in1: impl MatTrait, in2: impl MatTrait, out: &mut Scalar, ) -> Result<()>
Source§impl GCompiledTraitConst for GCompiled
impl GCompiledTraitConst for GCompiled
impl Send for GCompiled
Auto Trait Implementations§
impl Freeze for GCompiled
impl RefUnwindSafe for GCompiled
impl !Sync for GCompiled
impl Unpin for GCompiled
impl UnwindSafe for GCompiled
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold
. Read more