Struct GCompiled

Source
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§

Source§

impl GCompiled

Source

pub fn default() -> Result<GCompiled>

Constructs an empty object

Trait Implementations§

Source§

impl Boxed for GCompiled

Source§

unsafe fn from_raw(ptr: <GCompiled as OpenCVFromExtern>::ExternReceive) -> Self

Wrap the specified raw pointer Read more
Source§

fn into_raw(self) -> <GCompiled as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying raw pointer while consuming this wrapper. Read more
Source§

fn as_raw(&self) -> <GCompiled as OpenCVTypeExternContainer>::ExternSend

Return the underlying raw pointer. Read more
Source§

fn as_raw_mut( &mut self, ) -> <GCompiled as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying mutable raw pointer Read more
Source§

impl Debug for GCompiled

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for GCompiled

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl GCompiledTrait for GCompiled

Source§

fn as_raw_mut_GCompiled(&mut self) -> *mut c_void

Source§

fn apply(&mut self, in_: impl MatTrait, out: &mut impl MatTrait) -> Result<()>

Execute an unary computation Read more
Source§

fn apply_1(&mut self, in_: impl MatTrait, out: &mut Scalar) -> Result<()>

Execute an unary computation Read more
Source§

fn apply_2( &mut self, in1: impl MatTrait, in2: impl MatTrait, out: &mut impl MatTrait, ) -> Result<()>

Execute a binary computation Read more
Source§

fn apply_3( &mut self, in1: impl MatTrait, in2: impl MatTrait, out: &mut Scalar, ) -> Result<()>

Execute an binary computation Read more
Source§

fn apply_4(&mut self, ins: &Vector<Mat>, outs: &Vector<Mat>) -> Result<()>

Execute a computation with arbitrary number of inputs/outputs. Read more
Source§

fn prepare_for_new_stream(&mut self) -> Result<()>

Prepare inner kernels states for a new video-stream. Read more
Source§

impl GCompiledTraitConst for GCompiled

Source§

fn as_raw_GCompiled(&self) -> *const c_void

Source§

fn to_bool(&self) -> Result<bool>

Check if compiled object is valid (non-empty) Read more
Source§

fn can_reshape(&self) -> Result<bool>

Check if the underlying backends support reshape or not. Read more
Source§

impl Send for GCompiled

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Mat> ModifyInplace for Mat
where Mat: Boxed,

Source§

unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res

Helper function to call OpenCV functions that allow in-place modification of a 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.