當前位置: 首頁>>代碼示例>>Python>>正文


Python cv2.FastFeatureDetector_create方法代碼示例

本文整理匯總了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 
開發者ID:PacktPublishing,項目名稱:Practical-Computer-Vision,代碼行數:19,代碼來源:04_fast_feature.py

示例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) 
開發者ID:BoltzmannBrain,項目名稱:self-driving,代碼行數:32,代碼來源:optical_flow.py

示例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 
開發者ID:uzh-rpg,項目名稱:imips_open,代碼行數:6,代碼來源:klt.py

示例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() 
開發者ID:karanchawla,項目名稱:Monocular-Visual-Inertial-Odometry,代碼行數:17,代碼來源:visual_odometry.py

示例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() 
開發者ID:PacktPublishing,項目名稱:Practical-Computer-Vision,代碼行數:28,代碼來源:04_sift_features.py

示例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} 
開發者ID:ethz-asl,項目名稱:hfnet,代碼行數:17,代碼來源:loaders.py


注:本文中的cv2.FastFeatureDetector_create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。