Loading autocnet/fileio/io_yaml.py +4 −2 Original line number Diff line number Diff line try: import yaml except: print 'YAML package not installed, disabling yaml_io module' print('YAML package not installed, disabling yaml_io module') def read_yaml(inputfile): """ Loading @@ -18,7 +18,9 @@ def read_yaml(inputfile): YAML file parsed to a Python dict """ try: ydict = yaml.load(f.read()) with open(inputfile, 'r') as f: doc = yaml.load(f) except: raise IOError('Unable to load YAML file.') return ydict bin/image_match.py +9 −10 Original line number Diff line number Diff line Loading @@ -19,20 +19,20 @@ def read_config(yaml_file): def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-i', action='store', dest='input_file', default='No_Input', help='Provide the name of the file list/adjacency list') parser.add_argument('-o', action='store', dest='output_file', help='Provide the name of the output file') parser.add_argument('-p', action='store', dest='basepath', help='Provide the path to the image files') parser.add_argument('-o', action='store', dest='output_file', help='Provide the name of the output file.') args = parser.parse_args() return args def match_images(args): 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[match_image][inputfile_path] + args.input_file, basepath=config[match_image][basepath]) cg = CandidateGraph.from_adjacency(config['match_image']['inputfile_path'] + args.input_file, basepath=config['match_image']['basepath']) except: cg = CandidateGraph.from_filelist(config[match_image][inputfile_path] + args.input_file) cg = CandidateGraph.from_filelist(config['match_image']['inputfile_path'] + args.input_file) # Apply SIFT to extract features cg.extract_features(method='sift', extractor_parameters={'nfeatures': 1000}) Loading @@ -54,12 +54,11 @@ def match_images(args): cnet = cg.to_cnet(clean_keys=['subpixel'], isis_serials=True) filelist = cg.to_filelist() write_filelist(filelist, config[match_image][outputfile] + args.output_file + '.lis') write_filelist(filelist, config['match_image']['outputfile_path'] + args.output_file + '.lis') to_isis(config[match_image][outputfile] + args.output_file + '.net', cnet, mode='wb', targetname='Moon') to_isis(config['match_image']['outputfile_path'] + args.output_file + '.net', cnet, mode='wb', targetname='Moon') if __name__ == '__main__': config = read_config('/home/acpaquette/test.yml') print(config) # command_line_args = parse_arguments() # match_images(command_line_args) No newline at end of file command_line_args = parse_arguments() match_images(command_line_args, config) No newline at end of file Loading
autocnet/fileio/io_yaml.py +4 −2 Original line number Diff line number Diff line try: import yaml except: print 'YAML package not installed, disabling yaml_io module' print('YAML package not installed, disabling yaml_io module') def read_yaml(inputfile): """ Loading @@ -18,7 +18,9 @@ def read_yaml(inputfile): YAML file parsed to a Python dict """ try: ydict = yaml.load(f.read()) with open(inputfile, 'r') as f: doc = yaml.load(f) except: raise IOError('Unable to load YAML file.') return ydict
bin/image_match.py +9 −10 Original line number Diff line number Diff line Loading @@ -19,20 +19,20 @@ def read_config(yaml_file): def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-i', action='store', dest='input_file', default='No_Input', help='Provide the name of the file list/adjacency list') parser.add_argument('-o', action='store', dest='output_file', help='Provide the name of the output file') parser.add_argument('-p', action='store', dest='basepath', help='Provide the path to the image files') parser.add_argument('-o', action='store', dest='output_file', help='Provide the name of the output file.') args = parser.parse_args() return args def match_images(args): 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[match_image][inputfile_path] + args.input_file, basepath=config[match_image][basepath]) cg = CandidateGraph.from_adjacency(config['match_image']['inputfile_path'] + args.input_file, basepath=config['match_image']['basepath']) except: cg = CandidateGraph.from_filelist(config[match_image][inputfile_path] + args.input_file) cg = CandidateGraph.from_filelist(config['match_image']['inputfile_path'] + args.input_file) # Apply SIFT to extract features cg.extract_features(method='sift', extractor_parameters={'nfeatures': 1000}) Loading @@ -54,12 +54,11 @@ def match_images(args): cnet = cg.to_cnet(clean_keys=['subpixel'], isis_serials=True) filelist = cg.to_filelist() write_filelist(filelist, config[match_image][outputfile] + args.output_file + '.lis') write_filelist(filelist, config['match_image']['outputfile_path'] + args.output_file + '.lis') to_isis(config[match_image][outputfile] + args.output_file + '.net', cnet, mode='wb', targetname='Moon') to_isis(config['match_image']['outputfile_path'] + args.output_file + '.net', cnet, mode='wb', targetname='Moon') if __name__ == '__main__': config = read_config('/home/acpaquette/test.yml') print(config) # command_line_args = parse_arguments() # match_images(command_line_args) No newline at end of file command_line_args = parse_arguments() match_images(command_line_args, config) No newline at end of file