Commit d140ae4f authored by Kelvin's avatar Kelvin
Browse files
parents e3054a90 705ad212
Loading
Loading
Loading
Loading
+3 −8
Changes for .travis.yml: 3 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ sudo: false
branches:
only:
  - master
  - dev

python:
  - "3.5"
@@ -28,9 +27,9 @@ install:
  - conda info -a

  # Create a virtual env and install dependencies
  # conda is explicitly included here to try to get it into a non-root env.  It is NOT needed outside of CI testing and binstar upload.
  - conda install python=3.5 nose numpy pillow scipy pandas networkx scikit-image sqlalchemy numexpr dill cython pyyaml

  - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose numpy pillow scipy pandas networkx scikit-image sqlalchemy numexpr dill cython pyyaml
  # Activate the env
  - source activate test-env

  # Install the non-conda packages if required, requirements.txt duplicates are ignored
  - conda install -c https://conda.anaconda.org/jlaura opencv3=3.0.0
@@ -44,15 +43,11 @@ install:
  - pip install coveralls
  - python runipynbs.py

  # Install libs to support upload to binstar
  - conda install anaconda-client binstar conda-build

script:
  - nosetests --with-coverage --cover-package=autocnet

after_success:
  - coveralls
  - python ci_support/upload_or_check_non_existence.py ci_support jlaura --channel=main

notifications:
  webhooks:
+22 −0
Changes for autocnet/cg/cg.py: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -77,3 +77,25 @@ def two_poly_overlap(poly1, poly2):
    overlap_area = a_o
    overlap_percn = (a_o / (area1 + area2 - a_o)) * 100
    return overlap_percn, overlap_area


def get_area(poly1, poly2):
    """

    Parameters
    ----------
    poly1 : ogr polygon
            General ogr polygon

    poly2 : ogr polygon
            General ogr polygon

    Returns
    -------
    intersection_area : float
                        returns the intersection area
                        of two polygons

    """
    intersection_area = poly1.Intersection(poly2).GetArea()
    return intersection_area
+0 −1
Changes for autocnet/fileio/io_gdal.py: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -465,7 +465,6 @@ class GeoDataset(object):
            array = band.ReadAsArray(xstart, ystart, xextent, yextent).astype(dtype)
        return array


def array_to_raster(array, file_name, projection=None,
                    geotransform=None, outformat='GTiff',
                    ndv=None):
+39 −0
Changes for autocnet/graph/edge.py: 39 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ from collections import MutableMapping
import numpy as np
import pandas as pd

from autocnet.utils import utils
from autocnet.matcher import health
from autocnet.matcher import outlier_detector as od
from autocnet.matcher import suppression_funcs as spf
@@ -423,3 +424,41 @@ class Edge(dict, MutableMapping):
        self.weight['overlap_area'] = overlapinfo[1]
        self.weight['overlap_percn'] = overlapinfo[0]

    def coverage(self, clean_keys = []):
        """
        Acts on the edge given either the source node
        or the destination node and returns the percentage
        of overlap covered by the keypoints. Data for the
        overlap is gathered from the source node of the edge
        resulting in a maximum area difference of 2% when compared
        to the destination.

        Returns
        -------
        total_overlap_percentage : float
                                   returns the overlap area
                                   covered by the keypoints
        """
        if self.matches is None:
            raise AttributeError('Edge needs to have features extracted and matched')
            return
        matches, mask = self._clean(clean_keys)
        source_array = self.source.get_keypoint_coordinates(index=matches['source_idx']).values

        source_coords = self.source.geodata.latlon_corners
        destination_coords = self.destination.geodata.latlon_corners

        convex_hull = cg.convex_hull(source_array)

        convex_points = [self.source.geodata.pixel_to_latlon(row[0], row[1]) for row in convex_hull.points[convex_hull.vertices]]
        convex_coords = [(x, y) for x, y in convex_points]

        source_poly = utils.array_to_poly(source_coords)
        destination_poly = utils.array_to_poly(destination_coords)
        convex_poly = utils.array_to_poly(convex_coords)

        intersection_area = cg.get_area(source_poly, destination_poly)

        total_overlap_coverage = (convex_poly.GetArea()/intersection_area)

        return total_overlap_coverage
+1 −1
Changes for autocnet/graph/node.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -404,7 +404,7 @@ class Node(dict, MutableMapping):
        if not hasattr(self, '_keypoints'):
            raise AttributeError('No keypoints extracted for this node.')

        domain = self.geodata.raster_size
        domain = self.handle.raster_size
        self._keypoints['strength'] = self._keypoints.apply(func, axis=1)

        if not hasattr(self, 'suppression'):
Loading