Open dmkahler opened 1 year ago
Next steps:
Contrast and contour finding in progress with Canny. Searching edge of river perpendicular to the center-line of the river.
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]
Grabbing transect from scikit-image
https://goodboychan.github.io/python/datacamp/vision/2020/08/02/01-Filters-Contrast-Transformation-and-Morphology.html