Commit ab4b75d6 authored by Adam Paquette's avatar Adam Paquette
Browse files

updated from_filelist in network to work with user input, modulated image_match

parent fd59d956
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -97,6 +97,10 @@ class CandidateGraph(nx.Graph):
        : object
          A Network graph object
        """
        if not isinstance(filelist, list):
            with open(filelist, 'r') as f:
                filelist = f.readlines()
                filelist = map(str.rstrip, filelist)

        # TODO: Reject unsupported file formats + work with more file formats

+41 −19
Original line number Diff line number Diff line
@@ -8,9 +8,20 @@ from autocnet.graph.network import CandidateGraph
from autocnet.fileio.io_controlnetwork import to_isis
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')
    args = parser.parse_args()

    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(sys.argv[1], basepath='')
    cg = CandidateGraph.from_adjacency(args.input_filename, basepath='')

    # Apply SIFT to extract features
    cg.extract_features(method='sift', extractor_parameters={'nfeatures': 1000})
@@ -34,7 +45,18 @@ cg.suppress(clean_keys=['fundamental'], k=50)
    cnet = cg.to_cnet(clean_keys=['subpixel'], isis_serials=True)

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

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

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


to_isis('TestFile.net', cnet, mode='wb', targetname='Moon')
    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