Commit 6a473e31 authored by jay's avatar jay
Browse files

Three image support added

parent 4739b95d
Loading
Loading
Loading
Loading
+6 −0
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"]}
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ def to_isis(path, C, mode='w', version=VERSION,

            store.write(header)


class IsisStore(object):
    """
    Class to manage IO of an ISIS control network (version 2).
+39 −5
Original line number Diff line number Diff line
from functools import reduce
import operator as op
import os

import networkx as nx
@@ -15,6 +13,7 @@ from autocnet.fileio.io_gdal import GeoDataset
from autocnet.matcher import feature_extractor as fe # extract features from image
from autocnet.matcher import outlier_detector as od


class CandidateGraph(nx.Graph):
    """
    A NetworkX derived directed graph to store candidate overlap images.
@@ -252,14 +251,46 @@ class CandidateGraph(nx.Graph):
        """
        Generate a control network (C) object from a graph

        Parameters
        ----------
        clean_keys : list
             of strings identifying the masking arrays to use, e.g. ratio, symmetry

        Returns
        -------
        merged_cnet : C
                      A control network object
        """

        clean_keys : list
                     of strings identifying the masking arrays to use, e.g. ratio, symmetry
        def _validate_cnet(cnet):
            """
            Once the control network is aggregated from graph edges,
            ensure that a given correspondence in a given image does
            not match multiple correspondences in a different image.

            Parameters
            ----------
            cnet : C
                   control network object

            Returns
            -------
             : C
               the cleaned control network
            """

            mask = np.zeros(len(cnet), dtype=bool)
            counter = 0
            for i, group in cnet.groupby('pid'):
                group_size = len(group)
                if len(group) != len(group['nid'].unique()):
                    mask[counter: counter + group_size] = False
                else:
                    mask[counter: counter + group_size] = True
                counter += group_size

            return cnet[mask]

        merged_cnet = None

        for source, destination, attributes in self.edges_iter(data=True):
@@ -317,6 +348,9 @@ class CandidateGraph(nx.Graph):
                merged_cnet = pd.concat([merged_cnet, cnet])
                merged_cnet.drop_duplicates(['idx', 'pid'], keep='first', inplace=True)

        # Final validation to remove any correspondence with multiple correspondences in the same image
        merged_cnet = _validate_cnet(merged_cnet)

        return merged_cnet

    def to_json_file(self, outputfile):
+0 −3
Original line number Diff line number Diff line
@@ -41,9 +41,6 @@ def pattern_match(template, image, upsampling=10,

    strength : float
               The strength of the correlation in the range [-1, 1].



    """
    if upsampling < 1:
        raise ValueError
+4 −2
Original line number Diff line number Diff line
@@ -12,8 +12,10 @@ from autocnet.fileio import io_gdal


class TestFeatureExtractor(unittest.TestCase):
    def setUp(self):
        self.dataset = io_gdal.GeoDataset(get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif'))

    @classmethod
    def setUpClass(self):
        self.dataset = io_gdal.GeoDataset(get_path('AS15-M-0295_SML.png'))
        self.data_array = self.dataset.read_array()
        self.parameters = {"nfeatures" : 10,
                           "nOctaveLayers" : 3,
Loading