Apply an arbitrary affine transformation to an image.
image_transform__ applies an arbitrary affine transformation, i.e., scaling, rotation, translation, and skewing, to an image. The affine map is stored in the current transformation matrix, which is built up by using image_identity, image_scale, image_rotate, and image_translate. The region of the resulting image is set to the maximum region, i.e., to the entire image. If necessary, the resulting image is filled with zero (black) outside of the region of the original image. Generally, transformed points will lie between pixel coordinates. Therefore, an appropriate interpolation scheme has to be used. The interpolation can also be used to avoid aliasing effects for scaled images. The quality and speed of the interpolation can be set by the parameter Interpolation: 0 No interpolation: The gray value is determined from the nearest pixel's gray value (possibly low quality, very fast). 1 Use equally wighted interpolation between adjacent pixels (medium quality and run time). 2 Use Gaussian interpolation between adjacent pixels (best quality, slow).
The region is ignored and not transformed.
Image (input_object) |
(multichannel-)image(-array) -> object : byte / real |
Input image. |
ImageAffinTrans (output_object) |
(multichannel-)image(-array) -> object : byte / real |
Transformed image. |
Interpolation (input_control) |
integer -> integer |
Type of interpolation. | |
Default value: 1 | |
List of values: 0, 1, 2 |
/* Reduction of an image (512 x 512 Pixels) by 50%, rotation */ /* by 180 degrees and translation to the upper-left corner: */ image_identity(:::) > image_scale(::256.0,256.0,0.5,0.5:) > image_rotate(::256.0,256.0,3.14:) > image_translate(::-128.0,-128.0:) > image_transform__(Image:TransImage:1:). /* Enlarging the part of an image in the interactively */ /* chosen rectangular window sector: */ draw_rectangle2(:::L,C,Phi,L1,L2) > image_identity(:::) > get_system(::width:Width) > get_system(::height:Height) > image_translate(::Height/2.0 - L,Width/2.0 -C:) > image_rotate(::Height/2.0,Width/2.0,3.14-Phi:) > image_scale(::Height/2.0,Width/2.0,Height / (2.0*L2),Width / (2.0*L1):) > image_transform__(Image:TransImage:1:).
image_translate returns TRUE if all parameter values are correct. If the input is empty the behaviour can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.
image_identity, image_translate, image_rotate, image_scale, image_transform__
image_setmatrix, image_identity, image_scale, image_rotate, image_translate, rotate_region1, rotate_region2, set_part_style