[][src]Trait opencv::dnn::ModelTrait

pub trait ModelTrait {
    pub fn as_raw_Model(&self) -> *const c_void;
pub fn as_raw_mut_Model(&mut self) -> *mut c_void; pub fn set_input_size(&mut self, size: Size) -> Result<Model> { ... }
pub fn set_input_size_1(&mut self, width: i32, height: i32) -> Result<Model> { ... }
pub fn set_input_mean(&mut self, mean: Scalar) -> Result<Model> { ... }
pub fn set_input_scale(&mut self, scale: f64) -> Result<Model> { ... }
pub fn set_input_crop(&mut self, crop: bool) -> Result<Model> { ... }
pub fn set_input_swap_rb(&mut self, swap_rb: bool) -> Result<Model> { ... }
pub fn set_input_params(
        &mut self,
        scale: f64,
        size: Size,
        mean: Scalar,
        swap_rb: bool,
        crop: bool
    ) -> Result<()> { ... }
pub fn predict(
        &self,
        frame: &dyn ToInputArray,
        outs: &mut dyn ToOutputArray
    ) -> Result<()> { ... }
pub fn set_preferable_backend(
        &mut self,
        backend_id: Backend
    ) -> Result<Model> { ... }
pub fn set_preferable_target(&mut self, target_id: Target) -> Result<Model> { ... }
pub fn get_network_(&self) -> Result<Net> { ... }
pub fn get_network__1(&mut self) -> Result<Net> { ... } }

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

Loading content...

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]

Set scalefactor value for frame.

Parameters

  • scale: Multiplier for frame values.

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]

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]

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

pub fn get_network_(&self) -> Result<Net>[src]

pub fn get_network__1(&mut self) -> Result<Net>[src]

Loading content...

Implementors

impl ModelTrait for ClassificationModel[src]

impl ModelTrait for DetectionModel[src]

impl ModelTrait for KeypointsModel[src]

impl ModelTrait for Model[src]

impl ModelTrait for SegmentationModel[src]

impl ModelTrait for TextDetectionModel[src]

impl ModelTrait for TextDetectionModel_DB[src]

impl ModelTrait for TextDetectionModel_EAST[src]

impl ModelTrait for TextRecognitionModel[src]

Loading content...