In [1]:
import ee
ee.Initialize()
In [2]:
from IPython.display import Image
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
from IPython.display import HTML
In [3]:
image = ee.Image('LT5_L1T_8DAY_EVI/20110618')
# Define the region of interest
point = ee.Geometry.Point(-101.05259, 37.93418)
region = point.buffer(10000).bounds().getInfo()['coordinates']
canny = ee.Algorithms.CannyEdgeDetector(image, 0.7)
# Mask the image with itself to get rid of 0 pixels.
canny = canny.mask(canny)
combined = ee.ImageCollection([
image.visualize(min=0, max=1, forceRgbOutput=True),
canny.visualize(min=0, max=1, palette=["FF0000"], forceRgbOutput=True)
]).mosaic()
url = combined.getThumbUrl({'region':region})
print(url)
display(Image(url=url))
In [4]:
def edit_image(image, threshold=0.25):
canny = ee.Algorithms.CannyEdgeDetector(image, threshold)
canny = canny.mask(canny)
combined = ee.ImageCollection([
#image.visualize(min=0, max=1, forceRgbOutput=True),
canny.visualize(min=0, max=1, palette=["FF0000"], forceRgbOutput=True)
]).mosaic()
new_image = Image(url=combined.getThumbUrl({'region':region}))
display(new_image)
return new_image
In [5]:
slider = interactive(edit_image, image=fixed(image), threshold=(0.0,1.5,0.25))
display(slider)
In [ ]: