Trait opencv::hub_prelude::IntelligentScissorsMBTrait[][src]

pub trait IntelligentScissorsMBTrait: IntelligentScissorsMBTraitConst {
    fn as_raw_mut_IntelligentScissorsMB(&mut self) -> *mut c_void;

    fn set_weights(
        &mut self,
        weight_non_edge: f32,
        weight_gradient_direction: f32,
        weight_gradient_magnitude: f32
    ) -> Result<IntelligentScissorsMB> { ... }
fn set_gradient_magnitude_max_limit(
        &mut self,
        gradient_magnitude_threshold_max: f32
    ) -> Result<IntelligentScissorsMB> { ... }
fn set_edge_feature_zero_crossing_parameters(
        &mut self,
        gradient_magnitude_min_value: f32
    ) -> Result<IntelligentScissorsMB> { ... }
fn set_edge_feature_canny_parameters(
        &mut self,
        threshold1: f64,
        threshold2: f64,
        aperture_size: i32,
        l2gradient: bool
    ) -> Result<IntelligentScissorsMB> { ... }
fn apply_image(
        &mut self,
        image: &dyn ToInputArray
    ) -> Result<IntelligentScissorsMB> { ... }
fn apply_image_features(
        &mut self,
        non_edge: &dyn ToInputArray,
        gradient_direction: &dyn ToInputArray,
        gradient_magnitude: &dyn ToInputArray,
        image: &dyn ToInputArray
    ) -> Result<IntelligentScissorsMB> { ... }
fn build_map(&mut self, source_pt: Point) -> Result<()> { ... } }

Required methods

Provided methods

Specify weights of feature functions

Consider keeping weights normalized (sum of weights equals to 1.0) Discrete dynamic programming (DP) goal is minimization of costs between pixels.

Parameters
  • weight_non_edge: Specify cost of non-edge pixels (default: 0.43f)
  • weight_gradient_direction: Specify cost of gradient direction function (default: 0.43f)
  • weight_gradient_magnitude: Specify cost of gradient magnitude function (default: 0.14f)

Specify gradient magnitude max value threshold

Zero limit value is used to disable gradient magnitude thresholding (default behavior, as described in original article). Otherwize pixels with gradient magnitude >= threshold have zero cost.

Note: Thresholding should be used for images with irregular regions (to avoid stuck on parameters from high-contract areas, like embedded logos).

Parameters
  • gradient_magnitude_threshold_max: Specify gradient magnitude max value threshold (default: 0, disabled)
C++ default parameters
  • gradient_magnitude_threshold_max: 0.0f

Switch to “Laplacian Zero-Crossing” edge feature extractor and specify its parameters

This feature extractor is used by default according to article.

Implementation has additional filtering for regions with low-amplitude noise. This filtering is enabled through parameter of minimal gradient amplitude (use some small value 4, 8, 16).

Note: Current implementation of this feature extractor is based on processing of grayscale images (color image is converted to grayscale image first).

Note: Canny edge detector is a bit slower, but provides better results (especially on color images): use setEdgeFeatureCannyParameters().

Parameters
  • gradient_magnitude_min_value: Minimal gradient magnitude value for edge pixels (default: 0, check is disabled)
C++ default parameters
  • gradient_magnitude_min_value: 0.0f

Switch edge feature extractor to use Canny edge detector

Note: “Laplacian Zero-Crossing” feature extractor is used by default (following to original article)

See also

Canny

C++ default parameters
  • aperture_size: 3
  • l2gradient: false

Specify input image and extract image features

Parameters
  • image: input image. Type is #CV_8UC1 / #CV_8UC3

Specify custom features of imput image

Customized advanced variant of applyImage() call.

Parameters
  • non_edge: Specify cost of non-edge pixels. Type is CV_8UC1. Expected values are {0, 1}.
  • gradient_direction: Specify gradient direction feature. Type is CV_32FC2. Values are expected to be normalized: x^2 + y^2 == 1
  • gradient_magnitude: Specify cost of gradient magnitude function: Type is CV_32FC1. Values should be in range [0, 1].
  • image: Optional parameter. Must be specified if subset of features is specified (non-specified features are calculated internally)
C++ default parameters
  • image: noArray()

Prepares a map of optimal paths for the given source point on the image

Note: applyImage() / applyImageFeatures() must be called before this call

Parameters
  • sourcePt: The source point used to find the paths

Implementors