darsia.ResizeCorrection#
- class ResizeCorrection(ref_image=None, shape=None, fx=None, fy=None, interpolation=None, dtype=None, key='', **kwargs)[source]#
Bases:
BaseCorrectionShape correction wrapping darsia.Resize to fit the BaseCorrection interface.
darsia.Resize.__call__’s overwrite=True path for Image inputs does not actually mutate the caller’s object — it only rebinds a local variable to a new Image, leaving the original stale. This wrapper reuses Resize’s array-level resize logic (resize_array) but routes Image/overwrite handling through BaseCorrection.__call__, which correctly mutates image.img in place.
Constructor matching darsia.Resize’s signature.
- Parameters:
- ref_image
Image,optional Image whose shape is desired.
- shape
tupleofint,optional Desired shape (in matrix indexing).
- fx
float,optional Resize factor in x-dimension.
- fy
float,optional Resize factor in y-dimension.
- interpolation
str,optional Interpolation method.
- dtype
np.dtypeortype,optional Conversion dtype before resizing; nothing happens if None.
- key
str Prefix for kwargs-based configuration.
- **kwargs
Additional configuration options.
- ref_image
Methods
correct_array(image)Resize a raw numpy array.
correct_metadata([metadata])Correction routine on metadata level.
load(path)Load the resize correction from a file.
save(path)Save the resize correction to a file.
- correct_array(image)[source]#
Resize a raw numpy array.
- Parameters:
- image
np.ndarray Input image array.
- image
- Returns:
np.ndarrayResized image array.