naclib.main

Fit/predict interface for ST-polynomial decomposition distortion correction.

By Edo van Veen @ Nynke Dekker Lab, TU Delft (2021)

class naclib.main.DistortionCorrection(max_iter=10000, conv_threshold=1e-06, div_threshold=0.01)

Class with sklearn-like fit/predict interface for ST-polynomial decomposition distortion correction. Can be called as naclib.DistortionCorrection() directly.

Parameters:
  • max_iter (int (optional)) – Maximum number of iterations. Default: 10000.

  • conv_threshold (float (optional)) – The iteration is considered converged when the mean error reaches this value. Default: 1e-6.

  • div_threshold (float (optional)) – The iteration is considered diverged when the mean error reaches this value. Default: 1e-2.

fit(locations, distortions)

Fit distortion correction model using a distortion field in the unit circle.

Parameters:
  • locations (np.array of floats) – x and y coordinates of the distortion map coordinates, shape (N, 2).

  • distortions (np.array of floats) – x and y components of the distortion vectors at the coordinates given by locs, shape (N, 2).

predict(locations)

Generate a correction field at input locations.

Parameters:

locations (np.array of floats) – x and y coordinates of coordinates to be distortion corrected, shape (N, 2).

Returns:

x and y components of the distortion correction vectors at the coordinates given by locations, shape (N, 2).

Return type:

np.array of floats