ImageTransformation

ImageTransformation[image,f]

gives an image in which each pixel at position p corresponds to the position f[p] in image.

ImageTransformation[image,f,size]

gives an image of the specified size.

ImageTransformation[video,]

transforms frames of a video.

Details and Options

  • In ImageTransformation[image,f] is also known as backward transformation, where the value of every pixel at position {x,y} in the output image is obtained from the position f[{x,y}] in the input image.
  • The transformation function f can be one of the following:
  • fan arbitrary function f
    TransformationFunction[]a transformation function
  • For video inputs, the transformation function can also be a function of time (in seconds from the start). The function returns a frame in which each pixel at time t and position p corresponds to the position f[t][p].
  • ImageTransformation works with arbitrary 2D and 3D images.
  • 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.
  • In 2D, the range of the coordinate system for the input image is assumed to be , where is the aspect ratio. The bottom-left corner of the image corresponds to coordinates by default.
  • In 3D, the range of the coordinate system for the input image is assumed to be , where are the image dimensions. The bottom-left front corner of the image corresponds to coordinates by default.
  • Other coordinate systems can be specified by setting the DataRange option.
  • ImageTransformation can take the following options:
  • Background 0background color to use
    DataRange Automaticrange of coordinates in the original image
    Masking Fullregion of interest to be transformed
    Padding 0padding method
    PlotRange Automaticrange of coordinates in the resulting image
    Resampling Automaticresampling method
  • By default, ImageTransformation returns an image with the aspect ratio of the input image.
  • Typical settings for DataRange include:
  • Automatic in 2D, in 3D
    Full in 2D, 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
  • In ImageTransformation[image,f], the pixel dimensions of the resulting image are based on the dimensions of image and the ratio of PlotRange and DataRange.
  • The Masking option can be one of the following:
  • Allinput image only
    Fullinput image and padding
    maskany mask image

Examples

open allclose all

Basic Examples  (2)

Transformation of an image:

Transformation of a 3D image:

Scope  (13)

Data  (4)

Transform a grayscale image:

Transform a color image:

Transform frames of a video:

Transform a 3D image:

Transformation  (7)

Use any function for the transformation:

Operate explicitly on and pixel positions:

Operate on the vertical dimension only:

Perform a matrix transformation:

Use a TransformationFunction to specify the transformation:

Transform frames of a video as a function of time and position:

Use a 3D transformation function:

Size  (2)

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:

Make a 3D image narrow and tall:

Options  (7)

Background  (1)

By default, a black background is used:

Use a specific color for the background:

Use a transparent background:

Images with an alpha channel use a transparent background by default:

DataRange  (2)

By default, the Automatic DataRange is used:

Use DataRangeFull when defining translation in pixel coordinates:

Specify a custom DataRange:

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

Vertical reflection transform applied to a 3D image:

Masking  (1)

By default, Masking->Full is used; padding is used for pixels outside of the original image:

With Masking->All, the Background option value is used for pixels outside of the original image:

Use an arbitrary mask:

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:

Rotate image around its center:

Use pixel coordinates with PlotRangeFull option:

Padding  (1)

By default, Padding0 is used:

Use a named color:

Using fixed padding for values beyond the image:

Using a periodic padding:

Use transparent padding:

Resampling  (1)

By default, the resampling method is selected automatically, but any of the available methods may be used:

Applications  (6)

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

Apply the transformation function to the transformed image:

Make a photo mosaic:

Create a rain effect:

Create a tiling effect:

Warp a line of text along the vertical axis:

Use padding to extend the region of the image:

Mirror an image:

Properties & Relations  (2)

By default, the returned image retains the size and aspect ratio of the original:

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

Interactive Examples  (1)

Interactive fisheye effect:

Neat Examples  (6)

Do mathematical transformations on images:

Create a caricature:

Fisheye effect:

Spiral mirror effect:

Distort a portrait image:

A curvy distortion:

Wolfram Research (2010), ImageTransformation, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageTransformation.html (updated 2021).

Text

Wolfram Research (2010), ImageTransformation, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageTransformation.html (updated 2021).

CMS

Wolfram Language. 2010. "ImageTransformation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ImageTransformation.html.

APA

Wolfram Language. (2010). ImageTransformation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageTransformation.html

BibTeX

@misc{reference.wolfram_2024_imagetransformation, author="Wolfram Research", title="{ImageTransformation}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ImageTransformation.html}", note=[Accessed: 17-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagetransformation, organization={Wolfram Research}, title={ImageTransformation}, year={2021}, url={https://reference.wolfram.com/language/ref/ImageTransformation.html}, note=[Accessed: 17-November-2024 ]}