java.lang.Object
imagingbook.common.image.ImageMapper
This class defines methods to perform arbitrary geometric transformations on images. The geometric transformation
(mapping) must be specified at construction. The specified geometric mapping is supposed to be INVERTED, i.e.
transforming
target to source coordinates!
For reading pixel values (from the source image) the out-of-bounds strategy and pixel interpolation method can be
specified. All methods work for both scalar-valued and color images.
- Version:
- 2022/09/16 revised
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic InterpolationMethod
Default pixel interpolation method (seeInterpolationMethod
).static OutOfBoundsStrategy
Default out-of-bounds strategy (seeOutOfBoundsStrategy
). -
Constructor Summary
ConstructorsConstructorDescriptionImageMapper
(Mapping2D targetToSourceMapping) Constructor - creates a newImageMapper
with the specified geometric mapping.ImageMapper
(Mapping2D targetToSourceMapping, OutOfBoundsStrategy obs, InterpolationMethod ipm) Constructor - creates a newImageMapper
with the specified geometric mapping, out-of-bounds strategy and pixel interpolation method. -
Method Summary
Modifier and TypeMethodDescriptionvoid
map
(ImageProcessor ip) Destructively transforms the passed image using this geometric mapping and the specified pixel interpolation method.void
map
(ImageProcessor source, ImageProcessor target) Transforms the source image to the target image using this geometric mapping and the specified pixel interpolation method.void
map
(ImageAccessor sourceAcc, ImageAccessor targetAcc) Transforms the source image to the target image using this geometric mapping and the specified pixel interpolation method.
-
Field Details
-
DefaultOutOfBoundsStrategy
Default out-of-bounds strategy (seeOutOfBoundsStrategy
). -
DefaultInterpolationMethod
Default pixel interpolation method (seeInterpolationMethod
).
-
-
Constructor Details
-
ImageMapper
Constructor - creates a newImageMapper
with the specified geometric mapping. The default pixel interpolation method (seeDefaultInterpolationMethod
) and out-of-bounds strategy (seeDefaultOutOfBoundsStrategy
) are used.- Parameters:
targetToSourceMapping
- the geometric (target to source) transformation
-
ImageMapper
public ImageMapper(Mapping2D targetToSourceMapping, OutOfBoundsStrategy obs, InterpolationMethod ipm) Constructor - creates a newImageMapper
with the specified geometric mapping, out-of-bounds strategy and pixel interpolation method.- Parameters:
targetToSourceMapping
- the geometric (target to source) transformationobs
- the out-of-bounds strategy (affects source image only)ipm
- the pixel interpolation method
-
-
Method Details
-
map
Destructively transforms the passed image using this geometric mapping and the specified pixel interpolation method.- Parameters:
ip
- target image to which this mapping is applied
-
map
Transforms the source image to the target image using this geometric mapping and the specified pixel interpolation method. Note that source and target must be different images! The geometric mapping is supposed to be INVERTED, i.e. transforming target to source image coordinates!- Parameters:
source
- input image (not modified)target
- output image (modified)
-
map
Transforms the source image to the target image using this geometric mapping and the specified pixel interpolation method. The two images are passed as instances ofImageAccessor
. Note that source and target must be different images! The geometric mapping is supposed to be INVERTED, i.e. transforming target to source image coordinates. Access to source pixels is controlled by the out-of-bounds strategy and pixel interpolation method settings of the sourceImageAccessor
(the corresponding settings of thisImageAccessor
are ignored).- Parameters:
sourceAcc
-ImageAccessor
for the source imagetargetAcc
-ImageAccessor
for the target image
-