1mlib_ImagePolynomialWarpTabmleed(i3aMLLiIbB)LibrarymFluinbc_tIimoangsePolynomialWarpTable(3MLIB)
2
3
4
6 mlib_ImagePolynomialWarpTable - polynomial-based image warp with table-
7 driven interpolation
8
10 cc [ flag... ] file... -lmlib [ library... ]
11 #include <mlib.h>
12
13 mlib_status mlib_ImagePolynomialWarpTable(mlib_image *dst,
14 const mlib_image *src, const mlib_d64 *xCoeffs,
15 const mlib_d64 *yCoeffs, mlib_s32 n, mlib_d64 preShiftX,
16 mlib_d64 preShiftY, mlib_d64 postShiftX, mlib_d64 postShiftY,
17 mlib_d64 preScaleX, mlib_d64 preScaleY, mlib_d64 postScaleX,
18 mlib_d64 postScaleY, const void *interp_table, mlib_edge edge);
19
20
22 The mlib_ImagePolynomialWarpTable() function performs a polynomial-
23 based image warp with table-driven interpolation.
24
25
26 The images must have the same type, and the same number of channels.
27 The images can have 1, 2, 3, or 4 channels. The data type of the images
28 can be MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, or MLIB_INT. The source and
29 destination images may have different sizes.
30
31
32 The xCoeffs and yCoeffs parameters must contain the same number of
33 coefficients of the form (n + 1)(n + 2)/2 for some n, where n is the
34 degree power of the polynomial. The coefficients, in order, are associ‐
35 ated with the terms:
36
37 1, x, y, x**2, x*y, y**2, ...,
38 x**n, x**(n-1)*y, ..., x*y**(n-1), y**n
39
40
41
42 and coefficients of value 0 cannot be omitted.
43
44
45 The image pixels are assumed to be centered at .5 coordinate points. In
46 other words, the upper-left corner pixel of an image is located at
47 (0.5, 0.5).
48
49
50 For each pixel in the destination image, its center point D is backward
51 mapped to a point S in the source image. Then the source pixels with
52 their centers surrounding point S are selected to do the interpolation
53 specified by interp_table to generate the pixel value for point D.
54
55
56 The mapping is defined by the two bivariate polynomial functions X(x,
57 y) and Y(x, y) that map destination (x, y) coordinates to source X and
58 Y positions respectively.
59
60
61 The functions X(x, y) and Y(x, y) are:
62
63 preX = (x + preShiftX)*preScaleX
64
65 preY = (y + preShiftY)*preScaleY
66
67 n i
68 warpedX = SUM {SUM {xCoeffs_ij * preX**(i-j) * preY**j}}
69 i=0 j=0
70
71 n i
72 warpedY = SUM {SUM {yCoeffs_ij * preX**(i-j) * preY**j}}
73 i=0 j=0
74
75 X(x, y) = warpedX*postScaleX - postShiftX
76
77 Y(x, y) = warpedY*postScaleY - postShiftY
78
79
80
81 The destination (x, y) coordinates are pre-shifted by (preShiftX,
82 preShiftY) and pre-scaled by the factors preScaleX and preScaleY prior
83 to the evaluation of the polynomial. The results of the polynomial
84 evaluations are scaled by postScaleX and postScaleY, and then shifted
85 by (-postShiftX, -postShiftY) to produce the source pixel coordinates.
86 This process allows for better precision of the results and supports
87 tiled images.
88
90 The function takes the following arguments:
91
92 dst Pointer to destination image.
93
94
95 src Pointer to source image.
96
97
98 xCoeffs Destination to source transform coefficients for the X
99 coordinate.
100
101
102 yCoeffs Destination to source transform coefficients for the Y
103 coordinate.
104
105
106 n Degree power of the polynomial.
107
108
109 preShiftX Displacement to apply to destination X positions.
110
111
112 preShiftY Displacement to apply to destination Y positions.
113
114
115 postShiftX Displacement to apply to source X positions.
116
117
118 postShiftY Displacement to apply to source Y positions.
119
120
121 preScaleX Scale factor to apply to destination X positions.
122
123
124 preScaleY Scale factor to apply to destination Y positions.
125
126
127 postScaleX Scale factor to apply to source X positions.
128
129
130 postScaleY Scale factor to apply to source Y positions.
131
132
133 interp_table Pointer to an interpolation table. The table is created
134 by the mlib_ImageInterpTableCreate() function.
135
136
137 edge Type of edge condition. It can be one of the following:
138
139 MLIB_EDGE_DST_NO_WRITE
140 MLIB_EDGE_SRC_PADDED
141
142
143
145 The function returns MLIB_SUCCESS if successful. Otherwise it returns
146 MLIB_FAILURE.
147
149 See attributes(5) for descriptions of the following attributes:
150
151
152
153
154 ┌─────────────────────────────┬─────────────────────────────┐
155 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
156 ├─────────────────────────────┼─────────────────────────────┤
157 │Interface Stability │Committed │
158 ├─────────────────────────────┼─────────────────────────────┤
159 │MT-Level │MT-Safe │
160 └─────────────────────────────┴─────────────────────────────┘
161
163 mlib_ImageInterpTableCreate(3MLIB), mlib_ImageInterpTableDelete(3MLIB),
164 mlib_ImagePolynomialWarpTable_Fp(3MLIB), mlib_ImagePolynomial‐
165 Warp(3MLIB), mlib_ImagePolynomialWarp_Fp(3MLIB), attributes(5)
166
167
168
169SunOS 5.11 2 Mar 200m7lib_ImagePolynomialWarpTable(3MLIB)