pub trait IntelligentScissorsMBTrait: IntelligentScissorsMBTraitConst {
// Required method
fn as_raw_mut_IntelligentScissorsMB(&mut self) -> *mut c_void;
// Provided methods
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_gradient_magnitude_max_limit_def(
&mut self,
) -> Result<IntelligentScissorsMB> { ... }
fn set_edge_feature_zero_crossing_parameters(
&mut self,
gradient_magnitude_min_value: f32,
) -> Result<IntelligentScissorsMB> { ... }
fn set_edge_feature_zero_crossing_parameters_def(
&mut self,
) -> Result<IntelligentScissorsMB> { ... }
fn set_edge_feature_canny_parameters(
&mut self,
threshold1: f64,
threshold2: f64,
aperture_size: i32,
l2gradient: bool,
) -> Result<IntelligentScissorsMB> { ... }
fn set_edge_feature_canny_parameters_def(
&mut self,
threshold1: f64,
threshold2: f64,
) -> Result<IntelligentScissorsMB> { ... }
fn apply_image(
&mut self,
image: &impl ToInputArray,
) -> Result<IntelligentScissorsMB> { ... }
fn apply_image_features(
&mut self,
non_edge: &impl ToInputArray,
gradient_direction: &impl ToInputArray,
gradient_magnitude: &impl ToInputArray,
image: &impl ToInputArray,
) -> Result<IntelligentScissorsMB> { ... }
fn apply_image_features_def(
&mut self,
non_edge: &impl ToInputArray,
gradient_direction: &impl ToInputArray,
gradient_magnitude: &impl ToInputArray,
) -> Result<IntelligentScissorsMB> { ... }
fn build_map(&mut self, source_pt: Point) -> Result<()> { ... }
}
Expand description
Mutable methods for crate::imgproc::IntelligentScissorsMB
Required Methods§
fn as_raw_mut_IntelligentScissorsMB(&mut self) -> *mut c_void
Provided Methods§
Sourcefn set_weights(
&mut self,
weight_non_edge: f32,
weight_gradient_direction: f32,
weight_gradient_magnitude: f32,
) -> Result<IntelligentScissorsMB>
fn set_weights( &mut self, weight_non_edge: f32, weight_gradient_direction: f32, weight_gradient_magnitude: f32, ) -> Result<IntelligentScissorsMB>
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)
Sourcefn set_gradient_magnitude_max_limit(
&mut self,
gradient_magnitude_threshold_max: f32,
) -> Result<IntelligentScissorsMB>
fn set_gradient_magnitude_max_limit( &mut self, gradient_magnitude_threshold_max: f32, ) -> Result<IntelligentScissorsMB>
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
Sourcefn set_gradient_magnitude_max_limit_def(
&mut self,
) -> Result<IntelligentScissorsMB>
fn set_gradient_magnitude_max_limit_def( &mut self, ) -> Result<IntelligentScissorsMB>
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)
§Note
This alternative version of IntelligentScissorsMBTrait::set_gradient_magnitude_max_limit function uses the following default values for its arguments:
- gradient_magnitude_threshold_max: 0.0f
Sourcefn set_edge_feature_zero_crossing_parameters(
&mut self,
gradient_magnitude_min_value: f32,
) -> Result<IntelligentScissorsMB>
fn set_edge_feature_zero_crossing_parameters( &mut self, gradient_magnitude_min_value: f32, ) -> Result<IntelligentScissorsMB>
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
Sourcefn set_edge_feature_zero_crossing_parameters_def(
&mut self,
) -> Result<IntelligentScissorsMB>
fn set_edge_feature_zero_crossing_parameters_def( &mut self, ) -> Result<IntelligentScissorsMB>
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)
§Note
This alternative version of IntelligentScissorsMBTrait::set_edge_feature_zero_crossing_parameters function uses the following default values for its arguments:
- gradient_magnitude_min_value: 0.0f
Sourcefn set_edge_feature_canny_parameters(
&mut self,
threshold1: f64,
threshold2: f64,
aperture_size: i32,
l2gradient: bool,
) -> Result<IntelligentScissorsMB>
fn set_edge_feature_canny_parameters( &mut self, threshold1: f64, threshold2: f64, aperture_size: i32, l2gradient: bool, ) -> Result<IntelligentScissorsMB>
Sourcefn set_edge_feature_canny_parameters_def(
&mut self,
threshold1: f64,
threshold2: f64,
) -> Result<IntelligentScissorsMB>
fn set_edge_feature_canny_parameters_def( &mut self, threshold1: f64, threshold2: f64, ) -> Result<IntelligentScissorsMB>
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
§Note
This alternative version of IntelligentScissorsMBTrait::set_edge_feature_canny_parameters function uses the following default values for its arguments:
- aperture_size: 3
- l2gradient: false
Sourcefn apply_image(
&mut self,
image: &impl ToInputArray,
) -> Result<IntelligentScissorsMB>
fn apply_image( &mut self, image: &impl ToInputArray, ) -> Result<IntelligentScissorsMB>
Specify input image and extract image features
§Parameters
- image: input image. Type is [CV_8UC1] / #CV_8UC3
Sourcefn apply_image_features(
&mut self,
non_edge: &impl ToInputArray,
gradient_direction: &impl ToInputArray,
gradient_magnitude: &impl ToInputArray,
image: &impl ToInputArray,
) -> Result<IntelligentScissorsMB>
fn apply_image_features( &mut self, non_edge: &impl ToInputArray, gradient_direction: &impl ToInputArray, gradient_magnitude: &impl ToInputArray, image: &impl ToInputArray, ) -> Result<IntelligentScissorsMB>
Specify custom features of input 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()
Sourcefn apply_image_features_def(
&mut self,
non_edge: &impl ToInputArray,
gradient_direction: &impl ToInputArray,
gradient_magnitude: &impl ToInputArray,
) -> Result<IntelligentScissorsMB>
fn apply_image_features_def( &mut self, non_edge: &impl ToInputArray, gradient_direction: &impl ToInputArray, gradient_magnitude: &impl ToInputArray, ) -> Result<IntelligentScissorsMB>
Specify custom features of input 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)
§Note
This alternative version of IntelligentScissorsMBTrait::apply_image_features function uses the following default values for its arguments:
- image: noArray()
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.