本文整理汇总了Python中cv2.FastFeatureDetector_create方法的典型用法代码示例。如果您正苦于以下问题:Python cv2.FastFeatureDetector_create方法的具体用法?Python cv2.FastFeatureDetector_create怎么用?Python cv2.FastFeatureDetector_create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv2
的用法示例。
在下文中一共展示了cv2.FastFeatureDetector_create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_fast_det
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import FastFeatureDetector_create [as 别名]
def compute_fast_det(filename, is_nms=True, thresh = 10):
img = cv2.imread(filename)
# Initiate FAST object with default values
fast = cv2.FastFeatureDetector_create() #FastFeatureDetector()
# find and draw the keypoints
if not is_nms:
fast.setNonmaxSuppression(0)
fast.setThreshold(thresh)
kp = fast.detect(img,None)
cv2.drawKeypoints(img, kp, img, color=(255,0,0))
return img
示例2: __init__
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import FastFeatureDetector_create [as 别名]
def __init__(self, videoSource, featurePtMask=None, verbosity=0):
# cap the length of optical flow tracks
self.maxTrackLength = 10
# detect feature points in intervals of frames; adds robustness for
# when feature points disappear.
self.detectionInterval = 5
# Params for Shi-Tomasi corner (feature point) detection
self.featureParams = dict(
maxCorners=500,
qualityLevel=0.3,
minDistance=7,
blockSize=7
)
# Params for Lucas-Kanade optical flow
self.lkParams = dict(
winSize=(15, 15),
maxLevel=2,
criteria=(cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03)
)
# # Alternatively use a fast feature detector
# self.fast = cv2.FastFeatureDetector_create(500)
self.verbosity = verbosity
(self.videoStream,
self.width,
self.height,
self.featurePtMask) = self._initializeCamera(videoSource)
示例3: __init__
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import FastFeatureDetector_create [as 别名]
def __init__(self, target_n, nonmax_radius):
self._scorer = cv2.FastFeatureDetector_create()
self._target_n = target_n
self._nonmax_radius = nonmax_radius
示例4: __init__
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import FastFeatureDetector_create [as 别名]
def __init__(self, cam):
self.frame_stage = 0
self.cam = cam
self.new_frame = None
self.last_frame = None
self.cur_R = None
self.cur_t = None
self.px_ref = None
self.px_cur = None
self.focal = cam.fx
self.pp = (cam.cx, cam.cy)
#self.trueX, self.trueY, self.trueZ = 0, 0, 0
self.detector = cv2.FastFeatureDetector_create(threshold=25, nonmaxSuppression=True)
#with open('poses.txt') as f:
# self.annotations = f.readlines()
示例5: compute_fast_det
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import FastFeatureDetector_create [as 别名]
def compute_fast_det(img, is_nms=True, thresh = 10):
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# Initiate FAST object with default values
fast = cv2.FastFeatureDetector_create() #FastFeatureDetector()
# # find and draw the keypoints
if not is_nms:
fast.setNonmaxSuppression(0)
fast.setThreshold(thresh)
kp = fast.detect(img,None)
cv2.drawKeypoints(img, kp, img, color=(255,0,0))
sift = cv2.SIFT()
kp = sift.detect(gray,None)
img=cv2.drawKeypoints(gray,kp)
plt.figure(figsize=(12, 8))
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.axis('off')
plt.show()
示例6: fast_loader
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import FastFeatureDetector_create [as 别名]
def fast_loader(image, name, **config):
num_features = config.get('num_features', 0)
do_nms = config.get('do_nms', False)
nms_thresh = config.get('nms_thresh', 4)
fast = cv2.FastFeatureDetector_create()
kpts = fast.detect(image.astype(np.uint8), None)
kpts, scores = keypoints_cv2np(kpts)
if do_nms:
keep = nms_fast(kpts, scores, image.shape[:2], nms_thresh)
kpts, scores = kpts[keep], scores[keep]
if num_features:
keep_indices = np.argsort(scores)[::-1][:num_features]
kpts, scores = [i[keep_indices] for i in [kpts, scores]]
return {'keypoints': kpts, 'scores': scores}