Affine
The Affine Transform module provides a way to warp an image into a different scale, rotated and warped
image. This module can be used to extra part of an image and align it to a canonical (known size and orientation) view.
The affine transform
will use the four selected points to create a new image that is scaled, rotated and translated based
on the four coordinate points. This transform is useful for removing perspective distortion or
for straightening objects within the field of view.
Interface
Instructions
1. Green, Cyan, Purple, Blue squares - drag the squares to create a new rough transform
2. Coordinates - Use the text boxes to refine the coordinates
3. Options Resample - select the interpolation mode. Pixel is fastest but causes blocky results. Bilinear is smooth
but slower.
4. Options Display Grid Size - to overlay a grid used when aligning to specific
angles select the grid size to use for the overlay.
5. Options Transform Width & Height - Specify the resulting size you would like
the selected part of the image to be transformed into.
6. Options Perspective Compensation - If you are transforming an image which exhibits
depth perspective the resulting image will have corrected most of the distortion
but will not change how much a pixel represents in the real world. Because of this
objects nearer to the camera will demand more pixels whilst objects further back in the
scene (think of a road) will retain less. Once corrected for the affine distortion this
relationship will remain. The Perspective Compensation checkbox will change this relationship
and provide equal amounts of pixels for foreground and background objects. Thus
transformed images will show objects in the foreground and background as being the same size.
7. Grid Size - specify a grid size that will be superimposed over the current image
to help in manual alignment.
Example
| Source | Affine Transform |
 |  |
| Perspective Correction |
 |  |
| Object Alignment |
 |  |
 |  |
Variables
AFFINE_X1,AFFINE_Y1 - the first point used in the affine transformation
AFFINE_X2,AFFINE_Y2 - the second point used in the affine transformation
AFFINE_X3,AFFINE_Y3 - the third point used in the affine transformation
AFFINE_X4,AFFINE_Y4 - the fourth point used in the affine transformation
Note that instead of coordinates in the coordinate text boxes you can enter variable
values using [variable_name] instead of a number.
See Also
Rotate
Scale
Translate
|