pub fn create_scan_segment(
    image_width: i32,
    image_height: i32,
    num_superpixels: i32,
    slices: i32,
    merge_small: bool
) -> Result<Ptr<dyn ScanSegment>>
Expand description

Initializes a ScanSegment object.

The function initializes a ScanSegment object for the input image. It stores the parameters of the image: image_width and image_height. It also sets the parameters of the F-DBSCAN superpixel algorithm, which are: num_superpixels, threads, and merge_small.

Parameters

  • image_width: Image width.
  • image_height: Image height.
  • num_superpixels: Desired number of superpixels. Note that the actual number may be smaller due to restrictions (depending on the image size). Use getNumberOfSuperpixels() to get the actual number.
  • slices: Number of processing threads for parallelisation. Setting -1 uses the maximum number of threads. In practice, four threads is enough for smaller images and eight threads for larger ones.
  • merge_small: merge small segments to give the desired number of superpixels. Processing is much faster without merging, but many small segments will be left in the image.

C++ default parameters

  • slices: 8
  • merge_small: true