Created
November 20, 2015 09:32
-
-
Save robintw/f676172b934074c39be4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import numpy as np | |
import gdal | |
from mycanny import mycanny | |
input_image = sys.argv[1] | |
print(input_image) | |
input_image = gdal.Open(input_image) | |
input_image = input_image.GetRasterBand(1).ReadAsArray() | |
print("Got image") | |
print(np.nanmax(input_image)) | |
print(np.nanmean(input_image)) | |
edges, thresholds = mycanny(input_image, low_threshold=0.7, high_threshold=0.85, mask=np.isfinite(input_image)) | |
print("Using calculated thresholds of: ") | |
print(thresholds) | |
print("Found %d edges" % edges[edges > 0].sum()) | |
edges, thresholds = mycanny(input_image, low_threshold=thresholds[0], | |
high_threshold=thresholds[1], abs_thresh=True, mask=np.isfinite(input_image)) | |
print("Using absolute thresholds of: ") | |
print(thresholds) | |
print("Found %d edges" % edges[edges > 0].sum()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment