Peak detection algorithms

The function to call for the peak detection is a switch for the different methods.

piv.peak_detection.find_peak(corr, method='gaussian')[source]

Peak detection algorithm switch

After loading the correlation window an maximum finder is invoked. The correlation window is cut down to the necessary 9 points around the maximum. Afterwards the maximum is checked not to be close to the boarder of the correlation frame. This cropped window is used in along with the chosen method to interpolate the sub pixel shift. Each interpolation method returns a tuple with the sub pixel shift in x and y direction. The maximums position and the sub pixel shift are added and returned. If an error occurred during the sub pixel interpolation the shift is set to nan. Also if the interpolation method is unknown an exception in thrown.

Parameters:
  • corr – correlation window
  • method – peak finder algorithm (gaussian, centroid, parabolic, 9point)
Raises:

Sub pixel interpolation method not found

Returns:

shift in interrogation window

It uses a function to check weather the maximum is inside or at the boarder of the correlation window.

piv.peak_detection.check_peak_position(corr, i, j)[source]

Checking weather the maximum is at the boarder of the correlation window

Parameters:
  • corr – correlation window
  • i – first index position of the maximum
  • j – second index position of the maximum
Returns:

true if maximum is inside the correlation window

The interpolation for the sub pixel shift has four different algorithms.

piv.peak_detection.gaussian(window)[source]

Gaussian interpolation for sub pixel shift

piv.peak_detection.centroid(window)[source]

Centroid interpolation for sub pixel shift

piv.peak_detection.parabolic(window)[source]

Parabolic interpolation for sub pixel shift

piv.peak_detection.gaussian2D(window)[source]

Real 2D Gaussian interpolation for sub pixel shift