[−][src]Trait opencv::dnn::ModelTrait
This class is presented high-level API for neural networks.
Model allows to set params for preprocessing input image. Model creates net from file with trained weights and config, sets preprocessing input and runs forward pass.
Required methods
pub fn as_raw_Model(&self) -> *const c_void
[src]
pub fn as_raw_mut_Model(&mut self) -> *mut c_void
[src]
Provided methods
pub fn set_input_size(&mut self, size: Size) -> Result<Model>
[src]
Set input size for frame.
Parameters
- size: New input size.
Note: If shape of the new blob less than 0, then frame size not change.
pub fn set_input_size_1(&mut self, width: i32, height: i32) -> Result<Model>
[src]
Set input size for frame.
Parameters
- size: New input size.
Note: If shape of the new blob less than 0, then frame size not change.
Overloaded parameters
- width: New input width.
- height: New input height.
pub fn set_input_mean(&mut self, mean: Scalar) -> Result<Model>
[src]
Set mean value for frame.
Parameters
- mean: Scalar with mean values which are subtracted from channels.
pub fn set_input_scale(&mut self, scale: f64) -> Result<Model>
[src]
pub fn set_input_crop(&mut self, crop: bool) -> Result<Model>
[src]
Set flag crop for frame.
Parameters
- crop: Flag which indicates whether image will be cropped after resize or not.
pub fn set_input_swap_rb(&mut self, swap_rb: bool) -> Result<Model>
[src]
Set flag swapRB for frame.
Parameters
- swapRB: Flag which indicates that swap first and last channels.
pub fn set_input_params(
&mut self,
scale: f64,
size: Size,
mean: Scalar,
swap_rb: bool,
crop: bool
) -> Result<()>
[src]
&mut self,
scale: f64,
size: Size,
mean: Scalar,
swap_rb: bool,
crop: bool
) -> Result<()>
Set preprocessing parameters for frame.
Parameters
- size: New input size.
- mean: Scalar with mean values which are subtracted from channels.
- scale: Multiplier for frame values.
- swapRB: Flag which indicates that swap first and last channels.
- crop: Flag which indicates whether image will be cropped after resize or not. blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )
C++ default parameters
- scale: 1.0
- size: Size()
- mean: Scalar()
- swap_rb: false
- crop: false
pub fn predict(
&self,
frame: &dyn ToInputArray,
outs: &mut dyn ToOutputArray
) -> Result<()>
[src]
&self,
frame: &dyn ToInputArray,
outs: &mut dyn ToOutputArray
) -> Result<()>
Given the @p input frame, create input blob, run net and return the output @p blobs.
Parameters
- frame: The input image.
- outs:[out] Allocated output blobs, which will store results of the computation.
pub fn set_preferable_backend(&mut self, backend_id: Backend) -> Result<Model>
[src]
See also
Net::setPreferableBackend
pub fn set_preferable_target(&mut self, target_id: Target) -> Result<Model>
[src]
See also
Net::setPreferableTarget