Facemorph
Class LinearWarp_1

java.lang.Object
  extended by Facemorph.LinearWarp_1

public class LinearWarp_1
extends java.lang.Object

Performs triangulated linear interpolation for image warping


Constructor Summary
LinearWarp_1(int w, int h, int W, int H, boolean r)
          Constructs a Linear warp with the input and output size specified
 
Method Summary
 java.awt.Image drawTess(java.awt.Image img)
          Draws the calculated triangulation on the image as a set of red lines, useful for testing the tesselation should already have been calculated e.g.
static void main(java.lang.String[] args)
          Main function used for testing
 java.awt.Image warpImage(int n, java.awt.geom.Point2D.Float[] dest, java.awt.geom.Point2D.Float[] source, boolean borders, java.awt.Image inImage)
          Warps the input image from the shape specified by the source points to the shape specified by dest points
 java.awt.Image warpImage(Template t1, Template t2, boolean borders, java.awt.Image inImage)
          Warps inImage from shape t1 to shape t2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearWarp_1

public LinearWarp_1(int w,
                    int h,
                    int W,
                    int H,
                    boolean r)
Constructs a Linear warp with the input and output size specified

Parameters:
w - input width
h - input height
W - output width
H - output height
r - triangulate on reverse template??
Method Detail

warpImage

public java.awt.Image warpImage(Template t1,
                                Template t2,
                                boolean borders,
                                java.awt.Image inImage)
Warps inImage from shape t1 to shape t2

Parameters:
t1 - Template specifying input shape
t2 - Template specifying output shape
borders - should the borders be pinned down, usually should be true
inImage - the input Image to warp
Returns:
Returns the warped image

warpImage

public java.awt.Image warpImage(int n,
                                java.awt.geom.Point2D.Float[] dest,
                                java.awt.geom.Point2D.Float[] source,
                                boolean borders,
                                java.awt.Image inImage)
Warps the input image from the shape specified by the source points to the shape specified by dest points

Parameters:
inImage - The input Image to warp
n - Number of input points to interpolate
dest - List of destination points to interpolate
source - List of source points to interpolate
borders - Indicates if the borders should be pinned down (using a set of points round the image edge)
Returns:
true if the interpolation was completed OK

drawTess

public java.awt.Image drawTess(java.awt.Image img)
Draws the calculated triangulation on the image as a set of red lines, useful for testing the tesselation should already have been calculated e.g. by a call to warpImage

Parameters:
img - The image to draw on
Returns:
returns an image with the triangulated points drawn on it

main

public static void main(java.lang.String[] args)
Main function used for testing

Parameters:
args - no parameters required