hydro-lab / satellite-gage

LRL remote sensing river gage development
2 stars 0 forks source link

Work on edge detection of the river #19

Open dmkahler opened 1 year ago

dmkahler commented 1 year ago

https://goodboychan.github.io/python/datacamp/vision/2020/08/02/01-Filters-Contrast-Transformation-and-Morphology.html

lasugden commented 1 year ago

https://scikit-image.org/docs/stable/api/skimage.exposure.html#

dmkahler commented 1 year ago

Next steps:

dmkahler commented 1 year ago

Contrast and contour finding in progress with Canny. Searching edge of river perpendicular to the center-line of the river.

dmkahler commented 1 year ago

Extract the values along the perpendicular (response from chatGPT):

from rasterio.features import geometry_mask

# Define your line as a GeoJSON-like dictionary with "type" and "coordinates".
# For example, a line with two points [(x1, y1), (x2, y2)]:
line = {
    "type": "LineString",
    "coordinates": [(x1, y1), (x2, y2)]
}

# Create a mask for the line.
mask = geometry_mask([line], out_shape=src.shape, transform=src.transform)

# Read the raster values along the line.
values = src.read(1, masked=True)  # Replace '1' with the band you want to read.
line_values = values[mask]
dmkahler commented 1 year ago

Grabbing transect from scikit-image