From bc83e609100b39453c14cf418ca44d54230b9e53 Mon Sep 17 00:00:00 2001 From: asreva Date: Wed, 20 May 2026 15:18:10 +0200 Subject: [PATCH] Improve README clarity and add defaults to controls - Expand Controls intro with two-panel layout description - Add brush size range/default and mask alpha range/default to tables - Split 'Starting-point shortcuts' (Load Prev Mask, Auto Segment) from mask editing table - Trim 'How it works' mask drawing section to remove implementation internals - Enable optical_flow_config_file in config.example.yaml Co-Authored-By: Claude Sonnet 4.6 --- README.md | 27 +++++++++++++-------------- config/config.example.yaml | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 266daf2..71db46f 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Copy `config/clips.example.txt` as a starting point. ## Controls -The window shows the video on the left (auto-playing) and the survey panel on the right. +The window is split into two panels: the **video canvas** on the left (~70% of the width) and the **survey panel** on the right. The video auto-plays as a looping preview. Drawing tools and mask controls are arranged above and beside the canvas; navigation buttons (**Previous / Next / Skip**) sit at the top. ### Tool modes @@ -159,7 +159,7 @@ Three drawing tools are available in the tool row. The active tool is highlighte | Draw water mask | Click and drag on the video | | Erase mask | Toggle **Eraser** button (turns orange when active), then drag | | Brush preview | A white circle follows the cursor showing the current brush size | -| Adjust brush size | **Brush size** slider; click **↺** to reset | +| Adjust brush size | **Brush size** slider (2–50 px, default 5); click **↺** to reset | ### Polygon tool @@ -183,7 +183,7 @@ Polygons are drawn as overlays and do not affect the mask until you use **Fill** | Innermost shape | Clicking inside nested shapes always fills the innermost (smallest) polygon containing the click | | Undo fill | **Undo** — each fill is a single undoable step | -### Common mask actions +### Mask editing | Action | How | |---|---| @@ -192,9 +192,14 @@ Polygons are drawn as overlays and do not affect the mask until you use **Fill** | Redo | **Redo** | | Clear entire mask | **Clear** | | Toggle mask overlay | **Hide Mask / Show Mask** — button turns red when hidden; does not affect mask data | -| Mask transparency | **Mask Alpha** slider; click **↺** to reset | -| Load mask from previous clip | **Load Prev Mask** — copies the saved mask of the previous clip; undoable with **Undo** | -| Optical flow first guess | **Auto Segment** — runs automatic river segmentation and replaces the current mask; undoable with **Undo**. Only enabled when `optical_flow_config_file` is set in `config.yaml`. | +| Mask transparency | **Mask Alpha** slider (0–100%, default 40%); click **↺** to reset | + +### Starting-point shortcuts + +| Action | How | +|---|---| +| Load mask from previous clip | **Load Prev Mask** — copies the saved mask of the previous clip onto the current one; undoable | +| Optical flow first guess | **Auto Segment** — replaces the current mask with an automatic river segmentation; undoable. Only available when `optical_flow_config_file` is set in `config.yaml`. | ### Image display adjustments @@ -264,15 +269,9 @@ Up to `max_frames` frames are extracted from the video and scaled so the longest ### Mask drawing -The mask is a binary NumPy array matching the display frame size. +The mask is a binary array at display resolution. **Brush** strokes stamp a filled circle (draw or erase). **Polygon** shapes are stored as overlays and don't touch the mask until a **Fill** click rasterises them — the innermost polygon containing the click is filled, and any polygon whose centroid falls inside it is punched out as a hole. -**Brush:** each stroke stamps a filled circle of the selected radius, setting pixels to 1 (draw) or 0 (erase). - -**Polygon:** vertices are stored as a list of floating-point canvas coordinates. Multiple closed shapes can coexist. Completed shapes are rendered as cyan overlays on the canvas but do not touch the mask until a fill is applied. - -**Fill:** clicking inside a closed polygon rasterises it with `cv2.fillPoly` and ORs the result into the mask. Among all shapes containing the click, the innermost (smallest area, determined by `cv2.contourArea`) is selected as the fill target. Any polygon whose centroid lies inside the target is then punched out as a hole. - -Every mask-changing operation (brush stroke, fill) pushes the previous mask onto the undo stack before modifying it. On save the mask is resized to the original video resolution with nearest-neighbour interpolation and written as an 8-bit PNG (0 or 255). +Every mask-changing operation is pushed onto an undo stack before it executes. On save, the mask is upscaled to the original video resolution and written as an 8-bit PNG (0 or 255). ### Resuming diff --git a/config/config.example.yaml b/config/config.example.yaml index 28abc59..2862383 100644 --- a/config/config.example.yaml +++ b/config/config.example.yaml @@ -19,7 +19,7 @@ max_frames: 100 data_dir: data/filtered_data out_dir: data/annotation_results clips_file: config/clips.txt -# optical_flow_config_file: config/optical_flow_config.yaml +optical_flow_config_file: config/optical_flow_config.yaml questions: - section: River