fluidimage.works.surface_tracking#

Surface tracking#

class fluidimage.works.surface_tracking.WorkSurfaceTracking(params)[source]#

Bases: BaseWork

Main work for surface tracking

Parameters:
paramsfluiddyn.util.paramcontainer.ParamContainer

The default parameters are obtained from the class method WorkSurfaceTracking.create_default_params().

classmethod create_default_params()[source]#

Create an object containing the default parameters (class method).

classmethod _complete_params_with_default(params)[source]#

Complete an object with the default params

compute_kx(serie)[source]#

calculates the average wave vector from a set of reference images

Parameters:
series: int
set of reference frames (arrays)
Returns:
wave_vector: float

average wave vector from the reference frame

set_gain_filter(k_x, l_y, l_x, slicer)[source]#

compute gain and filter

get_borders(frame)[source]#

find the left and right border of the surface in a given frame

Parameters:
frame: int

frame of the high speed video (np.array)

Returns:
xmin: int

left border of the structure

xmax: int

right border of the structure

merge_cropped_frame(frame, x_min, x_max)[source]#

puts the actual frame in the reference plate frame to avoid jerks and to keep the dimensions

Parameters:
frame: int

frame of the high speed video (np.array)

Returns:
calc_frame: int

frame of the reference size with embedded smaller structure

rectify_frame(frame, gain, filt)[source]#

rectify a frame with gain and filt

Parameters:
frame: int

frame of the high speed video (np.array)

gain: complex array

gain for the pattern of the frame

filt: complex array

filter for the pattern of the frame gain:

Returns:
rectified frame: int

array of the rectified frame

frame_normalize(frame)[source]#

normalize the frame values by its mean value

Parameters:
frame: int

frame of the high speed video (np.array)

Returns:
normalized_frame: int

normalized frame of the high speed video (np.array)

process_frame(frame, ymin, ymax, xmin, xmax, gain, filt, red_factor)[source]#

process a frame and return phase Parameters ———-

frame: int array

single frame of the high speed video

xmin: int (default 475)

xmin to crop the image im[xmin:xmax, ymin:ymax]

xmax: int (default 640)

xmax to crop the image im[xmin:xmax, ymin:ymax]

ymin: int (default 50)

ymin to crop the image im[xmin:xmax, ymin:ymax]

ymax: int (default 700)

ymax to crop the image im[xmin:xmax, ymin:ymax]

gain: complex array

gain for the pattern of the frame

filt: complex array

filter for the pattern of the frame

red_factor: int(default 1)

reduction factor for the frame array to speed up the calc

Returns:
a: array containing phase [radians]
process_frame_func(array)[source]#

call process_frame function with surface_tracking parameters

Parameters:
array_and_pathtuple containing array and path
Returns:
array_and_pathtuple containing array/phase [radians], frame shape
and path
calculheight_func(array_and_shape)[source]#

call convphase function with surface_tracking parameters

Parameters:
array_and_pathtuple containing array/phase [radians],
shape of the frame and path
Returns:
height_and_pathtuple containing array/height [m], frame shape
and path
set_borders_zero_func(array_and_shape)[source]#

call convphase function with surface_tracking parameters

Parameters:
array_and_pathtuple containing array/phase [radians], shape of
the frame and path
Returns:
height_and_pathtuple containing array/height [m] and path
convphase(phase, pix_size, dist, dist_p_c, wave_len, red_factor)[source]#

converts phase array into array of the height [m]

Parameters:
phasefloat

the image phase [radians]

pix_sizefloat

size of the pixel [m/pixel]

distfloat

distance between object and camera [m]

dist_p_cfloat

distance between projector and camera [m]

waven_lenfloat

wave length of the object [m]

red_factor: int

is the reduction factor

Returns:
height: float

array with the height calculated from the phase

Notes

Make sure that the grid is parallel to y

correctcouple(queue_couple)[source]#

correct phase in order to avoid jump phase

wave_vector(ref, ymin, ymax, xmin, xmax, sur)[source]#

compute k_x value with mean reference frame

Parameters:
ref: int

frame with averaged

Returns:
wave_vector: float

average wave vector from the given frame

process_ref()[source]#

calculate the reference height from a set of frames of a flat plate with zero height

Documentation for params#

Documentation for params.surface_tracking#

Surface Tracking parameters:

  • xmin: int (default 475)

    xmin to crop the image im[xmin:xmax, ymin:ymax].

  • xmax: int (default 640)

    xmax to crop the image im[xmin:xmax, ymin:ymax]

  • ymin: int (default 50)

    ymin to crop the image im[xmin:xmax, ymin:ymax]

  • ymax: int (default 700)

    ymax to crop the image im[xmin:xmax, ymin:ymax]

  • distance_lens: float (default 0.36)

    distance in [m] lenses of camera/projetor

  • distance_object: float (default 1.07)

    distance in [m] camera/projector and surface

  • pix_size: float (default 2.4 * 10 ** -4)

    pixel size

  • startref_frame: int (default 0)

    indice of first reference image

  • lastref_frame: int (default 49)

    indice of last reference image

  • sur: int (default 16)

  • k_x: float (default 70.75)

    wave vector oj. grid (approx. value, will set accurate later)

  • k_y: float (default 0)

    wave vector of the grid y-axis

  • slicer: int (default 4)

    cut the borders

  • red_factor: int (default 1)

    reduction factor to for the pixels to take tp speed up

  • n_frames_stock: int (default 1)

    number of frames to stock in one file

  • crop_edge: boolean (default False)

    searches for the structure and crops the part of the frame outside of the structure

  • borders: int (default 7)

    pixel to set zero height additional to the borders if the structure was cropped to avoid jerks

  • correct_pos: boolean (default=False)

    correct position of the height (necessary for large heights)

  • correct_height: boolean (default=False)

    correct height by a reference (provided from path_ref)

  • offset: float (default 0.0)

    height of the reference surface in [m] to zero level

Classes

WorkSurfaceTracking(params)

Main work for surface tracking