Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on edge detection of the river #19

Open
dmkahler opened this issue Sep 26, 2023 · 6 comments
Open

Work on edge detection of the river #19

dmkahler opened this issue Sep 26, 2023 · 6 comments

Comments

@dmkahler
Copy link
Member

No description provided.

@lasugden
Copy link

@dmkahler
Copy link
Member Author

dmkahler commented Sep 26, 2023

Next steps:

  • Boost contrast for current contour method
  • Attempt width or area measurement

@dmkahler
Copy link
Member Author

dmkahler commented Oct 24, 2023

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

@dmkahler
Copy link
Member Author

dmkahler commented Oct 24, 2023

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
Copy link
Member Author

dmkahler commented Nov 7, 2023

Grabbing transect from scikit-image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants