Class ImageMapper

java.lang.Object
imagingbook.common.image.ImageMapper

public class ImageMapper extends Object
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 Details

  • Constructor Details

    • ImageMapper

      public ImageMapper(Mapping2D targetToSourceMapping)
      Constructor - creates a new ImageMapper with the specified geometric mapping. The default pixel interpolation method (see DefaultInterpolationMethod) and out-of-bounds strategy (see DefaultOutOfBoundsStrategy) are used.
      Parameters:
      targetToSourceMapping - the geometric (target to source) transformation
    • ImageMapper

      public ImageMapper(Mapping2D targetToSourceMapping, OutOfBoundsStrategy obs, InterpolationMethod ipm)
      Constructor - creates a new ImageMapper with the specified geometric mapping, out-of-bounds strategy and pixel interpolation method.
      Parameters:
      targetToSourceMapping - the geometric (target to source) transformation
      obs - the out-of-bounds strategy (affects source image only)
      ipm - the pixel interpolation method
  • Method Details

    • map

      public void map(ImageProcessor ip)
      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

      public void map(ImageProcessor source, ImageProcessor target)
      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

      public void map(ImageAccessor sourceAcc, ImageAccessor targetAcc)
      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 of ImageAccessor. 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 source ImageAccessor (the corresponding settings of this ImageAccessor are ignored).
      Parameters:
      sourceAcc - ImageAccessor for the source image
      targetAcc - ImageAccessor for the target image