Class cv::LightGlueMatcher#

LightGlue feature matcher. View details

Collaboration diagram for cv::LightGlueMatcher:

cv::LightGlueMatcher Node1 cv::LightGlueMatcher   + ~LightGlueMatcher() + clearPairInfo() + setPairInfo() + create() # LightGlueMatcher() Node2 cv::DescriptorMatcher   + ~DescriptorMatcher() + add() + clear() + clone() + empty() + getTrainDescriptors() + isMaskSupported() + knnMatch() + knnMatch() + match() and 10 more... + create() + create() # checkMasks() # knnMatchImpl() # radiusMatchImpl() # clone_op() # isMaskedOut() # isPossibleMatch() Node2->Node1 Node3 cv::Algorithm   + Algorithm() + ~Algorithm() + clear() + empty() + getDefaultName() + read() + save() + write() + write() + load() + loadFromString() + read() # writeFormat() Node3->Node2 Node4 std::vector< cv::Mat >     Node4->Node2 #trainDescCollection Node5 cv::Mat   + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() and 152 more... + diag() + eye() + eye() + getDefaultAllocator() + getStdAllocator() + ones() + ones() + ones() + ones() + setDefaultAllocator() + zeros() + zeros() + zeros() + zeros() # forEach_impl() Node5->Node4 +elements Node6 int     Node6->Node5 +cols +dims +dummy +flags +rows Node15 cv::UMat   + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() and 67 more... + diag() + eye() + eye() + getStdAllocator() + ones() + ones() + ones() + ones() + zeros() + zeros() + zeros() + zeros() Node6->Node15 +cols +dims +flags +rows Node7 uint8_t     Node7->Node5 +data +dataend +datalimit +datastart Node8 cv::MatAllocator   + MatAllocator() + ~MatAllocator() + allocate() + allocate() + copy() + deallocate() + download() + getBufferPoolController() + map() + unmap() + upload() Node8->Node5 +allocator Node8->Node15 +allocator Node9 UMatData *     Node9->Node5 +u Node9->Node15 +u Node10 MatSize     Node10->Node5 +size Node10->Node15 +size Node11 MatStep     Node11->Node5 +step Node11->Node15 +step Node12 std::vector< T >     Node12->Node4 < cv::Mat > Node14 std::vector< cv::UMat >     Node12->Node14 < cv::UMat > Node13 T     Node13->Node12 +elements Node14->Node2 #utrainDescCollection Node15->Node14 +elements Node16 UMatUsageFlags     Node16->Node15 +usageFlags Node17 size_t     Node17->Node15 +offset

cv::LightGlueMatcher Node1 cv::LightGlueMatcher   + ~LightGlueMatcher() + clearPairInfo() + setPairInfo() + create() # LightGlueMatcher() Node2 cv::DescriptorMatcher   + ~DescriptorMatcher() + add() + clear() + clone() + empty() + getTrainDescriptors() + isMaskSupported() + knnMatch() + knnMatch() + match() and 10 more... + create() + create() # checkMasks() # knnMatchImpl() # radiusMatchImpl() # clone_op() # isMaskedOut() # isPossibleMatch() Node2->Node1 Node3 cv::Algorithm   + Algorithm() + ~Algorithm() + clear() + empty() + getDefaultName() + read() + save() + write() + write() + load() + loadFromString() + read() # writeFormat() Node3->Node2 Node4 std::vector< cv::Mat >     Node4->Node2 #trainDescCollection Node5 cv::Mat   + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() and 152 more... + diag() + eye() + eye() + getDefaultAllocator() + getStdAllocator() + ones() + ones() + ones() + ones() + setDefaultAllocator() + zeros() + zeros() + zeros() + zeros() # forEach_impl() Node5->Node4 +elements Node6 int     Node6->Node5 +cols +dims +dummy +flags +rows Node15 cv::UMat   + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() and 67 more... + diag() + eye() + eye() + getStdAllocator() + ones() + ones() + ones() + ones() + zeros() + zeros() + zeros() + zeros() Node6->Node15 +cols +dims +flags +rows Node7 uint8_t     Node7->Node5 +data +dataend +datalimit +datastart Node8 cv::MatAllocator   + MatAllocator() + ~MatAllocator() + allocate() + allocate() + copy() + deallocate() + download() + getBufferPoolController() + map() + unmap() + upload() Node8->Node5 +allocator Node8->Node15 +allocator Node9 UMatData *     Node9->Node5 +u Node9->Node15 +u Node10 MatSize     Node10->Node5 +size Node10->Node15 +size Node11 MatStep     Node11->Node5 +step Node11->Node15 +step Node12 std::vector< T >     Node12->Node4 < cv::Mat > Node14 std::vector< cv::UMat >     Node12->Node14 < cv::UMat > Node13 T     Node13->Node12 +elements Node14->Node2 #utrainDescCollection Node15->Node14 +elements Node16 UMatUsageFlags     Node16->Node15 +usageFlags Node17 size_t     Node17->Node15 +offset

Public Types#

Public Types inherited from cv::DescriptorMatcher

Return

Name

Description

MatcherType

Public Member Functions#

Public Member Functions inherited from cv::DescriptorMatcher

Return

Name

Description

~DescriptorMatcher()

void

add(InputArrayOfArrays descriptors)

Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor collection.

void

clear()

Clears the train descriptor collections.

CV_NODISCARD_STD Ptr< DescriptorMatcher >

clone(bool emptyTrainData = false)

Clones the matcher.

bool

empty()

Returns true if there are no train descriptors in the both collections.

const std::vector< Mat > &

getTrainDescriptors()

Returns a constant link to the train descriptor collection trainDescCollection .

bool

isMaskSupported()

Returns true if the descriptor matcher supports masking permissible matches.

void

knnMatch(
    InputArray queryDescriptors,
    InputArray trainDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    int k,
    InputArray mask = noArray(),
    bool compactResult = false )

Finds the k best matches for each descriptor from a query set.

void

knnMatch(
    InputArray queryDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    int k,
    InputArrayOfArrays masks = noArray(),
    bool compactResult = false )

void

match(
    InputArray queryDescriptors,
    InputArray trainDescriptors,
    std::vector< DMatch > & matches,
    InputArray mask = noArray() )

Finds the best match for each descriptor from a query set.

void

match(
    InputArray queryDescriptors,
    std::vector< DMatch > & matches,
    InputArrayOfArrays masks = noArray() )

void

radiusMatch(
    InputArray queryDescriptors,
    InputArray trainDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    float maxDistance,
    InputArray mask = noArray(),
    bool compactResult = false )

For each query descriptor, finds the training descriptors not farther than the specified distance.

void

radiusMatch(
    InputArray queryDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    float maxDistance,
    InputArrayOfArrays masks = noArray(),
    bool compactResult = false )

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

read(const String & fileName)

void

train()

Trains a descriptor matcher.

void

write(
    const Ptr< FileStorage > & fs,
    const String & name )

void

write(const String & fileName)

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::DescriptorMatcher

Return

Name

Description

static Ptr< DescriptorMatcher >

create(const DescriptorMatcher::MatcherType & matcherType)

static Ptr< DescriptorMatcher >

create(const String & descriptorMatcherType)

Creates a descriptor matcher of a given type with the default parameters (using default constructor).

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::DescriptorMatcher
Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

Static Protected Member Functions inherited from cv::DescriptorMatcher
Protected Attributes inherited from cv::DescriptorMatcher

Return

Name

Description

std::vector< Mat >

trainDescCollection

Collection of descriptors from train images.

std::vector< UMat >

utrainDescCollection

Detailed Description#

LightGlue feature matcher.

LightGlue is a CNN-based feature matcher, as described in Lindenberger23 . It takes keypoint locations and descriptors from two images and directly predicts match pairs. Unlike traditional matchers that compute descriptor distances, LightGlue uses attention mechanisms to produce confidence scores for each potential match pair.

The matcher extends DescriptorMatcher and supports the standard match(), knnMatch(), and radiusMatch() interfaces. Context (keypoints and image sizes) must be provided via setPairInfo() before matching.

Examples
samples/cpp/stitching_detailed.cpp.

Constructor & Destructor Documentation#

LightGlueMatcher()#

cv::LightGlueMatcher::LightGlueMatcher()

~LightGlueMatcher()#

cv::LightGlueMatcher::~LightGlueMatcher()

Member Function Documentation#

clearPairInfo()#

void cv::LightGlueMatcher::clearPairInfo()

Python:

cv.LightGlueMatcher.clearPairInfo()

Clears stored pair context information.

setPairInfo()#

void cv::LightGlueMatcher::setPairInfo(
InputArray queryKpts,
InputArray trainKpts,
Size queryImageSize = Size(),
Size trainImageSize = Size() )

Python:

cv.LightGlueMatcher.setPairInfo(queryKpts, trainKpts[, queryImageSize[, trainImageSize]])

Sets the keypoint and image size context for the next match() call.

This provides the spatial context that LightGlue needs in addition to descriptors. Must be called before match()/knnMatch()/radiusMatch() unless using automatic context from in-process ALIKED instances.

Parameters

  • queryKpts — Query image keypoints (Nx2 float matrix with x,y coordinates).

  • trainKpts — Train image keypoints (Nx2 float matrix with x,y coordinates).

  • queryImageSize — Size of the query image (width, height).

  • trainImageSize — Size of the train image (width, height).

create()#

static Ptr< LightGlueMatcher > cv::LightGlueMatcher::create(
const String & modelPath,
float scoreThreshold = 0.0f,
int backend = 0,
int target = 0 )

Python:

cv.LightGlueMatcher.create(modelPath[, scoreThreshold[, backend[, target]]]) -> retval
cv.LightGlueMatcher.createFromMemory(modelData[, scoreThreshold[, backend[, target]]]) -> retval
cv.LightGlueMatcher_create(modelPath[, scoreThreshold[, backend[, target]]]) -> retval
cv.LightGlueMatcher_createFromMemory(modelData[, scoreThreshold[, backend[, target]]]) -> retval

Creates LightGlueMatcher from a model file path.

Parameters

  • modelPath — Path to the ONNX model file.

  • scoreThreshold — Match confidence threshold.

  • backend — DNN backend

  • target — DNN target

Source file#

The documentation for this class was generated from the following file: