pub trait HfsSegmentTrait: AlgorithmTrait + HfsSegmentTraitConst {
Show 19 methods
// Required method
fn as_raw_mut_HfsSegment(&mut self) -> *mut c_void;
// Provided methods
fn set_seg_egb_threshold_i(&mut self, c: f32) -> Result<()> { ... }
fn get_seg_egb_threshold_i(&mut self) -> Result<f32> { ... }
fn set_min_region_size_i(&mut self, n: i32) -> Result<()> { ... }
fn get_min_region_size_i(&mut self) -> Result<i32> { ... }
fn set_seg_egb_threshold_ii(&mut self, c: f32) -> Result<()> { ... }
fn get_seg_egb_threshold_ii(&mut self) -> Result<f32> { ... }
fn set_min_region_size_ii(&mut self, n: i32) -> Result<()> { ... }
fn get_min_region_size_ii(&mut self) -> Result<i32> { ... }
fn set_spatial_weight(&mut self, w: f32) -> Result<()> { ... }
fn get_spatial_weight(&mut self) -> Result<f32> { ... }
fn set_slic_spixel_size(&mut self, n: i32) -> Result<()> { ... }
fn get_slic_spixel_size(&mut self) -> Result<i32> { ... }
fn set_num_slic_iter(&mut self, n: i32) -> Result<()> { ... }
fn get_num_slic_iter(&mut self) -> Result<i32> { ... }
fn perform_segment_gpu(
&mut self,
src: &impl ToInputArray,
if_draw: bool,
) -> Result<Mat> { ... }
fn perform_segment_gpu_def(
&mut self,
src: &impl ToInputArray,
) -> Result<Mat> { ... }
fn perform_segment_cpu(
&mut self,
src: &impl ToInputArray,
if_draw: bool,
) -> Result<Mat> { ... }
fn perform_segment_cpu_def(
&mut self,
src: &impl ToInputArray,
) -> Result<Mat> { ... }
}
Expand description
Mutable methods for crate::hfs::HfsSegment
Required Methods§
fn as_raw_mut_HfsSegment(&mut self) -> *mut c_void
Provided Methods§
sourcefn set_seg_egb_threshold_i(&mut self, c: f32) -> Result<()>
fn set_seg_egb_threshold_i(&mut self, c: f32) -> Result<()>
set and get the parameter segEgbThresholdI. This parameter is used in the second stage mentioned above. It is a constant used to threshold weights of the edge when merging adjacent nodes when applying EGB algorithm. The segmentation result tends to have more regions remained if this value is large and vice versa.
fn get_seg_egb_threshold_i(&mut self) -> Result<f32>
sourcefn set_min_region_size_i(&mut self, n: i32) -> Result<()>
fn set_min_region_size_i(&mut self, n: i32) -> Result<()>
set and get the parameter minRegionSizeI. This parameter is used in the second stage mentioned above. After the EGB segmentation, regions that have fewer pixels then this parameter will be merged into it’s adjacent region.
fn get_min_region_size_i(&mut self) -> Result<i32>
sourcefn set_seg_egb_threshold_ii(&mut self, c: f32) -> Result<()>
fn set_seg_egb_threshold_ii(&mut self, c: f32) -> Result<()>
set and get the parameter segEgbThresholdII. This parameter is used in the third stage mentioned above. It serves the same purpose as segEgbThresholdI. The segmentation result tends to have more regions remained if this value is large and vice versa.
fn get_seg_egb_threshold_ii(&mut self) -> Result<f32>
sourcefn set_min_region_size_ii(&mut self, n: i32) -> Result<()>
fn set_min_region_size_ii(&mut self, n: i32) -> Result<()>
set and get the parameter minRegionSizeII. This parameter is used in the third stage mentioned above. It serves the same purpose as minRegionSizeI
fn get_min_region_size_ii(&mut self) -> Result<i32>
sourcefn set_spatial_weight(&mut self, w: f32) -> Result<()>
fn set_spatial_weight(&mut self, w: f32) -> Result<()>
set and get the parameter spatialWeight.
This parameter is used in the first stage
mentioned above(the SLIC stage). It describes how important is the role
of position when calculating the distance between each pixel and it’s
center. The exact formula to calculate the distance is
.
The segmentation result tends to have more local consistency
if this value is larger.
fn get_spatial_weight(&mut self) -> Result<f32>
sourcefn set_slic_spixel_size(&mut self, n: i32) -> Result<()>
fn set_slic_spixel_size(&mut self, n: i32) -> Result<()>
set and get the parameter slicSpixelSize.
This parameter is used in the first stage mentioned
above(the SLIC stage). It describes the size of each
superpixel when initializing SLIC. Every superpixel
approximately has
pixels in the beginning.
fn get_slic_spixel_size(&mut self) -> Result<i32>
sourcefn set_num_slic_iter(&mut self, n: i32) -> Result<()>
fn set_num_slic_iter(&mut self, n: i32) -> Result<()>
set and get the parameter numSlicIter. This parameter is used in the first stage. It describes how many iteration to perform when executing SLIC.
fn get_num_slic_iter(&mut self) -> Result<i32>
sourcefn perform_segment_gpu(
&mut self,
src: &impl ToInputArray,
if_draw: bool,
) -> Result<Mat>
fn perform_segment_gpu( &mut self, src: &impl ToInputArray, if_draw: bool, ) -> Result<Mat>
do segmentation gpu
§Parameters
- src: : the input image
- ifDraw: : if draw the image in the returned Mat. if this parameter is false, then the content of the returned Mat is a matrix of index, describing the region each pixel belongs to. And it’s data type is CV_16U. If this parameter is true, then the returned Mat is a segmented picture, and color of each region is the average color of all pixels in that region. And it’s data type is the same as the input image
§C++ default parameters
- if_draw: true
sourcefn perform_segment_gpu_def(&mut self, src: &impl ToInputArray) -> Result<Mat>
fn perform_segment_gpu_def(&mut self, src: &impl ToInputArray) -> Result<Mat>
do segmentation gpu
§Parameters
- src: : the input image
- ifDraw: : if draw the image in the returned Mat. if this parameter is false, then the content of the returned Mat is a matrix of index, describing the region each pixel belongs to. And it’s data type is CV_16U. If this parameter is true, then the returned Mat is a segmented picture, and color of each region is the average color of all pixels in that region. And it’s data type is the same as the input image
§Note
This alternative version of HfsSegmentTrait::perform_segment_gpu function uses the following default values for its arguments:
- if_draw: true
sourcefn perform_segment_cpu(
&mut self,
src: &impl ToInputArray,
if_draw: bool,
) -> Result<Mat>
fn perform_segment_cpu( &mut self, src: &impl ToInputArray, if_draw: bool, ) -> Result<Mat>
do segmentation with cpu This method is only implemented for reference. It is highly NOT recommanded to use it.
§C++ default parameters
- if_draw: true
sourcefn perform_segment_cpu_def(&mut self, src: &impl ToInputArray) -> Result<Mat>
fn perform_segment_cpu_def(&mut self, src: &impl ToInputArray) -> Result<Mat>
do segmentation with cpu This method is only implemented for reference. It is highly NOT recommanded to use it.
§Note
This alternative version of HfsSegmentTrait::perform_segment_cpu function uses the following default values for its arguments:
- if_draw: true