Virtual View

Virtual View

Creates a new view of the world as if looked through a virtual window. This tool makes it possible to simultaneously perform any 3D affine transformation and perspective correction, scaling and cropping to an image.

The tool is given a coordinate frame and a size that describe a rectangular area in the physical world (not in the input image). The area may be freely rotated, scaled, stretched and skewed in three dimensions. The resulting image is an aligned picture of the area as if a virtual camera was placed right on top of it at referenceDistance.

The tool can take any image as input and does not expect that the requested piece of the world is actually visible in it. If the input image does not contain the necessary data, portions of the output image (or even the whole image) may be left black.

To rotate an image, one only needs to create a rotated coordinate frame. Images can be scaled by simply altering referenceDistance.

This tool works with any 3D transformation and may therefore require a lot of computation. The tool is optimized so that it does the minimum amount of work required, but its speed may be hard to predict. If an application needs to quickly extract a rectangular, axis-aligned sub-image, use cropping instead.


Input image
The size of the rectangle to be selected and aligned in world coordinates. Note that a 0-by-0 size produces a one-pixel image. If size is undefined (either width or height is NAN), the whole image is used.
A coordinate frame for the rectangle in the world coordinate system.
Reference distance used when projecting the area to an image. Setting the reference distance to zero makes the tool use the distance between camera and world origins as a reference.
If true, improve the visual quality of the output by interpolating non-exact values from neighboring pixels. If false, round pixel coordinates to the nearest integer. Notice that interpolation is a significantly slower operation than rounding.


Output image.