Beispiel #1
0
def extract_features_akaze(image, config):
    options = pyfeatures.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.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 = pyfeatures.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
Beispiel #2
0
def extract_features_akaze(
        image: np.ndarray, config: Dict[str, Any],
        features_count: int) -> Tuple[np.ndarray, np.ndarray]:
    options = pyfeatures.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.dthreshold = config["akaze_dthreshold"]
    options.kcontrast_percentile = config["akaze_kcontrast_percentile"]
    options.use_isotropic_diffusion = config["akaze_use_isotropic_diffusion"]
    options.target_num_features = features_count
    options.use_adaptive_suppression = config[
        "feature_use_adaptive_suppression"]

    logger.debug("Computing AKAZE with threshold {0}".format(
        options.dthreshold))
    t = time.time()
    points, desc = pyfeatures.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