lvexpwarp(3)

LIBRARY ROUTINE
lvexpwarp - Perform geometric transformation (warp) using symbolic expression

LIBRARY CALL
#include "vinclude.h"
int
lvexpwarp(image,xmap,ymap,xca,yca)
struct xvimage *image;
char *xmap,*ymap;
float xca,yca;

INPUT

image
    pointer to xvimage structure to be processed

xmap
    string containing the x map function

ymap
    string containing the y map function

xca X coordinate of center of action

yca Y coordinate of center of action

OUTPUT

image
    holds the result of the warp operation. The output data type is the same as the input data type.

Return Value:
    1 on success, 0 on failure.

MODIFICATIONS

9-Feb-91 Scott Wilson - Use new xvexpr multiple stmt syntax

11-Nov-91 Scott Wilson - Correct bad pointer parameter passing, updated to 17-Oct-91 version from IBF toolbox

DESCRIPTION
lvexpwarp is used to alter the spatial properties of an image by performing a transformation in which the old coordinates of a pixel are mapped to a new location by a pair of symbolic expressions. The old coordinates, (x,y) are related to the new coordinates (x',y') by the symbolic expressions supplied as map functions. These expressions are evaluates using the xvexpr(3) library, which is also used by cantata to perform mathematical operations. An example of a set of mappings is:
  For the x' mapping:
       4.0*(x#2+y#2)-1/y }
  For the y' mapping:
       exp(-((y-15)#2)/300) }

The output image is formed by mapping each individual rectangular region in the input image (composed of four neighboring pixels) through the mapping functions and onto the output plane in the form of a polygon. The polygon is filled onto the output plane using scan-line bilinear interpolation. Note that it is possible to distort the mapping so severely that the input rectangle can be mapped onto a triangle, line, point, twisted hourglass, etc. All of these cases are resolved except for the hourglass case. Also note that it may be possible to map into a space that you cannot get back from (i.e. the above functions have no inverses).

The point called the center-of-action is the point that is specified as the origin of the spatial coordinates prior to applying the transform. The output plane is then shifted so that its origin lies at that same specified point. The end result is like specifying what point to put under a magnifying glass.

As a final note, look out for mappings that will take negative distances and make them positive Since the input plane is scanned left to right, and top to bottom, it is possible to overwrite part of the output plane with one or more regions of the input plane! The result in this case depends on which part was looked at first by the scanning loop. No answer is right, so you get one of the many approximations.

Note that image is used for both the input xvimage structure and the resulting output xvimage structure. This is done to save space, but you must be careful not to overwrite important data.

lvexpwarp can take a long time to run...

SEE ALSO
vexpwarp(1), intro(3), vipl(3), verror(3), vutils(3) lvwarp(1), lvrotate(1), lvresize(1), lvpolyco(1), xvexpr(3)

RESTRICTIONS
lvexpwarp will not work on images of type BIT, DOUBLE, COMPLEX, or DCOMPLEX data type. lvexpwarp does not work on explicit location data.

AUTHOR
Scott Wilson

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.