Skip to content

DISK

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

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

ARGUMENTSConstructor or factory
CLASSDISK
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

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

DISK feature detector and descriptor, based on a DNN model.

DISK (Deep Image Structure and Keypoints) is a learned local-feature pipeline that produces keypoints and 128-D L2-normalized descriptors via a single forward pass through a fully convolutional network. This class wraps an ONNX export of the pre-trained DISK model through cv::dnn::Net and exposes it under the standard cv::Feature2D interface so it can be used as a drop-in alternative to SIFT/ORB.

The class assumes the ONNX model has a single input named image taking an N×3×H×W float32 tensor in [0, 1] (RGB channel order) and three outputs named keypoints (N×2), scores (N) and descriptors (N×128).

Constructors and members

static create

Creates a DISK detector.

create(modelPath: EmbindString, maxKeypoints: number, scoreThreshold: number, imageSize: Size, backendId: number, targetId: number): DISK | null;
6 available overloads
create(modelPath: EmbindString): DISK | null;
create(modelPath: EmbindString, maxKeypoints: number): DISK | null;
create(modelPath: EmbindString, maxKeypoints: number, scoreThreshold: number): DISK | null;
create(modelPath: EmbindString, maxKeypoints: number, scoreThreshold: number, imageSize: Size): DISK | null;
create(modelPath: EmbindString, maxKeypoints: number, scoreThreshold: number, imageSize: Size, backendId: number): DISK | null;
create(modelPath: EmbindString, maxKeypoints: number, scoreThreshold: number, imageSize: Size, backendId: number, targetId: number): DISK | null;
modelPath

Path to the DISK ONNX model.

maxKeypoints

Maximum number of keypoints to return per image. The strongest responses (by network score) are kept; -1 keeps all detections.

scoreThreshold

Discard keypoints with network score strictly below this value.

imageSize

Target input size (width, height) fed to the network. Use Size() (the default) to fall back to the network's expected fixed input shape of 1024x1024. When overriding, both dimensions must be positive multiples of 16, since DISK downsamples by a factor of 16.

backendId

DNN backend identifier (see cv::dnn::Backend); 0 = DNN_BACKEND_DEFAULT.

targetId

DNN target identifier (see cv::dnn::Target); 0 = DNN_TARGET_CPU.

Returns

The DISK | null result.

static createFromMemory

Creates a DISK detector from an in-memory model buffer.

This overload loads the DISK ONNX model from a buffer instead of a file on disk. It is
intended for cases where the model is read from application resources (for example Android
assets) and is not available as a path on the filesystem.

Note: In C++ this is an overload of create. The Python/Java/Objective-C bindings expose it as createFromMemory, because Objective-C selectors are not disambiguated by argument type and would otherwise clash with the file-path create.

createFromMemory(bufferModel: ucharVector, maxKeypoints: number, scoreThreshold: number, imageSize: Size, backendId: number, targetId: number): DISK | null;
6 available overloads
createFromMemory(bufferModel: ucharVector): DISK | null;
createFromMemory(bufferModel: ucharVector, maxKeypoints: number): DISK | null;
createFromMemory(bufferModel: ucharVector, maxKeypoints: number, scoreThreshold: number): DISK | null;
createFromMemory(bufferModel: ucharVector, maxKeypoints: number, scoreThreshold: number, imageSize: Size): DISK | null;
createFromMemory(bufferModel: ucharVector, maxKeypoints: number, scoreThreshold: number, imageSize: Size, backendId: number): DISK | null;
createFromMemory(bufferModel: ucharVector, maxKeypoints: number, scoreThreshold: number, imageSize: Size, backendId: number, targetId: number): DISK | null;
bufferModel

A buffer containing the contents of the DISK ONNX model.

maxKeypoints

Maximum number of keypoints to return per image. The strongest responses (by network score) are kept; -1 keeps all detections.

scoreThreshold

Discard keypoints with network score strictly below this value.

imageSize

Target input size (width, height) fed to the network. Use Size() (the default) to fall back to the network's expected fixed input shape of 1024x1024. When overriding, both dimensions must be positive multiples of 16, since DISK downsamples by a factor of 16.

backendId

DNN backend identifier (see cv::dnn::Backend); 0 = DNN_BACKEND_DEFAULT.

targetId

DNN target identifier (see cv::dnn::Target); 0 = DNN_TARGET_CPU.

Returns

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

setMaxKeypoints

Set the max keypoints used by this DISK object.

setMaxKeypoints(maxKeypoints: number): void;
maxKeypoints

max keypoints argument (number).

getMaxKeypoints

Return the max keypoints configured on this DISK object.

getMaxKeypoints(): number;
Returns

The number result.

setScoreThreshold

Set the score threshold used by this DISK object.

setScoreThreshold(threshold: number): void;
threshold

threshold argument (number).

getScoreThreshold

Return the score threshold configured on this DISK object.

getScoreThreshold(): number;
Returns

The number result.

setImageSize

Set the image size used by this DISK object.

setImageSize(size: Size): void;
size

size argument (Size).

getImageSize

Return the image size configured on this DISK object.

getImageSize(): Size;
Returns

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

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.