Commit 89d6a4bc authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by GitHub
Browse files

Updates to hirise change detection (#411)

* added hirise coreg + updated to_isis to match network version

* updated matcher

* faster match, hirise update

* added okubo method

* things workin

* updated hirise notebook

* updated okubogar

* patched some things up

* added example images
parent 02fd6e4a
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line

import numpy as np
from matplotlib.path import Path
from shapely.geometry import Point, MultiPoint
@@ -11,18 +10,24 @@ from autocnet.utils.utils import bytescale
from autocnet.matcher.cpu_extractor import extract_features

def image_diff(arr1, arr2):
     arr1 = arr1.astype("float32")
     arr2 = arr2.astype("float32")
     arr1[arr1 == 0] = np.nan
     arr2[arr2 == 0] = np.nan

     diff = arr1-arr2
     diff[np.isnan(diff)] = 0

    bdiff = bytescale(diff)
    return bdiff
     return bytescale(diff)


def okubogar_detector(image1, image2, nbins=50, extractor_method="orb", extractor_kwargs={"nfeatures": 2000, "scaleFactor": 1.1, "nlevels": 1}, image_func=image_diff):
def okubogar_detector(image1, image2, nbins=50, extractor_method="orb", extractor_kwargs={"nfeatures": 2000, "scaleFactor": 1.1, "nlevels": 1}, cluster_params={"min_samples": 10, "max_eps": 10, "eps": .5, "xi":.5},  image_func=image_diff):
     arr1 = image1.read_array()
     arr2 = image2.read_array()
    arr1[arr1 == arr1.min()] = np.nan
    arr2[arr2 == arr2.min()] = np.nan
     arr1[arr1 == arr1.min()] = 0
     arr2[arr2 == arr2.min()] = 0
     arr1 = bytescale(arr1)
     arr2 = bytescale(arr2)

     bdiff = image_func(arr1, arr2)

@@ -31,7 +36,7 @@ def okubogar_detector(image1, image2, nbins=50, extractor_method="orb", extracto

     points = [Point(xval, yval) for xval,yval in zip(x,y)]

    optics = OPTICS(min_samples=10, max_eps=20,  eps=.3, p=2, xi=.5).fit(list(zip(x,y)))
     optics = OPTICS(**cluster_params).fit(list(zip(x,y)))

     classes = gpd.GeoDataFrame(columns=["label", "point"], geometry="point")
     classes["label"] = optics.labels_
@@ -63,4 +68,5 @@ def okubogar_detector(image1, image2, nbins=50, extractor_method="orb", extracto
         polys.append(poly)
         weights.append(weight)

    return polys, weights
     return polys, weights, bdiff
+2.14 MiB

File added.

Preview size limit exceeded, changes collapsed.

+2.14 MiB

File added.

Preview size limit exceeded, changes collapsed.

+210 −332

File changed.

Preview size limit exceeded, changes collapsed.