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.

Details and Options

  • ImagePerspectiveTransformation is typically used to modify camera position, orientation, and field of view of scene.
  • The transformation matrix m corresponds to the following case:
  • image 2D, m 2×2AffineTransform[m]
    image 2D, m 3×3LinearFractionalTransform[m]
    image 3D, m 3×3AffineTransform[m]
    image 3D, m 4×4LinearFractionalTransform[m]
  • 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
  • ImagePerspectiveTransformation can take the following options:
  • Background0background color to use
    DataRangeAutomaticrange of coordinates in the original image
    MaskingFullregion of interest to be transformed
    Padding0padding method
    PlotRangeAutomaticrange of coordinates in the resulting image
    ResamplingAutomaticresampling method
  • 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.
  • Masking option can be one of the following:
  • Allinput image only
    Fullinput image and padding
    maskany mask image
  • For possible size specifications, see the reference page for ImageResize.

Examples

open all close all

Basic Examples  (2)

Transform an image using a perspective transformation:

In[1]:=
Click for copyable input
Out[1]=

Perspective transformation of a 3D image:

In[1]:=
Click for copyable input
Out[1]=

Scope  (12)

Options  (7)

Applications  (4)

Properties & Relations  (2)

Possible Issues  (2)

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