Segmenting satellite imagery provided by the Maxar Open Data Program
This article demonstrates how to segment satellite imagery from the Maxar Open Data Program for the Libya floods.
The Maxar Open Data Program offers high-resolution satellite imagery before and after events to assist with emergency planning, risk assessment, monitoring staging areas, emergency response, damage evaluation, and recovery efforts. Explore the links below for more details.
Install libraries
# %pip install segment-geospatial
import os
import leafmap
from samgeo import SamGeo, raster_to_vector, overlay_images
Download sample data
First, let’s download a sample image of Derna, Libya from the source here.
url = "https://github.com/opengeos/datasets/releases/download/raster/Derna_sample.tif"
leafmap.download_file(url, output="image.tif")
Make an interactive map
m = leafmap.Map(height="600px")
m.add_basemap("SATELLITE")
m.add_raster("image.tif", layer_name="Image")
m.add_layer_manager()
m
Initialize SAM
Automatic mask generation includes several adjustable parameters that influence the density of point sampling and the thresholds for discarding low-quality or duplicate masks. Additionally, the process can automatically run on image crops to enhance performance for smaller objects, and…