xlens.process_pipe.hsc
Submodules
Functions
|
Resize an image-like array to a square target shape. |
|
Shift an image by arbitrary subpixel offsets using Fourier methods. |
Package Contents
- resize_array(array: numpy.typing.NDArray[Any], target_shape: tuple[int, int] = (64, 64))[source]
Resize an image-like array to a square target shape.
The function first crops the array symmetrically if it is larger than the requested output size and then applies zero-padding when the array is too small.
- Parameters:
array – Input array to resize. The array is assumed to be two-dimensional.
target_shape – Tuple of
(height, width)describing the requested output shape.
- Returns:
The resized array.
- Return type:
numpy.ndarray
- subpixel_shift(image: numpy.typing.NDArray, shift_x: float, shift_y: float) numpy.typing.NDArray[source]
Shift an image by arbitrary subpixel offsets using Fourier methods.
- Parameters:
image – Two-dimensional array containing the image that should be shifted.
shift_x – Desired shift in the x-direction, expressed in pixel units. The value can be any real number; positive values move the image towards larger x.
shift_y – Desired shift in the y-direction, expressed in pixel units. Positive values move the image towards larger y.
- Returns:
The shifted image. The output has the same shape as the input and is guaranteed to be real-valued.
- Return type:
numpy.ndarray