本文整理匯總了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}