pub trait GCompiledTrait: GCompiledTraitConst {
// Required method
fn as_raw_mut_GCompiled(&mut self) -> *mut c_void;
// Provided methods
fn apply(
&mut self,
in_: impl MatTrait,
out: &mut impl MatTrait,
) -> Result<()> { ... }
fn apply_1(&mut self, in_: impl MatTrait, out: &mut Scalar) -> Result<()> { ... }
fn apply_2(
&mut self,
in1: impl MatTrait,
in2: impl MatTrait,
out: &mut impl MatTrait,
) -> Result<()> { ... }
fn apply_3(
&mut self,
in1: impl MatTrait,
in2: impl MatTrait,
out: &mut Scalar,
) -> Result<()> { ... }
fn apply_4(&mut self, ins: &Vector<Mat>, outs: &Vector<Mat>) -> Result<()> { ... }
fn prepare_for_new_stream(&mut self) -> Result<()> { ... }
}
Expand description
Mutable methods for crate::gapi::GCompiled
Required Methods§
fn as_raw_mut_GCompiled(&mut self) -> *mut c_void
Provided Methods§
Sourcefn apply(&mut self, in_: impl MatTrait, out: &mut impl MatTrait) -> Result<()>
fn apply(&mut self, in_: impl MatTrait, out: &mut impl MatTrait) -> Result<()>
Execute an unary computation
Run the compiled computation, a generic version.
§Parameters
- ins: vector of inputs to process.
- outs: vector of outputs to produce.
Input/output vectors must have the same number of elements as defined in the cv::GComputation protocol (at the moment of its construction). Shapes of elements also must conform to protocol (e.g. cv::Mat needs to be passed where cv::GMat has been declared as input, and so on). Run-time exception is generated otherwise.
Objects in output vector may remain empty (like cv::Mat) – G-API will automatically initialize output objects to proper formats.
Note: Don’t construct GRunArgs/GRunArgsP objects manually, use cv::gin()/cv::gout() wrappers instead.
§Overloaded parameters
- in: input cv::Mat for unary computation
- out: output cv::Mat for unary computation process.
Sourcefn apply_1(&mut self, in_: impl MatTrait, out: &mut Scalar) -> Result<()>
fn apply_1(&mut self, in_: impl MatTrait, out: &mut Scalar) -> Result<()>
Execute an unary computation
Run the compiled computation, a generic version.
§Parameters
- ins: vector of inputs to process.
- outs: vector of outputs to produce.
Input/output vectors must have the same number of elements as defined in the cv::GComputation protocol (at the moment of its construction). Shapes of elements also must conform to protocol (e.g. cv::Mat needs to be passed where cv::GMat has been declared as input, and so on). Run-time exception is generated otherwise.
Objects in output vector may remain empty (like cv::Mat) – G-API will automatically initialize output objects to proper formats.
Note: Don’t construct GRunArgs/GRunArgsP objects manually, use cv::gin()/cv::gout() wrappers instead.
§Overloaded parameters
- in: input cv::Mat for unary computation
- out: output cv::Scalar for unary computation process.
Sourcefn 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<()>
Execute a binary computation
Run the compiled computation, a generic version.
§Parameters
- ins: vector of inputs to process.
- outs: vector of outputs to produce.
Input/output vectors must have the same number of elements as defined in the cv::GComputation protocol (at the moment of its construction). Shapes of elements also must conform to protocol (e.g. cv::Mat needs to be passed where cv::GMat has been declared as input, and so on). Run-time exception is generated otherwise.
Objects in output vector may remain empty (like cv::Mat) – G-API will automatically initialize output objects to proper formats.
Note: Don’t construct GRunArgs/GRunArgsP objects manually, use cv::gin()/cv::gout() wrappers instead.
§Overloaded parameters
- in1: first input cv::Mat for binary computation
- in2: second input cv::Mat for binary computation
- out: output cv::Mat for binary computation process.
Sourcefn 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<()>
Execute an binary computation
Run the compiled computation, a generic version.
§Parameters
- ins: vector of inputs to process.
- outs: vector of outputs to produce.
Input/output vectors must have the same number of elements as defined in the cv::GComputation protocol (at the moment of its construction). Shapes of elements also must conform to protocol (e.g. cv::Mat needs to be passed where cv::GMat has been declared as input, and so on). Run-time exception is generated otherwise.
Objects in output vector may remain empty (like cv::Mat) – G-API will automatically initialize output objects to proper formats.
Note: Don’t construct GRunArgs/GRunArgsP objects manually, use cv::gin()/cv::gout() wrappers instead.
§Overloaded parameters
- in1: first input cv::Mat for binary computation
- in2: second input cv::Mat for binary computation
- out: output cv::Scalar for binary computation process.
Sourcefn apply_4(&mut self, ins: &Vector<Mat>, outs: &Vector<Mat>) -> Result<()>
fn apply_4(&mut self, ins: &Vector<Mat>, outs: &Vector<Mat>) -> Result<()>
Execute a computation with arbitrary number of inputs/outputs.
Run the compiled computation, a generic version.
§Parameters
- ins: vector of inputs to process.
- outs: vector of outputs to produce.
Input/output vectors must have the same number of elements as defined in the cv::GComputation protocol (at the moment of its construction). Shapes of elements also must conform to protocol (e.g. cv::Mat needs to be passed where cv::GMat has been declared as input, and so on). Run-time exception is generated otherwise.
Objects in output vector may remain empty (like cv::Mat) – G-API will automatically initialize output objects to proper formats.
Note: Don’t construct GRunArgs/GRunArgsP objects manually, use cv::gin()/cv::gout() wrappers instead.
§Overloaded parameters
- ins: vector of input cv::Mat objects to process by the computation.
- outs: vector of output cv::Mat objects to produce by the computation.
Numbers of elements in ins/outs vectors must match numbers of inputs/outputs which were used to define the source GComputation.
Sourcefn prepare_for_new_stream(&mut self) -> Result<()>
fn prepare_for_new_stream(&mut self) -> Result<()>
Prepare inner kernels states for a new video-stream.
GCompiled objects may be used to process video streams frame by frame. In this case, a GCompiled is called on every image frame individually. Starting OpenCV 4.4, some kernels in the graph may have their internal states (see GAPI_OCV_KERNEL_ST for the OpenCV backend). In this case, if user starts processing another video stream with this GCompiled, this method needs to be called to let kernels re-initialize their internal states to a new video stream.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.