本文整理匯總了Python中cv2.BRISK_create方法的典型用法代碼示例。如果您正苦於以下問題:Python cv2.BRISK_create方法的具體用法?Python cv2.BRISK_create怎麽用?Python cv2.BRISK_create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cv2
的用法示例。
在下文中一共展示了cv2.BRISK_create方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: describe
# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import BRISK_create [as 別名]
def describe(self, image):
# Initialize the BRISK detector and feature extractor
descriptor = cv2.BRISK_create()
# Check if SIFT should be utilized to detect and extract features
if self.use_sift:
descriptor = cv2.xfeatures2d.SIFT_create()
# Detect keypoints in the image, describing the region surrounding each keypoint, then convert the keypoints
# to a NumPy array
(keypoints, descriptors) = descriptor.detectAndCompute(image, None)
keypoints = np.float32([keypoint.pt for keypoint in keypoints])
# Return a tuple of keypoints and descriptors
return (keypoints, descriptors)
示例2: init_feature
# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import BRISK_create [as 別名]
def init_feature(name):
chunks = name.split('-')
if chunks[0] == 'sift':
detector = cv2.xfeatures2d.SIFT_create()
norm = cv2.NORM_L2
elif chunks[0] == 'surf':
detector = cv2.xfeatures2d.SURF_create(800)
norm = cv2.NORM_L2
elif chunks[0] == 'orb':
detector = cv2.ORB_create(400)
norm = cv2.NORM_HAMMING
elif chunks[0] == 'akaze':
detector = cv2.AKAZE_create()
norm = cv2.NORM_HAMMING
elif chunks[0] == 'brisk':
detector = cv2.BRISK_create()
norm = cv2.NORM_HAMMING
else:
return None, None
if 'flann' in chunks:
if norm == cv2.NORM_L2:
flann_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
else:
flann_params= dict(algorithm = FLANN_INDEX_LSH,
table_number = 6, # 12
key_size = 12, # 20
multi_probe_level = 1) #2
matcher = cv2.FlannBasedMatcher(flann_params, {}) # bug : need to pass empty dict (#1329)
else:
matcher = cv2.BFMatcher(norm)
return detector, matcher
示例3: init_detector
# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import BRISK_create [as 別名]
def init_detector(self):
"""Init keypoint detector object."""
self.detector = cv2.BRISK_create()
# create BFMatcher object:
self.matcher = cv2.BFMatcher(cv2.NORM_HAMMING) # cv2.NORM_L1 cv2.NORM_L2 cv2.NORM_HAMMING(not useable)
示例4: __init__
# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import BRISK_create [as 別名]
def __init__(self, config='GFTT-BRIEF'):
super().__init__()
if config == 'GFTT-BRIEF':
self.feature_detector = cv2.GFTTDetector_create(
maxCorners=1000, minDistance=12.0,
qualityLevel=0.001, useHarrisDetector=False)
self.descriptor_extractor = cv2.xfeatures2d.BriefDescriptorExtractor_create(
bytes=32, use_orientation=False)
elif config == 'GFTT-BRISK':
self.feature_detector = cv2.GFTTDetector_create(
maxCorners=2000, minDistance=15.0,
qualityLevel=0.01, useHarrisDetector=False)
self.descriptor_extractor = cv2.BRISK_create()
elif config == 'ORB-ORB':
self.feature_detector = cv2.ORB_create(
nfeatures=1000, scaleFactor=1.2, nlevels=1, edgeThreshold=31)
self.descriptor_extractor = self.feature_detector
else:
raise NotImplementedError
self.descriptor_matcher = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=False)
self.matching_cell_size = 15 # pixels
self.matching_neighborhood = 3
self.matching_distance = 30
self.frustum_near = 0.1 # meters
self.frustum_far = 1000.0
self.ground = True
self.lc_max_inbetween_distance = 50
self.lc_distance_threshold = 15
self.lc_embedding_distance = 20.0
self.view_image_width = 400
self.view_image_height = 130
self.view_camera_width = 0.75
self.view_viewpoint_x = 0
self.view_viewpoint_y = -500 # -10
self.view_viewpoint_z = -100 # -0.1
self.view_viewpoint_f = 2000