'\" te .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved .TH mlib_ImagePolynomialWarp_Fp 3MLIB "2 Mar 2007" "SunOS 5.11" "mediaLib Library Functions" .SH NAME mlib_ImagePolynomialWarp_Fp \- polynomial-based image warp .SH SYNOPSIS .LP .nf cc [ \fIflag\fR... ] \fIfile\fR... \fB-lmlib\fR [ \fIlibrary\fR... ] #include \fBmlib_status\fR \fBmlib_ImagePolynomialWarp_Fp\fR(\fBmlib_image *\fR\fIdst\fR, \fBconst mlib_image *\fR\fIsrc\fR, \fBconst mlib_d64 *\fR\fIxCoeffs\fR, \fBconst mlib_d64 *\fR\fIyCoeffs\fR, \fBmlib_s32\fR \fIn\fR, \fBmlib_d64\fR \fIpreShiftX\fR, \fBmlib_d64\fR \fIpreShiftY\fR, \fBmlib_d64\fR \fIpostShiftX\fR, \fBmlib_d64\fR \fIpostShiftY\fR, \fBmlib_d64\fR \fIpreScaleX\fR, \fBmlib_d64\fR \fIpreScaleY\fR, \fBmlib_d64\fR \fIpostScaleX\fR, \fBmlib_d64\fR \fIpostScaleY\fR, \fBmlib_filter\fR \fIfilter\fR, \fBmlib_edge\fR \fIedge\fR); .fi .SH DESCRIPTION .sp .LP The \fBmlib_ImagePolynomialWarp_Fp()\fR function performs a polynomial-based image warp on a floating-point image. .sp .LP The images must have the same type, and the same number of channels. The images can have 1, 2, 3, or 4 channels. The data type of the images can be \fBMLIB_FLOAT\fR or \fBMLIB_DOUBLE\fR. The source and destination images may have different sizes. .sp .LP The \fIxCoeffs\fR and \fIyCoeffs\fR parameters must contain the same number of coefficients of the form \fB(n + 1)(n + 2)/2\fR for some \fIn\fR, where \fIn\fR is the degree power of the polynomial. The coefficients, in order, are associated with the terms: .sp .in +2 .nf 1, x, y, x**2, x*y, y**2, ..., x**n, x**(n-1)*y, ..., x*y**(n-1), y**n .fi .in -2 .sp .LP and coefficients of value \fB0\fR cannot be omitted. .sp .LP The image pixels are assumed to be centered at \fB\&.5\fR coordinate points. In other words, the upper-left corner pixel of an image is located at \fB(0.5, 0.5)\fR. .sp .LP For each pixel in the destination image, its center point \fBD\fR is backward mapped to a point \fBS\fR in the source image. Then the source pixels with their centers surrounding point \fBS\fR are selected to do one of the interpolations specified by the \fIfilter\fR parameter to generate the pixel value for point \fBD\fR. .sp .LP The mapping is defined by the two bivariate polynomial functions \fBX(x, y)\fR and \fBY(x, y)\fR that map destination \fB(x, y)\fR coordinates to source \fBX\fR and \fBY\fR positions respectively. .sp .LP The functions \fBX(x, y)\fR and \fBY(x, y)\fR are: .sp .in +2 .nf preX = (x + preShiftX)*preScaleX preY = (y + preShiftY)*preScaleY n i warpedX = SUM {SUM {xCoeffs_ij * preX**(i-j) * preY**j}} i=0 j=0 n i warpedY = SUM {SUM {yCoeffs_ij * preX**(i-j) * preY**j}} i=0 j=0 X(x, y) = warpedX*postScaleX - postShiftX Y(x, y) = warpedY*postScaleY - postShiftY .fi .in -2 .sp .LP The destination \fB(x, y)\fR coordinates are pre-shifted by \fB(preShiftX, preShiftY)\fR and pre-scaled by the factors \fBpreScaleX\fR and \fBpreScaleY\fR prior to the evaluation of the polynomial. The results of the polynomial evaluations are scaled by \fBpostScaleX\fR and \fBpostScaleY\fR, and then shifted by \fB(-postShiftX, -postShiftY)\fR to produce the source pixel coordinates. This process allows for better precision of the results and supports tiled images. .SH PARAMETERS .sp .LP The function takes the following arguments: .sp .ne 2 .mk .na \fB\fIdst\fR\fR .ad .RS 14n .rt Pointer to destination image. .RE .sp .ne 2 .mk .na \fB\fIsrc\fR\fR .ad .RS 14n .rt Pointer to source image. .RE .sp .ne 2 .mk .na \fB\fIxCoeffs\fR\fR .ad .RS 14n .rt Destination to source transform coefficients for the X coordinate. .RE .sp .ne 2 .mk .na \fB\fIyCoeffs\fR\fR .ad .RS 14n .rt Destination to source transform coefficients for the Y coordinate. .RE .sp .ne 2 .mk .na \fB\fIn\fR\fR .ad .RS 14n .rt Degree power of the polynomial. .RE .sp .ne 2 .mk .na \fB\fIpreShiftX\fR\fR .ad .RS 14n .rt Displacement to apply to destination X positions. .RE .sp .ne 2 .mk .na \fB\fIpreShiftY\fR\fR .ad .RS 14n .rt Displacement to apply to destination Y positions. .RE .sp .ne 2 .mk .na \fB\fIpostShiftX\fR\fR .ad .RS 14n .rt Displacement to apply to source X positions. .RE .sp .ne 2 .mk .na \fB\fIpostShiftY\fR\fR .ad .RS 14n .rt Displacement to apply to source Y positions. .RE .sp .ne 2 .mk .na \fB\fIpreScaleX\fR\fR .ad .RS 14n .rt Scale factor to apply to destination X positions. .RE .sp .ne 2 .mk .na \fB\fIpreScaleY\fR\fR .ad .RS 14n .rt Scale factor to apply to destination Y positions. .RE .sp .ne 2 .mk .na \fB\fIpostScaleX\fR\fR .ad .RS 14n .rt Scale factor to apply to source X positions. .RE .sp .ne 2 .mk .na \fB\fIpostScaleY\fR\fR .ad .RS 14n .rt Scale factor to apply to source Y positions. .RE .sp .ne 2 .mk .na \fB\fIfilter\fR\fR .ad .RS 14n .rt Type of resampling filter. It can be one of the following: .sp .in +2 .nf MLIB_NEAREST MLIB_BILINEAR MLIB_BICUBIC MLIB_BICUBIC2 .fi .in -2 .RE .sp .ne 2 .mk .na \fB\fIedge\fR\fR .ad .RS 14n .rt Type of edge condition. It can be one of the following: .sp .in +2 .nf MLIB_EDGE_DST_NO_WRITE MLIB_EDGE_SRC_PADDED .fi .in -2 .RE .SH RETURN VALUES .sp .LP The function returns \fBMLIB_SUCCESS\fR if successful. Otherwise it returns \fBMLIB_FAILURE\fR. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBmlib_ImagePolynomialWarp\fR(3MLIB), \fBmlib_ImagePolynomialWarpTable\fR(3MLIB), \fBmlib_ImagePolynomialWarpTable_Fp\fR(3MLIB), \fBattributes\fR(5)