ximgproc_createSuperpixelSEEDS
import { ximgproc_createSuperpixelSEEDS } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Initializes a SuperpixelSEEDS object.
ximgproc_createSuperpixelSEEDS(image_width: number, image_height: number, image_channels: number, num_superpixels: number, num_levels: number, prior: number, histogram_bins: number, double_step: boolean): ximgproc_SuperpixelSEEDS | null;4 available overloads
ximgproc_createSuperpixelSEEDS(image_width: number, image_height: number, image_channels: number, num_superpixels: number, num_levels: number): ximgproc_SuperpixelSEEDS | null;ximgproc_createSuperpixelSEEDS(image_width: number, image_height: number, image_channels: number, num_superpixels: number, num_levels: number, prior: number): ximgproc_SuperpixelSEEDS | null;ximgproc_createSuperpixelSEEDS(image_width: number, image_height: number, image_channels: number, num_superpixels: number, num_levels: number, prior: number, histogram_bins: number): ximgproc_SuperpixelSEEDS | null;ximgproc_createSuperpixelSEEDS(image_width: number, image_height: number, image_channels: number, num_superpixels: number, num_levels: number, prior: number, histogram_bins: number, double_step: boolean): ximgproc_SuperpixelSEEDS | null;image_widthImage width.
image_heightImage height.
image_channelsNumber of channels of the image.
num_superpixelsDesired number of superpixels. Note that the actual number may be smaller due to restrictions (depending on the image size and num_levels). Use getNumberOfSuperpixels() to get the actual number.
num_levelsNumber of block levels. The more levels, the more accurate is the segmentation, but needs more memory and CPU time.
priorenable 3x3 shape smoothing term if >0. A larger value leads to smoother shapes. prior must be in the range [0, 5].
histogram_binsNumber of histogram bins.
double_stepIf true, iterate each block level twice for higher accuracy.
The function initializes a SuperpixelSEEDS object for the input image. It stores the parameters of the image: image_width, image_height and image_channels. It also sets the parameters of the SEEDS superpixel algorithm, which are: num_superpixels, num_levels, use_prior, histogram_bins and double_step.
The number of levels in num_levels defines the amount of block levels that the algorithm use in the optimization. The initialization is a grid, in which the superpixels are equally distributed through the width and the height of the image. The larger blocks correspond to the superpixel size, and the levels with smaller blocks are formed by dividing the larger blocks into 2 x 2 blocks of pixels, recursively until the smaller block level. An example of initialization of 4 block levels is illustrated in the following figure.

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