Skip to content

ximgproc_createScanSegment

Extended image processingfunctionOpenCV 5.0.0
import { ximgproc_createScanSegment } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSimage_width, image_height, num_superpixels, slices
FUNCTIONximgproc_createScanSegment
RETURN TYPEximgproc_ScanSegment | null
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

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.

ximgproc_createScanSegment(image_width: number, image_height: number, num_superpixels: number, slices: number, merge_small: boolean): ximgproc_ScanSegment | null;
3 available overloads
ximgproc_createScanSegment(image_width: number, image_height: number, num_superpixels: number): ximgproc_ScanSegment | null;
ximgproc_createScanSegment(image_width: number, image_height: number, num_superpixels: number, slices: number): ximgproc_ScanSegment | null;
ximgproc_createScanSegment(image_width: number, image_height: number, num_superpixels: number, slices: number, merge_small: boolean): ximgproc_ScanSegment | null;
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.

Returns

The ximgproc_ScanSegment | null result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.