Facemorph
Class MultiscaleWarpRB

java.lang.Object
  extended by Facemorph.Warp
      extended by Facemorph.MultiscaleWarpRB
All Implemented Interfaces:
java.io.Serializable

public class MultiscaleWarpRB
extends Warp

Implements a multi-scale interpolation algorithm

See Also:
Serialized Form

Field Summary
 
Fields inherited from class Facemorph.Warp
height, LINEAR, MULTISCALE, MULTISCALERB, TPS, width, xshift, yshift
 
Constructor Summary
MultiscaleWarpRB(int w, int h)
          Creates a multi-scale warping object of the specified (equal input and output) dimensions
MultiscaleWarpRB(int w, int h, int tw, int th)
          Creates a multi-scale warping object of the specified input and output dimensions
 
Method Summary
 void concatenate(MultiscaleWarpRB warp1, MultiscaleWarpRB warp2)
          Concatenates two warps
 void copy(MultiscaleWarpRB warp)
          Copy the given warp
 float[] get(int x, int y)
          return the value of the warping function at the specified position
 boolean interpolate(int n, java.util.List<java.awt.geom.Point2D.Float> source, java.util.List<java.awt.geom.Point2D.Float> dest, boolean borders)
          Interpolates the given 2D values across the 2D space, by performing setup then calling interpolate()
 boolean interpolate(int n, java.awt.geom.Point2D.Float[] source, java.awt.geom.Point2D.Float[] dest, boolean borders)
          Interpolates the given 2D values across the 2D space, by performing setup then calling interpolate()
 boolean interpolate(java.util.List<javax.vecmath.TexCoord2f> source, java.util.List<javax.vecmath.TexCoord2f> dest, boolean borders)
          Interpolates using points in an ArrayList
 boolean interpolate(Template tmp1, Template tmp2, boolean sample, boolean borders)
          Interpolate this warping function from tmp1 to tmp2
 boolean interpolate(javax.vecmath.TexCoord2f[] source, javax.vecmath.TexCoord2f[] dest, boolean borders)
          Interpolates using the texture coords (values between 0 and 1)
 int upsample(MultiscaleWarpRB small, float[] filter, int m)
          Upsample small into this
 
Methods inherited from class Facemorph.Warp
concatenate, concatenate, convert, createWarp, getHeight, getWidth, interpolate, interpolate, iterate, overlap, reconvert, sample, sample, scaleWarp, set, stripPoints, warpFloatImage, warpImage, warpImage, warpImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiscaleWarpRB

public MultiscaleWarpRB(int w,
                        int h)
Creates a multi-scale warping object of the specified (equal input and output) dimensions

Parameters:
w - The desired width
h - The desired height

MultiscaleWarpRB

public MultiscaleWarpRB(int w,
                        int h,
                        int tw,
                        int th)
Creates a multi-scale warping object of the specified input and output dimensions

Parameters:
w - The desired width
h - The desired height
tw - The width of the source image
th - The height of the source image
Method Detail

copy

public void copy(MultiscaleWarpRB warp)
Copy the given warp

Parameters:
warp - the warp to copy

interpolate

public boolean interpolate(Template tmp1,
                           Template tmp2,
                           boolean sample,
                           boolean borders)
Interpolate this warping function from tmp1 to tmp2

Overrides:
interpolate in class Warp
Parameters:
tmp1 - Source template
tmp2 - target template
sample - should the contour samples be used, or just the control points
borders - Should we pin the border down
Returns:
true if interpolation successful

interpolate

public boolean interpolate(int n,
                           java.awt.geom.Point2D.Float[] source,
                           java.awt.geom.Point2D.Float[] dest,
                           boolean borders)
Interpolates the given 2D values across the 2D space, by performing setup then calling interpolate()

Specified by:
interpolate in class Warp
Parameters:
n - The number of constraints to interpolate
source - The array of start points
dest - The array of end points
borders - Specifies whether to fix the points on the borders
Returns:
true of the interpolation was successful, false otherwise

interpolate

public boolean interpolate(int n,
                           java.util.List<java.awt.geom.Point2D.Float> source,
                           java.util.List<java.awt.geom.Point2D.Float> dest,
                           boolean borders)
Interpolates the given 2D values across the 2D space, by performing setup then calling interpolate()

Parameters:
n - The number of constraints to interpolate
source - The array of start points
dest - The array of end points
borders - Specifies whether to fix the points on the borders
Returns:
true of the interpolation was successful, false otherwise

interpolate

public boolean interpolate(javax.vecmath.TexCoord2f[] source,
                           javax.vecmath.TexCoord2f[] dest,
                           boolean borders)
Interpolates using the texture coords (values between 0 and 1)

Parameters:
source - The source coordinates
dest - The destination coordinates
borders - Specifices if the borders should be fixed
Returns:
Returns true if interpolation was successful

interpolate

public boolean interpolate(java.util.List<javax.vecmath.TexCoord2f> source,
                           java.util.List<javax.vecmath.TexCoord2f> dest,
                           boolean borders)
Interpolates using points in an ArrayList

Parameters:
source - The list of source points
dest - The list of target points
borders - Specifies if the borders should be fixed
Returns:
Return true if interpolation was successful

upsample

public int upsample(MultiscaleWarpRB small,
                    float[] filter,
                    int m)
Upsample small into this

Parameters:
small - the small warp to upsample
filter - the upsampling filter
m - the mid (i.e. zero) point of the filter
Returns:
returns 1

get

public float[] get(int x,
                   int y)
return the value of the warping function at the specified position

Overrides:
get in class Warp
Parameters:
x - The x-coordinate
y - The y-coordinate
Returns:
A float array of 2 containing the x and y value of the warp.

concatenate

public void concatenate(MultiscaleWarpRB warp1,
                        MultiscaleWarpRB warp2)
Concatenates two warps

Parameters:
warp1 - the first warp
warp2 - the second warp