Skip to content

ximgproc_createSuperpixelSLIC

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

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

Initialize a SuperpixelSLIC object

ximgproc_createSuperpixelSLIC(image: Mat, algorithm: number, region_size: number, ruler: number): ximgproc_SuperpixelSLIC | null;
4 available overloads
ximgproc_createSuperpixelSLIC(image: Mat): ximgproc_SuperpixelSLIC | null;
ximgproc_createSuperpixelSLIC(image: Mat, algorithm: number): ximgproc_SuperpixelSLIC | null;
ximgproc_createSuperpixelSLIC(image: Mat, algorithm: number, region_size: number): ximgproc_SuperpixelSLIC | null;
ximgproc_createSuperpixelSLIC(image: Mat, algorithm: number, region_size: number, ruler: number): ximgproc_SuperpixelSLIC | null;
image

Image to segment

algorithm

Chooses the algorithm variant to use: SLIC segments image using a desired region_size, and in addition SLICO will optimize using adaptive compactness factor, while MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels.

region_size

Chooses an average superpixel size measured in pixels

ruler

Chooses the enforcement of superpixel smoothness factor of superpixel

The function initializes a SuperpixelSLIC object for the input image. It sets the parameters of choosed superpixel algorithm, which are: region_size and ruler. It preallocate some buffers for future computing iterations over the given image. For enanched results it is recommended for color images to preprocess image with little gaussian blur using a small 3 x 3 kernel and additional conversion into CieLAB color space. An example of SLIC versus SLICO and MSLIC is ilustrated in the following picture.

image

Returns

The ximgproc_SuperpixelSLIC | 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.