我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用cv2.FastFeatureDetector_create()。
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)
def __init__(self, fx, cx, cy): self.last_frame = None self.R = None self.t = None self.px_ref = None self.px_cur = None self.focal = fx self.pp = (cx, cy) self.detector = cv2.FastFeatureDetector_create(threshold=25, nonmaxSuppression=True)
def __init__(self, **kwargs): self.detector = cv2.FastFeatureDetector_create( threshold=kwargs.get("threshold", 25), nonmaxSuppression=kwargs.get("nonmax_suppression", True) )
def __init__(self): self.fast = cv2.FastFeatureDetector_create() self.mask = SkyCamera.getMask()
def fast_thread(): fast = cv2.FastFeatureDetector_create() kps3 = fast.detect(gray, None) cv2.drawKeypoints(gray, kps3, img3, flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) cv2.imshow('FAST Algorithm', img3)
def __init__(self, image_topic, feature_detector='FAST'): super(OpticalFlowMatcher, self).__init__() rospy.init_node('optical_flow_matcher') self.cv_bridge = CvBridge() self.rectified_image_topic = rospy.Subscriber( image_topic, Image, self.new_image_callback ) self.pub_keypoint_motion = rospy.Publisher( 'keypoint_motion', KeypointMotion, queue_size=10 ) self.feature_params = None if feature_detector == 'FAST': self.get_features = self.get_features_fast # Initiate FAST detector with default values self.fast = cv2.FastFeatureDetector_create() self.fast.setThreshold(20) elif feature_detector == 'GOOD': self.get_features = self.get_features_good # params for ShiTomasi 'GOOD' corner detection self.feature_params = dict( maxCorners=200, qualityLevel=0.3, minDistance=7, blockSize=7 ) else: raise Exception( '{} feature detector not implemented'.format(feature_detector) ) # Parameters for lucas kanade optical flow self.lk_params = dict( winSize=(15, 15), maxLevel=2, criteria=( cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03 ) ) self.last_frame_gray = None self.good_old = None self.good_new = None
def __init__(self, image_topic, feature_detector='SIFT'): super(SIFTMatcher, self).__init__() rospy.init_node('sift_matcher') self.cv_bridge = CvBridge() self.rectified_image_topic = rospy.Subscriber( image_topic, Image, self.new_image_callback ) self.pub_keypoint_motion = rospy.Publisher( 'keypoint_motion', KeypointMotion, queue_size=10 ) self.feature_params = None if feature_detector == 'FAST': self.get_features = self.get_features_fast # Initiate FAST detector with default values self.fast = cv2.FastFeatureDetector_create() self.fast.setThreshold(20) elif feature_detector == 'GOOD': self.get_features = self.get_features_good # params for ShiTomasi 'GOOD' corner detection self.feature_params = dict( maxCorners=200, qualityLevel=0.3, minDistance=7, blockSize=7 ) elif feature_detector == 'SIFT': # OpenCV 3+ self.sift = cv2.xfeatures2d.SIFT_create() else: raise Exception( '{} feature detector not implemented'.format(feature_detector) ) self.last_frame_gray = None self.good_old = None self.good_new = None