affine

[ XITE Reference Manual | XITE home ]

Name

affine - affine geometric transform

Syntax

 affine [-ip n] [-bg <bg>] <inimage> <outimage> \\
     x0 x1 x2 y0 y1 y2
 affine [-ip n] [-bg <bg>] -f <datafile> \\
     <inimage> <outimage>

Description

affine performs a linear transform of the coordinate system (x, y) to another coordinate system (u,v). All coordinates are adjusted acording to (xstart, ystart).
 outimage (x,y) = inimage (u,v)
 u = x0 + x1 * x + x2 * y
 v = y0 + y1 * x + y2 * y
The interpolation method -ip is
 -ip 0 : Nearest neighbor
 -ip 1 : Bilinear   interpolation
         g(x) = bi(f(x), f(x+1), d)
         bi(x, y, d) = x(1-d) + yd
 -ip 3 ; Cubic      interpolation
         g(x) = cc(f(x-1), f(x), f(x+1), f(x+2), d)
         cc(x, y, z, v, d) = y + d((-x+z) +
                             d((2x-2y+z-v) + d(-x+y-z+v)))
The values x0 .. x2 and y0 .. y2 may be specified on the command line or in a datafile. The format on the datafile is
 # Lines with # og ; in pos 1 is treated as comments
 x0 x1 x2
 y0 y1 y2
All matrix of size n x 2 (n >= 3) will be accepted. If n > 3 only element 0, 1, and 2 will be used.

Default is bilinear interpolation (-ip 1)

If the output image should have another size or startpoint than the input image this may be specified by the -xstart, -xstop, -xsize, -ystart, -ystop and -ysize switch. If start, stop as well as size switches are given, and inconsistently, the stop switch is ignored. The given sizes are clipped against the result of the transform. The -bg switch is used to specify the value when the mapping ends up outside the input. Default = 0.

Restrictions

inimage must have bands with pixel type unsigned byte.

Reference

Wayne Niblack. Digital Image Processing, p 131-150

See also

affine(3), quadratic(1), rotate(1), reorganize(1), shift_img(1), transpose_img(1), warp(1)

Author

Otto Milvang

Examples

 affine mona.img monarot.img  30 .5 .714 -40 -.0714 .5

Id

$Id: affine.c,v 1.32 1997/05/29 16:33:09 svein Exp $