Loading autocnet/matcher/feature_extractor.py +12 −3 Original line number Diff line number Diff line import cv2 def extract_features(array, extractor_parameters): def extract_features(array, method='orb', extractor_parameters=None): """ This method finds and extracts features from an image using the given dictionary of keyword arguments. The input image is represented as NumPy array and the output features are represented as keypoint IDs Loading @@ -12,6 +12,9 @@ def extract_features(array, extractor_parameters): array : ndarray a NumPy array that represents an image detector : {'orb', 'sift', 'fast', 'surf'} The detector method to be used extractor_parameters : dict A dictionary containing OpenCV SIFT parameters names and values. Loading @@ -21,5 +24,11 @@ def extract_features(array, extractor_parameters): in the form ([list of OpenCV KeyPoints], [NumPy array of descriptors as geometric vectors]) """ sift = cv2.xfeatures2d.SIFT_create(**extractor_parameters) return sift.detectAndCompute(array, None) detectors = {'fast': cv2.FastFeatureDetector_create, 'sift': cv2.xfeatures2d.SIFT_create, 'surf': cv2.xfeatures2d.SURF_create, 'orb': cv2.ORB_create} detector = detectors[method](**extractor_parameters) return detector.detectAndCompute(array, None) Loading
autocnet/matcher/feature_extractor.py +12 −3 Original line number Diff line number Diff line import cv2 def extract_features(array, extractor_parameters): def extract_features(array, method='orb', extractor_parameters=None): """ This method finds and extracts features from an image using the given dictionary of keyword arguments. The input image is represented as NumPy array and the output features are represented as keypoint IDs Loading @@ -12,6 +12,9 @@ def extract_features(array, extractor_parameters): array : ndarray a NumPy array that represents an image detector : {'orb', 'sift', 'fast', 'surf'} The detector method to be used extractor_parameters : dict A dictionary containing OpenCV SIFT parameters names and values. Loading @@ -21,5 +24,11 @@ def extract_features(array, extractor_parameters): in the form ([list of OpenCV KeyPoints], [NumPy array of descriptors as geometric vectors]) """ sift = cv2.xfeatures2d.SIFT_create(**extractor_parameters) return sift.detectAndCompute(array, None) detectors = {'fast': cv2.FastFeatureDetector_create, 'sift': cv2.xfeatures2d.SIFT_create, 'surf': cv2.xfeatures2d.SURF_create, 'orb': cv2.ORB_create} detector = detectors[method](**extractor_parameters) return detector.detectAndCompute(array, None)