warp
[ XITE Reference Manual | XITE home ]
Contents
Name
warp - polynomial control point mapping
warp [-ip <n>] [-bg <bg>] [-cp <cpfile>] [-p <poldeg>]
[-xstart <xstart>] [-xstop <xstop>]
[-xsize <xsize>] [-ystart <ystart>]
[-ystop <ystop>] [-ysize <xsize>]
[-rss] [-qr] [ <inimage> <outimage> ]
Perform an output to input mapping (k,l) = M(i,j).
Given an input image I(k, l), calculate O(i,j).
If 'poldeg' == 1 (default) :
k = Q(i, j) = q0 + i * q1 + j * q2
l = R(i, j) = r0 + i * r1 + j * r2
If 'poldeg' == 2 :
k = Q(i, j) = q0 + i*q1 + j*q2 + i*i*q3 + i*j*q4 + j*j*q5
l = R(i, j) = r0 + i*r1 + j*r2 + i*i*r3 + i*j*r4 + j*j*r5
The coefficients q and r will be printed if the -qr flag
is set.
If -rss is set, the residuals r(m) will be calculated:
dk = k - Q(i,j)
dl = l - R(i,j)
r(m) = sqrt(dk*dk + dl*dl)
The control point file cpfile consists of pairs of points.
Each line is a set of i, j, k and l.
i and j are coordinates in the reference image.
k and l are coordinates in the image to be transformed.
Lines with # in coloumn 1 are treated as comment lines.
Blank lines are ignored. Pixels inside a line are separated
by blanks, lines are separated by newline.
#
# Example 1
#
# i j k l
#------------------
57 44 61 144
27 72 38 180
114 122 132 201
180 199 213 255
193 166 215 217
191 288 241 336
If inimage and outimage are specified, the transform
will be performed.
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)))
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
options. If start, stop as well as size options are given, and
inconsistently, the stop option is ignored. The given
sizes are clipped against the result of the transform.
-bg is used to specify the background pixel value,
default = 0.
Wayne Niblack. Digital Image Processing, p 131-150
Works on unsigned byte images only.
affine(1), quadratic(1), reorganize(1), rotate(1),
shift_img(1), transpose_img(1)
Lennart Flem 1/3-91.
Otto Milvang
$Id: warp.c,v 1.28 1997/04/23 13:00:00 svein Exp $