Commit 719bcc9c authored by Adam Paquette's avatar Adam Paquette
Browse files

Further implimentation of config file

parent f0f1d832
Loading
Loading
Loading
Loading
+41 −33
Original line number Diff line number Diff line
basepath:
inputfile_path:
outputfile_path:
system_paths:
    basepath: /home/acpaquette/Desktop/
    inputfile_path: /home/acpaquette/autocnet/autocnet/examples/Apollo15/
    outputfile_path: /home/acpaquette/autocnet/autocnet/examples/Apollo15/

extract_features
method:
extract_features:
    # method can be orb, sift, fast, and surf
    method: sift
    extractor_parameters:
    nfeatures:
        # number of feature points to apply to an image
        nfeatures: 2000
        nOctaveLayers:
        contrastThreshold:
        edgeThreshold:
        sigma:

match_features
k:
match_features:
    # k is the number of matchs to find per feature
    k: 50

ratio_checks:
    clean_keys:
@@ -20,21 +24,25 @@ clean_keys:
    keyword_arguments:
        -

fundamental_matrics
fundamental_matrics:
    clean_keys:
        -
    keyword_arguments:
        -

subpixel_register
subpixel_register:
    clean_keys:
        -
    # size of the template in pixels, must be odd
    template_size:
    # a range from (-1, 1), values less tahn or equal to this threshold are considered outliers
    threshold:
    search_size:
    # maximum value a pixel can shift in the x direction without being considered an outlier
    max_x_shift:
    # maximum value a pixel can shift in the x direction without being considered an outlier
    max_y_shift:
tiled:
    tiled: False
    keyword arguments:
        -

+9 −8
Original line number Diff line number Diff line
import os
import sys
import argparse
import yaml

sys.path.insert(0, os.path.abspath('../autocnet'))

from autocnet.utils.utils import find_in_dict
from autocnet.graph.network import CandidateGraph
from autocnet.fileio.io_controlnetwork import to_isis, write_filelist
from autocnet.fileio.io_yaml import read_yaml
@@ -27,13 +27,14 @@ def match_images(args, config_dict):
    # Matches the images in the input file using various candidate graph methods
    # produces two files usable in isis
    try:
        cg = CandidateGraph.from_adjacency(config['inputfile_path'] +
                                           args.input_file, basepath=config['basepath'])
        cg = CandidateGraph.from_adjacency(find_in_dict(config_dict, 'inputfile_path') +
                                           args.input_file, basepath=find_in_dict(config_dict, 'basepath'))
    except:
        cg = CandidateGraph.from_filelist(config['inputfile_path'] + args.input_file)
        cg = CandidateGraph.from_filelist(find_in_dict(config_dict, 'inputfile_path') + args.input_file)

    # Apply SIFT to extract features
    cg.extract_features(method='sift', extractor_parameters={'nfeatures': 1000})
    cg.extract_features(method=find_in_dict(config_dict, 'method'),
                        extractor_parameters={'nfeatures': find_in_dict(config_dict, 'nfeatures')})

    # Match
    cg.match_features()
@@ -52,11 +53,11 @@ def match_images(args, config_dict):
    cnet = cg.to_cnet(clean_keys=['subpixel'], isis_serials=True)

    filelist = cg.to_filelist()
    write_filelist(filelist, config['outputfile_path'] + args.output_file + '.lis')
    write_filelist(filelist, find_in_dict(config_dict, 'outputfile_path') + args.output_file + '.lis')

    to_isis(config['outputfile_path'] + args.output_file + '.net', cnet, mode='wb', targetname='Moon')
    to_isis(find_in_dict(config_dict, 'outputfile_path') + args.output_file + '.net', cnet, mode='wb', targetname='Moon')

if __name__ == '__main__':
    config = read_config()
    config = read_config('/home/acpaquette/autocnet/.image_match_config.yml')
    command_line_args = parse_arguments()
    match_images(command_line_args, config)