def extract_features_akaze(image, config): options = csfm.AKAZEOptions() options.omax = config['akaze_omax'] akaze_descriptor_name = config['akaze_descriptor'] options.descriptor = akaze_descriptor_type(akaze_descriptor_name) options.descriptor_size = config['akaze_descriptor_size'] options.descriptor_channels = config['akaze_descriptor_channels'] options.process_size = config['feature_process_size'] options.dthreshold = config['akaze_dthreshold'] options.kcontrast_percentile = config['akaze_kcontrast_percentile'] options.use_isotropic_diffusion = config['akaze_use_isotropic_diffusion'] options.target_num_features = config['feature_min_frames'] options.use_adaptive_suppression = config[ 'feature_use_adaptive_suppression'] logger.debug('Computing AKAZE with threshold {0}'.format( options.dthreshold)) t = time.time() points, desc = csfm.akaze(image, options) logger.debug('Found {0} points in {1}s'.format(len(points), time.time() - t)) if config['feature_root']: if akaze_descriptor_name in ["SURF_UPRIGHT", "MSURF_UPRIGHT"]: desc = root_feature_surf(desc, partial=True) elif akaze_descriptor_name in ["SURF", "MSURF"]: desc = root_feature_surf(desc, partial=False) points = points.astype(float) return points, desc
def extract_features_akaze(image, config): options = csfm.AKAZEOptions() options.omax = config.get('akaze_omax', 4) akaze_descriptor_name = config.get('akaze_descriptor', 'MSURF') options.descriptor = akaze_descriptor_type(akaze_descriptor_name) options.descriptor_size = config.get('akaze_descriptor_size', 0) options.descriptor_channels = config.get('akaze_descriptor_channels', 3) options.process_size = config.get('feature_process_size', -1) threshold = config.get('akaze_dthreshold', 0.001) while True: print 'Computing AKAZE with threshold {0}'.format(threshold) t = time.time() options.dthreshold = threshold points, desc = csfm.akaze(image, options) print 'Found {0} points in {1}s'.format(len(points), time.time() - t) if len(points) < config.get('feature_min_frames', 0) and threshold > 0.00001: threshold = (threshold * 2) / 3 print 'reducing threshold' else: print 'done' break if config.get('feature_root', False): if akaze_descriptor_name in ["SURF_UPRIGHT", "MSURF_UPRIGHT"]: desc = root_feature_surf(desc, partial=True) elif akaze_descriptor_name in ["SURF", "MSURF"]: desc = root_feature_surf(desc, partial=False) points = points.astype(float) return mask_and_normalize_features(points, desc, image.shape[1], image.shape[0], config)