Skip to content

SIFT

Features and matchingclassOpenCV 5.0.0
import { SIFT } from '@banou/opencv-wasm'

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

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits Feature2D.

Class for extracting keypoints and computing descriptors using the Scale Invariant Feature Transform (SIFT) algorithm by D. Lowe [Lowe04] .

Constructors and members

static create

Note: The contrast threshold will be divided by nOctaveLayers when the filtering is applied. When nOctaveLayers is set to default and if you want to use the value used in D. Lowe paper, 0.03, set this argument to 0.09.

create(nfeatures: number, nOctaveLayers: number, contrastThreshold: number, edgeThreshold: number, sigma: number, enable_precise_upscale: boolean): SIFT | null;
7 available overloads
create(): SIFT | null;
create(nfeatures: number): SIFT | null;
create(nfeatures: number, nOctaveLayers: number): SIFT | null;
create(nfeatures: number, nOctaveLayers: number, contrastThreshold: number): SIFT | null;
create(nfeatures: number, nOctaveLayers: number, contrastThreshold: number, edgeThreshold: number): SIFT | null;
create(nfeatures: number, nOctaveLayers: number, contrastThreshold: number, edgeThreshold: number, sigma: number): SIFT | null;
create(nfeatures: number, nOctaveLayers: number, contrastThreshold: number, edgeThreshold: number, sigma: number, enable_precise_upscale: boolean): SIFT | null;
nfeatures

The number of best features to retain. The features are ranked by their scores (measured in SIFT algorithm as the local contrast)

nOctaveLayers

The number of layers in each octave. 3 is the value used in D. Lowe paper. The number of octaves is computed automatically from the image resolution.

contrastThreshold

The contrast threshold used to filter out weak features in semi-uniform (low-contrast) regions. The larger the threshold, the less features are produced by the detector.

edgeThreshold

The threshold used to filter out edge-like features. Note that the its meaning is different from the contrastThreshold, i.e. the larger the edgeThreshold, the less features are filtered out (more features are retained).

sigma

The sigma of the Gaussian applied to the input image at the octave #0. If your image is captured with a weak camera with soft lenses, you might want to reduce the number.

enable_precise_upscale

Whether to enable precise upscaling in the scale pyramid, which maps index \texttt{x} to \texttt{2x}. This prevents localization bias. The option is disabled by default.

Returns

The SIFT | null result.

static create1

Create SIFT with specified descriptorType.

Note: The contrast threshold will be divided by nOctaveLayers when the filtering is applied. When nOctaveLayers is set to default and if you want to use the value used in D. Lowe paper, 0.03, set this argument to 0.09.

create1(nfeatures: number, nOctaveLayers: number, contrastThreshold: number, edgeThreshold: number, sigma: number, descriptorType: number, enable_precise_upscale: boolean): SIFT | null;
2 available overloads
create1(nfeatures: number, nOctaveLayers: number, contrastThreshold: number, edgeThreshold: number, sigma: number, descriptorType: number): SIFT | null;
create1(nfeatures: number, nOctaveLayers: number, contrastThreshold: number, edgeThreshold: number, sigma: number, descriptorType: number, enable_precise_upscale: boolean): SIFT | null;
nfeatures

The number of best features to retain. The features are ranked by their scores (measured in SIFT algorithm as the local contrast)

nOctaveLayers

The number of layers in each octave. 3 is the value used in D. Lowe paper. The number of octaves is computed automatically from the image resolution.

contrastThreshold

The contrast threshold used to filter out weak features in semi-uniform (low-contrast) regions. The larger the threshold, the less features are produced by the detector.

edgeThreshold

The threshold used to filter out edge-like features. Note that the its meaning is different from the contrastThreshold, i.e. the larger the edgeThreshold, the less features are filtered out (more features are retained).

sigma

The sigma of the Gaussian applied to the input image at the octave #0. If your image is captured with a weak camera with soft lenses, you might want to reduce the number.

descriptorType

The type of descriptors. Only CV_32F and CV_8U are supported.

enable_precise_upscale

Whether to enable precise upscaling in the scale pyramid, which maps index \texttt{x} to \texttt{2x}. This prevents localization bias. The option is disabled by default.

Returns

The SIFT | null result.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

getDefaultName

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.

getDefaultName(): string;
Returns

The string result.

setNFeatures

Set the nfeatures used by this SIFT object.

setNFeatures(maxFeatures: number): void;
maxFeatures

max features argument (number).

getNFeatures

Return the nfeatures configured on this SIFT object.

getNFeatures(): number;
Returns

The number result.

setNOctaveLayers

Set the noctave layers used by this SIFT object.

setNOctaveLayers(nOctaveLayers: number): void;
nOctaveLayers

n octave layers argument (number).

getNOctaveLayers

Return the noctave layers configured on this SIFT object.

getNOctaveLayers(): number;
Returns

The number result.

setContrastThreshold

Set the contrast threshold used by this SIFT object.

setContrastThreshold(contrastThreshold: number): void;
contrastThreshold

contrast threshold argument (number).

getContrastThreshold

Return the contrast threshold configured on this SIFT object.

getContrastThreshold(): number;
Returns

The number result.

setEdgeThreshold

Set the edge threshold used by this SIFT object.

setEdgeThreshold(edgeThreshold: number): void;
edgeThreshold

edge threshold argument (number).

getEdgeThreshold

Return the edge threshold configured on this SIFT object.

getEdgeThreshold(): number;
Returns

The number result.

setSigma

Set the sigma used by this SIFT object.

setSigma(sigma: number): void;
sigma

sigma argument (number).

getSigma

Return the sigma configured on this SIFT object.

getSigma(): number;
Returns

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