Image Masking
Define regions to exclude from PIV processing. Masked regions produce zero-valued vectors in output fields.
Masking Modes
Two modes are available, selected from the Masking Mode dropdown. Toggle Apply Mask for PIV to activate masking during processing.
| Mode | YAML Value | Description | Storage |
|---|---|---|---|
| Polygon | file | Draw arbitrary polygons on the image. Multiple polygons combined into one mask. | mask_CamN.mat per camera |
| Pixel Border | rectangular | Mask fixed pixel borders from each image edge. | config.yaml |
Polygon Mask Editor
Interactive canvas for drawing mask regions on PIV images. Supports multiple polygons, edge snapping, and a magnifier for precise placement.
Drawing Workflow
- Select source path, camera, and image index, then click Load Image.
- Click on the image to place polygon vertices (shown in green).
- After 3+ points, click the red starting point to close the polygon. It turns orange and a new polygon starts automatically.
- Repeat to add more polygons. All closed polygons combine into a single mask.
Edge Snapping
Click in the padding area outside the image to snap points to the nearest edge or corner. The magnifier border turns orange in the snap zone.
Magnifier
2.5x zoomed view following the cursor with crosshairs at the exact click position. Toggle via the magnifier button in the toolbar.
Toolbar Controls
| Button | Action |
|---|---|
| New Polygon | Start a fresh polygon (auto-finishes current) |
| Undo Point | Remove the last point from active polygon |
| Delete | Delete the currently selected polygon |
| Prev / Next | Navigate between polygons |
| Magnifier | Toggle 2.5x zoom tool |
| Save PNG | Download mask as PNG image |
| Clear Mask | Remove all polygons and reset |
Auto-save: Masks save automatically to mask_CamN.mat when you complete, delete, or clear a polygon. No manual save needed.
Pixel Border Mode
Mask fixed rectangular regions from each image edge. Enter pixel values for top, bottom, left, and right. The preview updates live with a red overlay showing excluded regions.
Values are saved automatically to config.yaml. Same settings apply to all cameras.
masking:
enabled: true
mode: rectangular
rectangular:
top: 64
bottom: 64
left: 0
right: 0Mask Storage
| Format | Location | Contents |
|---|---|---|
| Standard images | source_path/mask_Cam1.mat | Binary mask + polygon vertices + names |
| LaVision .set files | {name}_data/mask_{name}_Cam1.mat | Same contents, in sibling directory |
Per-camera masks: Each camera has its own mask file. In stereo setups, create separate masks for Cam1 and Cam2. Switch cameras with the Camera dropdown; the correct mask loads automatically.
Export
Polygon masks auto-save as .mat files for PIV processing. The Save PNG toolbar button exports a full-resolution binary image for documentation.
YAML Reference
masking:
enabled: true # Toggle masking for PIV
mode: file # 'file' (polygon) or 'rectangular' (pixel border)
mask_file_pattern: mask_Cam%d.mat # %d = camera number
mask_threshold: 0.01 # Fraction of window that must be masked
rectangular:
top: 0
bottom: 0
left: 0
right: 0| GUI Control | YAML Field | Values |
|---|---|---|
| Apply Mask for PIV | masking.enabled | true / false |
| Masking Mode | masking.mode | 'file' or 'rectangular' |
| Top / Bottom / Left / Right | masking.rectangular.* | integer >= 0 (pixels) |
| Mask file pattern | masking.mask_file_pattern | String with %d for camera |
| Mask threshold | masking.mask_threshold | float (default 0.01) |
Next: Pre-Processing Filters
Apply temporal and spatial filters to enhance images before PIV processing.
Continue to Pre-Processing