ImageForwardTransformation

ImageForwardTransformation[image,f]

gives an image in which each pixel at position f[{x,y}] corresponds to the position {x,y} in image.

ImageForwardTransformation[image,f,size]

gives an image of the specified size.

Details and Options

  • In ImageForwardTransformation[image, f] every pixel at position {x,y} in image is placed at position f[{x,y}] in the output image. This is known as a forward transformation.
  • ImageForwardTransformation[image,f] gives an image of the same size as the original.
  • ImageForwardTransformation works with arbitrary 2D images.
  • The pixel positions in the original image are assumed to run from 0 to 1 in the horizontal direction and from 0 to the aspect ratio in the vertical direction.
  • Possible settings for size are:
  • Automaticautomatic image size
    Allsame as input image size
    widthexplicit width, automatic height
    {width,height}explicit width and height
    {width,depth,height}explicit width, depth and height in 3D
  • For possible width, depth and height specifications, see the reference page for ImageResize.
  • For possible size specifications, see the reference page for ImageResize.
  • ImageForwardTransformation can take the following options:
  • BackgroundBlackbackground value
    DataRangeAutomaticassumed range of and values in the original image
    MethodAutomaticinterpolation method to use
    PlotRangeAutomaticrange of coordinates to be included in the result of the transformation
  • Typical settings for DataRange include:
  • Automatic{{0,1},{0,h/w}} in 2D, {{0,1},{0,d/w},{0,h/w}} in 3D
    Full{{0,w},{0,h}} in 2D, {{0,1},{0,d},{0,h}} in 3D
    {{left,right},{bottom,top}}explicit coordinate ranges in 2D
    {{left,right},{front,back},{bottom,top}}explicit coordinate ranges in 3D
  • The coordinate system of the resulting image is specified by the PlotRange option. Typical settings include:
  • Automaticsame as DataRange settings
    Alltry to include all of the transformed pixels
    Fullsame ranges as the input image
    {{left,right},}explicit coordinate ranges
  • When PlotRange is not Automatic, size is chosen based on the size of the original image and the ratio of PlotRange and DataRange.
  • By default, transformed points are interpolated using Method->"Interpolated". Use MethodNone to avoid interpolation.

Examples

open allclose all

Basic Examples  (1)

Applying a forward transformation on an image:

Scope  (6)

Data  (1)

Transform a grayscale image:

Transform a color image:

Transformation  (4)

Use any function for the transformation:

Operate explicitly on and pixel positions:

Operate on the vertical dimension only:

Perform a matrix transformation:

Use a geometric transform function:

Rotate image around its center using rotation transform:

Size  (1)

By default, the output image is of the same size as the input image:

Specify the size of the resulting image:

Specify width and height explicitly:

Use a scaled value:

Use a named size:

Use All to obtain an image of the same size as the original:

Options  (4)

Background  (1)

By default, a black background is used:

Use a specific color for the background:

Use a transparent background:

DataRange  (1)

By default, DataRange->Automatic is used:

Use DataRange->Full when defining translation in pixel coordinates:

Specify a custom DataRange:

Choose a data range symmetric on the axis to show a vertical reflection:

Adjust the plot range to include all image pixels:

Method  (1)

By default, transformed points are interpolated to fill the potential gaps in the resulting image:

Use Method->None to avoid interpolation:

PlotRange  (1)

By default, the output image retains the plot range of the input image:

Use PlotRange->All to view all transformed image pixels:

Use explicit plot range values:

Use pixel coordinates with PlotRangeFull option:

Applications  (3)

Reverse an unknown geometric transformation by determining the transformation function from a pair of images:

Apply the transformation to the transformed image:

Make a photo mosaic:

Smudge effect:

Properties & Relations  (3)

Magnify an image:

ImageTransformation does the opposite:

Reversing pixel coordinates is an operation that gives the same result for forward and reverse transforms:

Doing a transformation with a function and its inverse gives back the original image with some blurring due to interpolation:

Neat Examples  (3)

Fisheye effect:

Melting effect:

Mirror facets effect:

Introduced in 2010
 (8.0)
 |
Updated in 2014
 (10.0)