openpiv.preprocess.dynamic_masking

openpiv.preprocess.dynamic_masking(image, method='edges', filter_size=7, threshold=0.005)[source]

Dynamically masks out the objects in the PIV images

Parameters
  • image (image) – a two dimensional array of uint16, uint8 or similar type

  • method (string) – ‘edges’ or ‘intensity’: ‘edges’ method is used for relatively dark and sharp objects, with visible edges, on dark backgrounds, i.e. low contrast ‘intensity’ method is useful for smooth bright objects or dark objects or vice versa, i.e. images with high contrast between the object and the background

  • filter_size (integer) – a scalar that defines the size of the Gaussian filter

  • threshold (float) – a value of the threshold to segment the background from the object default value: None, replaced by sckimage.filter.threshold_otsu value

Returns

  • image (array of the same datatype as the incoming image with the)

  • object masked out

  • as a completely black region(s) of zeros (integers or floats).

Example

frame_a = openpiv.tools.imread( ‘Camera1-001.tif’ ) imshow(frame_a) # original

frame_a = dynamic_masking(frame_a,method=’edges’,filter_size=7, threshold=0.005) imshow(frame_a) # masked