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.

ModeYAML ValueDescriptionStorage
PolygonfileDraw arbitrary polygons on the image. Multiple polygons combined into one mask.mask_CamN.mat per camera
Pixel BorderrectangularMask 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

  1. Select source path, camera, and image index, then click Load Image.
  2. Click on the image to place polygon vertices (shown in green).
  3. After 3+ points, click the red starting point to close the polygon. It turns orange and a new polygon starts automatically.
  4. 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

ButtonAction
New PolygonStart a fresh polygon (auto-finishes current)
Undo PointRemove the last point from active polygon
DeleteDelete the currently selected polygon
Prev / NextNavigate between polygons
MagnifierToggle 2.5x zoom tool
Save PNGDownload mask as PNG image
Clear MaskRemove 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: 0

Mask Storage

FormatLocationContents
Standard imagessource_path/mask_Cam1.matBinary mask + polygon vertices + names
LaVision .set files{name}_data/mask_{name}_Cam1.matSame 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 ControlYAML FieldValues
Apply Mask for PIVmasking.enabledtrue / false
Masking Modemasking.mode'file' or 'rectangular'
Top / Bottom / Left / Rightmasking.rectangular.*integer >= 0 (pixels)
Mask file patternmasking.mask_file_patternString with %d for camera
Mask thresholdmasking.mask_thresholdfloat (default 0.01)

Next: Pre-Processing Filters

Apply temporal and spatial filters to enhance images before PIV processing.

Continue to Pre-Processing