Class DISK
java.lang.Object
org.opencv.core.Algorithm
org.opencv.features.Feature2D
org.opencv.features.DISK
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).-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DISK__fromPtr__(long addr) static DISKCreates a DISK detector.static DISKCreates a DISK detector.static DISKCreates a DISK detector.static DISKCreates a DISK detector.static DISKCreates a DISK detector.static DISKcreate(String modelPath, int maxKeypoints, float scoreThreshold, Size imageSize, int backendId, int targetId) Creates a DISK detector.static DISKcreateFromMemory(MatOfByte bufferModel) Creates a DISK detector from an in-memory model buffer.static DISKcreateFromMemory(MatOfByte bufferModel, int maxKeypoints) Creates a DISK detector from an in-memory model buffer.static DISKcreateFromMemory(MatOfByte bufferModel, int maxKeypoints, float scoreThreshold) Creates a DISK detector from an in-memory model buffer.static DISKcreateFromMemory(MatOfByte bufferModel, int maxKeypoints, float scoreThreshold, Size imageSize) Creates a DISK detector from an in-memory model buffer.static DISKcreateFromMemory(MatOfByte bufferModel, int maxKeypoints, float scoreThreshold, Size imageSize, int backendId) Creates a DISK detector from an in-memory model buffer.static DISKcreateFromMemory(MatOfByte bufferModel, int maxKeypoints, float scoreThreshold, Size imageSize, int backendId, int targetId) Creates a DISK detector from an in-memory model buffer.Returns the algorithm string identifier.intfloatvoidsetImageSize(Size size) voidsetMaxKeypoints(int maxKeypoints) voidsetScoreThreshold(float threshold) Methods inherited from class Feature2D
compute, compute, defaultNorm, descriptorSize, descriptorType, detect, detect, detect, detect, detectAndCompute, detectAndCompute, empty, read, writeMethods inherited from class Algorithm
clear, getNativeObjAddr, save
-
Constructor Details
-
DISK
protected DISK(long addr)
-
-
Method Details
-
__fromPtr__
-
create
public static DISK create(String modelPath, int maxKeypoints, float scoreThreshold, Size imageSize, int backendId, int targetId) Creates a DISK detector.- Parameters:
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:
- automatically generated
-
create
public static DISK create(String modelPath, int maxKeypoints, float scoreThreshold, Size imageSize, int backendId) Creates a DISK detector.- Parameters:
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.- Returns:
- automatically generated
-
create
Creates a DISK detector.- Parameters:
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.- Returns:
- automatically generated
-
create
Creates a DISK detector.- Parameters:
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. (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.- Returns:
- automatically generated
-
create
Creates a DISK detector.- Parameters:
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. (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.- Returns:
- automatically generated
-
create
Creates a DISK detector.- Parameters:
modelPath- Path to the DISK ONNX model. responses (by network score) are kept; -1 keeps all detections. (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.- Returns:
- automatically generated
-
createFromMemory
public static DISK createFromMemory(MatOfByte bufferModel, int maxKeypoints, float scoreThreshold, Size imageSize, int backendId, int targetId) 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.- Parameters:
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. Note: In C++ this is an overload of REF: create. The Python/Java/Objective-C bindings expose it ascreateFromMemory, because Objective-C selectors are not disambiguated by argument type and would otherwise clash with the file-path REF: create.- Returns:
- automatically generated
-
createFromMemory
public static DISK createFromMemory(MatOfByte bufferModel, int maxKeypoints, float scoreThreshold, Size imageSize, int backendId) 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.- Parameters:
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. Note: In C++ this is an overload of REF: create. The Python/Java/Objective-C bindings expose it ascreateFromMemory, because Objective-C selectors are not disambiguated by argument type and would otherwise clash with the file-path REF: create.- Returns:
- automatically generated
-
createFromMemory
public static DISK createFromMemory(MatOfByte bufferModel, int maxKeypoints, float scoreThreshold, Size imageSize) 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.- Parameters:
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. Note: In C++ this is an overload of REF: create. The Python/Java/Objective-C bindings expose it ascreateFromMemory, because Objective-C selectors are not disambiguated by argument type and would otherwise clash with the file-path REF: create.- Returns:
- automatically generated
-
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.- Parameters:
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. (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. Note: In C++ this is an overload of REF: create. The Python/Java/Objective-C bindings expose it ascreateFromMemory, because Objective-C selectors are not disambiguated by argument type and would otherwise clash with the file-path REF: create.- Returns:
- automatically generated
-
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.- Parameters:
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. (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. Note: In C++ this is an overload of REF: create. The Python/Java/Objective-C bindings expose it ascreateFromMemory, because Objective-C selectors are not disambiguated by argument type and would otherwise clash with the file-path REF: create.- Returns:
- automatically generated
-
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.- Parameters:
bufferModel- A buffer containing the contents of the DISK ONNX model. responses (by network score) are kept; -1 keeps all detections. (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. Note: In C++ this is an overload of REF: create. The Python/Java/Objective-C bindings expose it ascreateFromMemory, because Objective-C selectors are not disambiguated by argument type and would otherwise clash with the file-path REF: create.- Returns:
- automatically generated
-
setMaxKeypoints
public void setMaxKeypoints(int maxKeypoints) -
getMaxKeypoints
public int getMaxKeypoints() -
setScoreThreshold
public void setScoreThreshold(float threshold) -
getScoreThreshold
public float getScoreThreshold() -
setImageSize
-
getImageSize
-
getDefaultName
Description copied from class:AlgorithmReturns 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.- Overrides:
getDefaultNamein classFeature2D- Returns:
- automatically generated
-