Method Create
- Namespace
- OpenCvSharp.XImgProc
- Assembly
- OpenCvSharp.dll
Create(int, int, int, int, bool)
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.
public static ScanSegment Create(int imageWidth, int imageHeight, int numSuperpixels, int slices = 8, bool mergeSmall = true)
Parameters
imageWidthintImage width.
imageHeightintImage height.
numSuperpixelsintDesired 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.
slicesintNumber 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.
mergeSmallboolMerge 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.