Commit 8ad1e162 authored by Jay's avatar Jay Committed by jay
Browse files

PATH updates.

parent 21bcdc67
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
{"autocnet/examples/Apollo15/AS15-M-0297_SML.png": ["autocnet/examples/Apollo15/AS15-M-0298_SML.png",
                                                    "autocnet/examples/Apollo15/AS15-M-0299_SML.png"],
"autocnet/examples/Apollo15/AS15-M-0298_SML.png": ["autocnet/examples/Apollo15/AS15-M-0297_SML.png",
                                                   "autocnet/examples/Apollo15/AS15-M-0299_SML.png"],
"autocnet/examples/Apollo15/AS15-M-0299_SML.png": ["autocnet/examples/Apollo15/AS15-M-0297_SML.png",
                                                   "autocnet/examples/Apollo15/AS15-M-0298_SML.png"]}
{"AS15-M-0297_SML.png": ["AS15-M-0298_SML.png", "AS15-M-0299_SML.png"],
"AS15-M-0298_SML.png": ["AS15-M-0297_SML.png", "AS15-M-0299_SML.png"],
"AS15-M-0299_SML.png": ["AS15-M-0297_SML.png", "AS15-M-0298_SML.png"]}
+8 −3
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ class CandidateGraph(nx.Graph):
    ----------
    """

    def __init__(self,*args, **kwargs):
    def __init__(self,*args, basepath=None, **kwargs):
        super(CandidateGraph, self).__init__(*args, **kwargs)
        self.node_counter = 0
        node_labels = {}
@@ -403,7 +403,7 @@ class CandidateGraph(nx.Graph):
            self.edge[s][d] = Edge(self.node[s], self.node[d])

    @classmethod
    def from_adjacency(cls, input_adjacency):
    def from_adjacency(cls, input_adjacency, basepath=None):
        """
        Instantiate the class using an adjacency dict or file. The input must contain relative or
        absolute paths to image files.
@@ -426,6 +426,11 @@ class CandidateGraph(nx.Graph):
        """
        if not isinstance(input_adjacency, dict):
            input_adjacency = io_json.read_json(input_adjacency)
            if basepath is not None:
                for k, v in input_adjacency.items():
                    input_adjacency[k] =  [os.path.join(basepath, i) for i in v]
                    input_adjacency[os.path.join(basepath, k)] = input_adjacency.pop(k)

        return cls(input_adjacency)

    def get_name(self, node_index):
+2 −1
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ class TestThreeImageMatching(unittest.TestCase):
    def test_three_image(self):
        # Step: Create an adjacency graph
        adjacency = get_path('three_image_adjacency.json')
        cg = CandidateGraph.from_adjacency(adjacency)
        basepath = get_path('Apollo15')
        cg = CandidateGraph.from_adjacency(adjacency, basepath)
        self.assertEqual(3, cg.number_of_nodes())
        self.assertEqual(3, cg.number_of_edges())

+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ class TestTwoImageMatching(unittest.TestCase):
    def test_two_image(self):
        # Step: Create an adjacency graph
        adjacency = get_path('two_image_adjacency.json')
        cg = CandidateGraph.from_adjacency(adjacency)
        basepath = get_path('Apollo15')
        cg = CandidateGraph.from_adjacency(adjacency, basepath=basepath)
        self.assertEqual(2, cg.number_of_nodes())
        self.assertEqual(1, cg.number_of_edges())

+1 −1

File changed.

Contains only whitespace changes.