Loading autocnet/graph/edge.py +9 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class Edge(dict, MutableMapping): boolean_mask = v[1] self.masks[column_name] = boolean_mask""" def match(self, k=2, overlap=False, **kwargs): def match(self, k=2, **kwargs): """ Given two sets of descriptors, utilize a FLANN (Approximate Nearest Loading @@ -113,6 +113,14 @@ class Edge(dict, MutableMapping): """ pass def match_overlap(self, k=2, **kwargs): """ Given two sets of descriptors, apply the matcher with the source and destination overlaps. """ overlaps = [self['source_mbr'], self['destin_mbr']] self.match(k=k, overlap=overlaps, **kwargs) def decompose(self): """ Apply coupled decomposition to the images and Loading autocnet/graph/tests/test_node.py +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ class TestNode(object): node.extract_features_with_downsampling(5, extractor_parameters={'nfeatures':10}) assert len(node.keypoints) == 10 assert len(node.keypoints) in range(8,12) assert node.keypoints['x'].max() > 500 Loading autocnet/matcher/cpu_matcher.py +5 −6 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ FLANN_INDEX_KDTREE = 1 # Algorithm to set centers, DEFAULT_FLANN_PARAMETERS = dict(algorithm=FLANN_INDEX_KDTREE, trees=3) def match(self, k=2, overlap=False, **kwargs): def match(self, k=2, overlap=[], **kwargs): """ Given two sets of descriptors, utilize a FLANN (Approximate Nearest Neighbor KDTree) matcher to find the k nearest matches. Nearness is Loading Loading @@ -85,8 +85,8 @@ def match(self, k=2, overlap=False, **kwargs): kwargs.pop('aidx') elif overlap: # Query the source keypoints for those in the MBR source_mbr = self['source_mbr'] query_result = self.source.keypoints.query() source_mbr = overlap[0] query_result = self.source.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*source_mbr)) aidx = query_result.index else: aidx = None Loading @@ -95,8 +95,8 @@ def match(self, k=2, overlap=False, **kwargs): bidx = kwargs['bidx'] kwargs.pop('bidx') elif overlap: destin_mbr = self['destin_mbr'] query_result = self.destination.keypoints.query() destin_mbr = overlap[1] query_result = self.destination.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*destin_mbr)) bidx = query_result.index else: bidx = None Loading @@ -105,7 +105,6 @@ def match(self, k=2, overlap=False, **kwargs): # Swap the indices since mono_matches is generic and source/destin are # swapped mono_matches(self.destination, self.source, aidx=bidx, bidx=aidx, **kwargs) self.matches.sort_values(by=['distance']) Loading autocnet/matcher/cuda_matcher.py +5 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import cudasift as cs import numpy as np import pandas as pd def match(self, ratio=0.8, overlap=False, **kwargs): def match(self, ratio=0.8, overlap=[], **kwargs): """ Apply a composite CUDA matcher and ratio check. If this method is used, Loading @@ -15,12 +15,14 @@ def match(self, ratio=0.8, overlap=False, **kwargs): """ if overlap: source_kps = self.source.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*self['source_mbr'])) source_overlap = overlap[0] source_kps = self.source.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*source_overlap)) idx = source_kps.index sremap = {k:v for k, v in enumerate(idx)} source_des = self.source.descriptors[idx] destin_kps = self.destination.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*self['destin_mbr'])) destin_overlap = overlap[1] destin_kps = self.destination.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*destin_overlap)) idx = destin_kps.index dremap = {k:v for k, v in enumerate(idx)} destin_des = self.destination.descriptors[idx] Loading Loading
autocnet/graph/edge.py +9 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class Edge(dict, MutableMapping): boolean_mask = v[1] self.masks[column_name] = boolean_mask""" def match(self, k=2, overlap=False, **kwargs): def match(self, k=2, **kwargs): """ Given two sets of descriptors, utilize a FLANN (Approximate Nearest Loading @@ -113,6 +113,14 @@ class Edge(dict, MutableMapping): """ pass def match_overlap(self, k=2, **kwargs): """ Given two sets of descriptors, apply the matcher with the source and destination overlaps. """ overlaps = [self['source_mbr'], self['destin_mbr']] self.match(k=k, overlap=overlaps, **kwargs) def decompose(self): """ Apply coupled decomposition to the images and Loading
autocnet/graph/tests/test_node.py +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ class TestNode(object): node.extract_features_with_downsampling(5, extractor_parameters={'nfeatures':10}) assert len(node.keypoints) == 10 assert len(node.keypoints) in range(8,12) assert node.keypoints['x'].max() > 500 Loading
autocnet/matcher/cpu_matcher.py +5 −6 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ FLANN_INDEX_KDTREE = 1 # Algorithm to set centers, DEFAULT_FLANN_PARAMETERS = dict(algorithm=FLANN_INDEX_KDTREE, trees=3) def match(self, k=2, overlap=False, **kwargs): def match(self, k=2, overlap=[], **kwargs): """ Given two sets of descriptors, utilize a FLANN (Approximate Nearest Neighbor KDTree) matcher to find the k nearest matches. Nearness is Loading Loading @@ -85,8 +85,8 @@ def match(self, k=2, overlap=False, **kwargs): kwargs.pop('aidx') elif overlap: # Query the source keypoints for those in the MBR source_mbr = self['source_mbr'] query_result = self.source.keypoints.query() source_mbr = overlap[0] query_result = self.source.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*source_mbr)) aidx = query_result.index else: aidx = None Loading @@ -95,8 +95,8 @@ def match(self, k=2, overlap=False, **kwargs): bidx = kwargs['bidx'] kwargs.pop('bidx') elif overlap: destin_mbr = self['destin_mbr'] query_result = self.destination.keypoints.query() destin_mbr = overlap[1] query_result = self.destination.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*destin_mbr)) bidx = query_result.index else: bidx = None Loading @@ -105,7 +105,6 @@ def match(self, k=2, overlap=False, **kwargs): # Swap the indices since mono_matches is generic and source/destin are # swapped mono_matches(self.destination, self.source, aidx=bidx, bidx=aidx, **kwargs) self.matches.sort_values(by=['distance']) Loading
autocnet/matcher/cuda_matcher.py +5 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import cudasift as cs import numpy as np import pandas as pd def match(self, ratio=0.8, overlap=False, **kwargs): def match(self, ratio=0.8, overlap=[], **kwargs): """ Apply a composite CUDA matcher and ratio check. If this method is used, Loading @@ -15,12 +15,14 @@ def match(self, ratio=0.8, overlap=False, **kwargs): """ if overlap: source_kps = self.source.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*self['source_mbr'])) source_overlap = overlap[0] source_kps = self.source.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*source_overlap)) idx = source_kps.index sremap = {k:v for k, v in enumerate(idx)} source_des = self.source.descriptors[idx] destin_kps = self.destination.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*self['destin_mbr'])) destin_overlap = overlap[1] destin_kps = self.destination.keypoints.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*destin_overlap)) idx = destin_kps.index dremap = {k:v for k, v in enumerate(idx)} destin_des = self.destination.descriptors[idx] Loading