pub struct LightGlueMatcher { /* private fields */ }Expand 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.
Implementations§
Source§impl LightGlueMatcher
impl LightGlueMatcher
Sourcepub fn create(
model_path: impl AsRef<OsStr>,
score_threshold: f32,
backend: i32,
target: i32,
) -> Result<Ptr<LightGlueMatcher>>
pub fn create( model_path: impl AsRef<OsStr>, score_threshold: f32, backend: i32, target: i32, ) -> Result<Ptr<LightGlueMatcher>>
Sourcepub fn create_def(
model_path: impl AsRef<OsStr>,
) -> Result<Ptr<LightGlueMatcher>>
pub fn create_def( model_path: impl AsRef<OsStr>, ) -> Result<Ptr<LightGlueMatcher>>
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
§Note
This alternative version of LightGlueMatcher::create function uses the following default values for its arguments:
- score_threshold: 0.0f
- backend: 0
- target: 0
Sourcepub fn create_from_memory(
model_data: &Vector<u8>,
score_threshold: f32,
backend: i32,
target: i32,
) -> Result<Ptr<LightGlueMatcher>>
pub fn create_from_memory( model_data: &Vector<u8>, score_threshold: f32, backend: i32, target: i32, ) -> Result<Ptr<LightGlueMatcher>>
Sourcepub fn create_from_memory_def(
model_data: &Vector<u8>,
) -> Result<Ptr<LightGlueMatcher>>
pub fn create_from_memory_def( model_data: &Vector<u8>, ) -> Result<Ptr<LightGlueMatcher>>
Creates LightGlueMatcher from in-memory model data.
§Parameters
- modelData: Buffer containing the model data.
- scoreThreshold: Match confidence threshold.
- backend: DNN backend
- target: DNN target
§Note
This alternative version of LightGlueMatcher::create_from_memory function uses the following default values for its arguments:
- score_threshold: 0.0f
- backend: 0
- target: 0
Trait Implementations§
Source§impl AlgorithmTrait for LightGlueMatcher
impl AlgorithmTrait for LightGlueMatcher
Source§impl AlgorithmTraitConst for LightGlueMatcher
impl AlgorithmTraitConst for LightGlueMatcher
fn as_raw_Algorithm(&self) -> *const c_void
Source§fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>
fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>
Source§fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
Source§fn empty(&self) -> Result<bool>
fn empty(&self) -> Result<bool>
Source§fn save(&self, filename: impl AsRef<OsStr>) -> Result<()>
fn save(&self, filename: impl AsRef<OsStr>) -> Result<()>
Source§fn get_default_name(&self) -> Result<String>
fn get_default_name(&self) -> Result<String>
Source§impl Boxed for LightGlueMatcher
impl Boxed for LightGlueMatcher
Source§unsafe fn from_raw(
ptr: <LightGlueMatcher as OpenCVFromExtern>::ExternReceive,
) -> Self
unsafe fn from_raw( ptr: <LightGlueMatcher as OpenCVFromExtern>::ExternReceive, ) -> Self
Source§fn into_raw(
self,
) -> <LightGlueMatcher as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw( self, ) -> <LightGlueMatcher as OpenCVTypeExternContainer>::ExternSendMut
Source§fn as_raw(&self) -> <LightGlueMatcher as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <LightGlueMatcher as OpenCVTypeExternContainer>::ExternSend
Source§fn as_raw_mut(
&mut self,
) -> <LightGlueMatcher as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <LightGlueMatcher as OpenCVTypeExternContainer>::ExternSendMut
Source§impl Debug for LightGlueMatcher
impl Debug for LightGlueMatcher
Source§impl DescriptorMatcherTrait for LightGlueMatcher
impl DescriptorMatcherTrait for LightGlueMatcher
fn as_raw_mut_DescriptorMatcher(&mut self) -> *mut c_void
Source§fn add(&mut self, descriptors: &impl ToInputArray) -> Result<()>
fn add(&mut self, descriptors: &impl ToInputArray) -> Result<()>
Source§fn match_(
&mut self,
query_descriptors: &impl ToInputArray,
matches: &mut Vector<DMatch>,
masks: &impl ToInputArray,
) -> Result<()>
fn match_( &mut self, query_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, masks: &impl ToInputArray, ) -> Result<()>
Source§fn match__def(
&mut self,
query_descriptors: &impl ToInputArray,
matches: &mut Vector<DMatch>,
) -> Result<()>
fn match__def( &mut self, query_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, ) -> Result<()>
Source§fn knn_match(
&mut self,
query_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
k: i32,
masks: &impl ToInputArray,
compact_result: bool,
) -> Result<()>
fn knn_match( &mut self, query_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, k: i32, masks: &impl ToInputArray, compact_result: bool, ) -> Result<()>
Source§fn knn_match_def(
&mut self,
query_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
k: i32,
) -> Result<()>
fn knn_match_def( &mut self, query_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, k: i32, ) -> Result<()>
Source§fn radius_match(
&mut self,
query_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
max_distance: f32,
masks: &impl ToInputArray,
compact_result: bool,
) -> Result<()>
fn radius_match( &mut self, query_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, masks: &impl ToInputArray, compact_result: bool, ) -> Result<()>
Source§fn radius_match_def(
&mut self,
query_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
max_distance: f32,
) -> Result<()>
fn radius_match_def( &mut self, query_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, ) -> Result<()>
fn read(&mut self, file_name: impl AsRef<OsStr>) -> Result<()>
fn read_from_node(&mut self, unnamed: &impl FileNodeTraitConst) -> Result<()>
Source§impl DescriptorMatcherTraitConst for LightGlueMatcher
impl DescriptorMatcherTraitConst for LightGlueMatcher
fn as_raw_DescriptorMatcher(&self) -> *const c_void
Source§fn get_train_descriptors(&self) -> Result<Vector<Mat>>
fn get_train_descriptors(&self) -> Result<Vector<Mat>>
Source§fn empty(&self) -> Result<bool>
fn empty(&self) -> Result<bool>
Source§fn is_mask_supported(&self) -> Result<bool>
fn is_mask_supported(&self) -> Result<bool>
Source§fn train_match(
&self,
query_descriptors: &impl ToInputArray,
train_descriptors: &impl ToInputArray,
matches: &mut Vector<DMatch>,
mask: &impl ToInputArray,
) -> Result<()>
fn train_match( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, mask: &impl ToInputArray, ) -> Result<()>
Source§fn train_match_def(
&self,
query_descriptors: &impl ToInputArray,
train_descriptors: &impl ToInputArray,
matches: &mut Vector<DMatch>,
) -> Result<()>
fn train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, ) -> Result<()>
Source§fn knn_train_match(
&self,
query_descriptors: &impl ToInputArray,
train_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
k: i32,
mask: &impl ToInputArray,
compact_result: bool,
) -> Result<()>
fn knn_train_match( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, k: i32, mask: &impl ToInputArray, compact_result: bool, ) -> Result<()>
Source§fn knn_train_match_def(
&self,
query_descriptors: &impl ToInputArray,
train_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
k: i32,
) -> Result<()>
fn knn_train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, k: i32, ) -> Result<()>
Source§fn radius_train_match(
&self,
query_descriptors: &impl ToInputArray,
train_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
max_distance: f32,
mask: &impl ToInputArray,
compact_result: bool,
) -> Result<()>
fn radius_train_match( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, mask: &impl ToInputArray, compact_result: bool, ) -> Result<()>
Source§fn radius_train_match_def(
&self,
query_descriptors: &impl ToInputArray,
train_descriptors: &impl ToInputArray,
matches: &mut Vector<Vector<DMatch>>,
max_distance: f32,
) -> Result<()>
fn radius_train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, ) -> Result<()>
fn write(&self, file_name: impl AsRef<OsStr>) -> Result<()>
fn write_to_storage(&self, unnamed: &mut impl FileStorageTrait) -> Result<()>
Source§fn clone(&self, empty_train_data: bool) -> Result<Ptr<DescriptorMatcher>>
fn clone(&self, empty_train_data: bool) -> Result<Ptr<DescriptorMatcher>>
fn write_to_storage_with_name( &self, fs: &mut impl FileStorageTrait, name: &str, ) -> Result<()>
Source§impl Drop for LightGlueMatcher
impl Drop for LightGlueMatcher
Source§impl From<LightGlueMatcher> for Algorithm
impl From<LightGlueMatcher> for Algorithm
Source§fn from(s: LightGlueMatcher) -> Self
fn from(s: LightGlueMatcher) -> Self
Source§impl From<LightGlueMatcher> for DescriptorMatcher
impl From<LightGlueMatcher> for DescriptorMatcher
Source§fn from(s: LightGlueMatcher) -> Self
fn from(s: LightGlueMatcher) -> Self
Source§impl LightGlueMatcherTrait for LightGlueMatcher
impl LightGlueMatcherTrait for LightGlueMatcher
fn as_raw_mut_LightGlueMatcher(&mut self) -> *mut c_void
Source§fn set_pair_info(
&mut self,
query_kpts: &impl ToInputArray,
train_kpts: &impl ToInputArray,
query_image_size: Size,
train_image_size: Size,
) -> Result<()>
fn set_pair_info( &mut self, query_kpts: &impl ToInputArray, train_kpts: &impl ToInputArray, query_image_size: Size, train_image_size: Size, ) -> Result<()>
Source§fn set_pair_info_def(
&mut self,
query_kpts: &impl ToInputArray,
train_kpts: &impl ToInputArray,
) -> Result<()>
fn set_pair_info_def( &mut self, query_kpts: &impl ToInputArray, train_kpts: &impl ToInputArray, ) -> Result<()>
Source§fn clear_pair_info(&mut self) -> Result<()>
fn clear_pair_info(&mut self) -> Result<()>
Source§impl LightGlueMatcherTraitConst for LightGlueMatcher
impl LightGlueMatcherTraitConst for LightGlueMatcher
fn as_raw_LightGlueMatcher(&self) -> *const c_void
impl Send for LightGlueMatcher
Source§impl TryFrom<DescriptorMatcher> for LightGlueMatcher
impl TryFrom<DescriptorMatcher> for LightGlueMatcher
Auto Trait Implementations§
impl !Sync for LightGlueMatcher
impl Freeze for LightGlueMatcher
impl RefUnwindSafe for LightGlueMatcher
impl Unpin for LightGlueMatcher
impl UnsafeUnpin for LightGlueMatcher
impl UnwindSafe for LightGlueMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Mat or another similar object. By passing
a mutable reference to the Mat to this function your closure will get called with the read reference and a write references
to the same Mat. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold. Read more