linumpy.imaging.transform#

Image transform helpers (normalization, padding, XY shifts).

Functions#

normalize(img[, saturation])

Normalize an image between 0 and 1.

match_shape(img1, img2)

Match the shape of two images by padding the smallest one.

apply_xy_shift(img, reference, dx, dy)

Apply a shift to the image in the xy plane.

Module Contents#

linumpy.imaging.transform.normalize(img, saturation=99.7)[source]#

Normalize an image between 0 and 1.

Parameters:
  • img (np.ndarray) – The image to normalize.

  • saturation (float, optional) – The saturation value for the normalization

Returns:

The normalized image.

Return type:

np.ndarray

linumpy.imaging.transform.match_shape(img1, img2)[source]#

Match the shape of two images by padding the smallest one.

Parameters:
  • img1 (np.ndarray) – The first image.

  • img2 (np.ndarray) – The second image.

Returns:

The two images with the same shape.

Return type:

Tuple[np.ndarray, np.ndarray]

linumpy.imaging.transform.apply_xy_shift(img, reference, dx, dy)[source]#

Apply a shift to the image in the xy plane.

Parameters:
  • img (np.ndarray) – The image to shift.

  • reference (np.ndarray) – The reference image.

  • dx (int) – The shift in x.

  • dy (int) – The shift in y.

Return type:

numpy.ndarray