Commit 582a8127 authored by Adam Paquette's avatar Adam Paquette
Browse files

final implementation of the various overlap methods

parent 46db6bdc
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ import json
import ogr
import pandas as pd

from autocnet.fileio import io_gdal
from scipy.spatial import ConvexHull


@@ -61,9 +60,9 @@ def convex_hull(points):

    Returns
    -------
    hull_poly : ogr
             an ogr polygon that is built out of
             the convex_hull
    hull : 2-D convex hull
            Provides a convex hull that is used
            to determine coverage

    """

@@ -73,6 +72,7 @@ def convex_hull(points):
    hull = ConvexHull(points)
    return hull


def two_poly_overlap(poly1, poly2):
    """

@@ -89,7 +89,8 @@ def two_poly_overlap(poly1, poly2):
    Returns
    -------
     overlap_info : list
            The ratio convex hull volume / ideal_area
            Percentage of overlap between the two images
            and the area that is being overlapped

    """
    a_o = poly2.Intersection(poly1).GetArea()
+5 −2
Original line number Diff line number Diff line
import warnings
from collections import MutableMapping
import json
import ogr

import numpy as np
import pandas as pd
@@ -422,6 +420,11 @@ class Edge(dict, MutableMapping):
        return matches, mask

    def overlap(self):
        """
        Acts on an edge and returns the overlap area and percentage of overlap
        between the two images on the edge. Data is returned to the
        weight dictionary
        """
        poly1 = self.source.geodata.footprint
        poly2 = self.destination.geodata.footprint

+12 −3
Original line number Diff line number Diff line
from collections import MutableMapping
import os
import warnings
import json
import ogr

import numpy as np
import pandas as pd
from scipy.misc import bytescale
from scipy.spatial import ConvexHull

from autocnet.cg import cg
from autocnet.fileio.io_gdal import GeoDataset
@@ -119,6 +116,18 @@ class Node(dict, MutableMapping):
        return self._isis_serial

    def coverage(self):
        """
        Determines the area of keypoint coverage
        using the unprojected image, resulting
        in a rough estimation of the area being covered.

        Returns
        -------
        coverage_area :  float
                        Area covered by the generated
                        keypoints
        """

        points = self.get_keypoint_coordinates()
        hull = cg.convex_hull(points)
        hull_area = hull.volume
+0 −2
Original line number Diff line number Diff line
@@ -7,8 +7,6 @@ import warnings
import numpy as np
import pandas as pd

from autocnet.graph.network import CandidateGraph
from autocnet.graph import node
from autocnet.examples import get_path
from autocnet.fileio.io_gdal import GeoDataset