Commit 4ad0c57e authored by Adam Paquette's avatar Adam Paquette
Browse files

Almost finished arg parse information

parent ab4b75d6
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -11,17 +11,27 @@ from autocnet.fileio.io_controlnetwork import write_filelist
# parses command line arguments into a single args variable
def parse_arguments():
    parser = argparse.ArgumentParser()
    parser.add_argument('input_filename', action='store', help='Provide the name of the file list/adjacency list')
    parser.add_argument('output_filename', action='store', help='Provide the name of the output file')
    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('-l', '--list', nargs='*', dest='list', default=[], required=False)
    args = parser.parse_args()
    print(args)
    print(len(args.list))

    return args


def match_images(args):

    # Matches the images in the input file using various candidate graph methods
    # produces two files usable in isis
    cg = CandidateGraph.from_adjacency(args.input_filename, basepath='')
    if len(args.list) > 1:
        cg = CandidateGraph.from_filelist(args.list)
    else:
        try:
            cg = CandidateGraph.from_adjacency(args.input_file, basepath='/home/acpaquette/Desktop/')
        except:
            cg = CandidateGraph.from_filelist(args.input_file)

    # Apply SIFT to extract features
    cg.extract_features(method='sift', extractor_parameters={'nfeatures': 1000})
@@ -45,18 +55,18 @@ def match_images(args):
    cnet = cg.to_cnet(clean_keys=['subpixel'], isis_serials=True)

    filelist = cg.to_filelist()
    write_filelist(filelist, args.output_filename + '.lis')
    write_filelist(filelist, args.output_file + '.lis')

    to_isis(args.output_filename + '.net', cnet, mode='wb', targetname='Moon')
    to_isis(args.output_file + '.net', cnet, mode='wb', targetname='Moon')

if __name__ == '__main__':
    command_line_args = parse_arguments()
    match_images(command_line_args)


'''
    file = CandidateGraph.from_filelist(["/home/acpaquette/Desktop/AS15-M-0414_sub4.cub",
      "/home/acpaquette/Desktop/AS15-M-0413_sub4.cub",
      "/home/acpaquette/Desktop/AS15-M-0412_sub4.cub"])

    file2 = CandidateGraph.from_filelist('/home/acpaquette/autocnet/autocnet/examples/Apollo15/user_image_list.json')
    print(file2)
 No newline at end of file
'''
 No newline at end of file