本文整理汇总了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