ImagePerspectiveTransformation

ImagePerspectiveTransformation[image,m]

applies a linear fractional transform specified by a matrix m to the positions of each pixel in image.

ImagePerspectiveTransformation[image,tf]

uses the TransformationFunction given by tf.

ImagePerspectiveTransformation[image,,size]

gives an image of the specified size.

ImagePerspectiveTransformation[video,]

transforms frames of a video.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Transform an image using a perspective transformation:

Perspective transformation of a 3D image:

Scope  (13)

Data  (4)

Transform a grayscale image by scaling with a factor of :

Transform a color image:

Transform frames of a video:

Transform a 3D image:

Transformations  (8)

2D Images  (4)

A pure rescaling:

A clockwise rotation of an image:

A shearing transformation:

A pure translation:

A general affine transformation:

A perspective transformation:

Use a geometric transformation function to rotate an image:

Rotate about the opposite image corner:

Rotate about the image center:

Shear an image using ShearingTransform:

Transform an image using a general TransformationFunction object:

3D Images  (4)

A pure rescaling of a 3D image:

Rotate a 3D image around the axis:

A pure translation of a 3D image in the vertical direction only:

Rotate a 3D image using RotationTransform:

An affine transformation of a 3D image:

A linear fractional transformation of a 3D image:

Size  (1)

The size value Automatic usually returns images of the same size as the original:

When PlotRange is specified, the returned image size is derived from the original size and plot range:

Using the value All always returns an image of the same size as the original:

Specify the width of the resulting image:

Specify the width and height of the resulting image:

Use a scaled value:

Use a predefined named size value:

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:

Use a custom DataRange setting in translating a 3D image:

Masking  (1)

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

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

Use an arbitrary mask:

Padding  (1)

By default, the Padding0 is used:

Use a named color:

Use reflected padding:

PlotRange  (1)

By default, PlotRangeAutomatic is used:

Use the PlotRangeAll option to show all the transformed pixels from the original image:

Use a custom PlotRange setting:

Use pixel coordinates with PlotRangeFull option:

Resampling  (1)

A cubic interpolant is used by default:

Use a different resampling method:

Applications  (4)

Use a perspective transformation to modify camera position in an image:

Obtain the geometric transformation that maps the four corners of the book to their desired positions:

Apply the transformation function to the image:

Remove the perspective distortion of the road:

Enhance the perspective effect:

Segment out the building in an image:

Shear the image to straighten up the building:

Properties & Relations  (2)

ImagePerspectiveTransformation[image,{a,b}] applies AffineTransform[{a,b}] to image:

ImagePerspectiveTransformation[image,{a,b,c,d}] applies LinearFractionalTransform[{a,b,c,d}] to image:

Possible Issues  (2)

When the function maps some coordinates to infinity, truncated output is displayed:

Non-invertible transformations will give a degenerate result:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2022_imageperspectivetransformation, author="Wolfram Research", title="{ImagePerspectiveTransformation}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ImagePerspectiveTransformation.html}", note=[Accessed: 09-December-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_imageperspectivetransformation, organization={Wolfram Research}, title={ImagePerspectiveTransformation}, year={2021}, url={https://reference.wolfram.com/language/ref/ImagePerspectiveTransformation.html}, note=[Accessed: 09-December-2022 ]}