|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectFacemorph.BSplineQuadTree
public class BSplineQuadTree
BSplineQuadTree performs 2D interpolation
| Constructor Summary | |
|---|---|
BSplineQuadTree(double width,
double height)
Constructor for BSplineQuadTree of given width and height |
|
| Method Summary | |
|---|---|
boolean |
addConstraint(int level,
int kx,
int ky,
double xval,
double yval)
Add a constraint to level level of this interpolation tree |
void |
addToEstimate(int level,
double x,
double y,
double u,
double v,
boolean warping)
Adds the values u and v to the estimate at point x, y, i.e. |
void |
addToLinearEstimate(double x,
double y,
double u,
double v)
Adds to the linear (affine) constraints |
double[] |
bsplineinterp(double x,
double y)
Performs interpolation rather than warping, so the shift between levels is added not concatenated |
double[] |
bsplinewarp(double x,
double y)
Find the warp shift at point (x, y), values between levels are concatenated not added |
boolean |
bsplinewarp(double x,
double y,
double[] res,
int lev)
Find the warp shift at point (x,y) |
void |
calculateInterpConstraints(int maxLev,
double[] xcoords,
double[] ycoords,
double[] ucoords,
double[] vcoords)
Calculate the interpolation function from the given constraints |
void |
calculateInterpConstraints(int maxLev,
FloatImage mask,
FloatImage xshift,
FloatImage yshift)
Calculate the interpolation with the constraints given as a set of FloatImages |
void |
calculateWarp(int levs,
java.util.ArrayList<java.awt.geom.Point2D.Float> t1pts,
java.util.ArrayList<java.awt.geom.Point2D.Float> t2pts)
Calculates a warp from the constraints given |
void |
calculateWarp(int levs,
Template t1,
Template t2)
Calculate a warp from the constraints given as two Templates |
void |
calculateWarpConstraints(int maxLev,
double[] xcoords,
double[] ycoords,
double[] ucoords,
double[] vcoords)
Calculate the constraints for warp |
void |
calculateWarpConstraints(int maxLev,
FloatImage mask,
FloatImage xshift,
FloatImage yshift)
Calculate the warp with constraints specified in FloatImages |
static void |
main(java.lang.String[] args)
Main method is used for testing |
void |
paint(java.awt.Graphics g)
Draws the interpolated function, mostly used for debugging |
double |
spline(double x)
Calculates the cubic B-spline on interval x=[0.0,4.0] |
void |
updateConstraints(int level)
Final step in setting the constraints |
void |
updateLinearConstraints()
Final step in constructing the linear (affine) part of the warp/interpolation |
java.awt.image.BufferedImage |
warpImage(java.awt.image.BufferedImage bimg)
Warps the image using this BSplineQuadTree |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BSplineQuadTree(double width,
double height)
width - the width of the area to interpolateheight - the height of the area to interpolate| Method Detail |
|---|
public boolean addConstraint(int level,
int kx,
int ky,
double xval,
double yval)
level - the max levels to go to in interpolatingkx - x coordinate of constraintky - y coordinate of constraintxval - value of x shiftyval - value of y shift
public double[] bsplinewarp(double x,
double y)
x - the x-coord to interpolate aty - the y coord to interpolate at
public boolean bsplinewarp(double x,
double y,
double[] res,
int lev)
x - the x-coord to interpolate aty - the y coord to interpolate atres - the result, should be a 2D array of doublelev - the level to interpolate at
public double[] bsplineinterp(double x,
double y)
x - the x-coord to interpolated aty - the y-coord to interpolate at
public void addToEstimate(int level,
double x,
double y,
double u,
double v,
boolean warping)
level - the level to add the estimate atx - the x-coord to add it aty - the y coord to add it atu - the x value of the estimatev - the y value of the estimatewarping - if true the position is shifted between levels to use concatentation, otherwise subtraction is used
public void addToLinearEstimate(double x,
double y,
double u,
double v)
x - the x-coord of the constrainty - the y-coord of the constraintu - the x-value of the shiftv - the y-value of the shiftpublic void updateLinearConstraints()
public void updateConstraints(int level)
level - the level to updatepublic double spline(double x)
x - the position to calculate the B-spline value at
public void calculateInterpConstraints(int maxLev,
double[] xcoords,
double[] ycoords,
double[] ucoords,
double[] vcoords)
maxLev - the maximum number of levels to use in this B-spline approximationxcoords - the x positionsycoords - the y positionsucoords - the x shiftsvcoords - the y shifts
public void calculateInterpConstraints(int maxLev,
FloatImage mask,
FloatImage xshift,
FloatImage yshift)
maxLev - the maximum levelsmask - selection function to indicate which points to usexshift - the shifts in the x -directionyshift - the shifts in the y direction
public void calculateWarpConstraints(int maxLev,
double[] xcoords,
double[] ycoords,
double[] ucoords,
double[] vcoords)
maxLev - maximum levels to usexcoords - the x positions of the constraintsycoords - the y positions of the constraintsucoords - the xshiftsvcoords - the yshifts
public void calculateWarpConstraints(int maxLev,
FloatImage mask,
FloatImage xshift,
FloatImage yshift)
maxLev - the maximum number of levels to usemask - the selection function for points to usexshift - the shifts in the x directionyshift - the shifts in the y directionpublic void paint(java.awt.Graphics g)
g - the graphics to draw topublic java.awt.image.BufferedImage warpImage(java.awt.image.BufferedImage bimg)
bimg - The BufferedImage to warp
public void calculateWarp(int levs,
java.util.ArrayList<java.awt.geom.Point2D.Float> t1pts,
java.util.ArrayList<java.awt.geom.Point2D.Float> t2pts)
levs - the number of levels to interpolate tot1pts - the starting pointst2pts - the target points
public void calculateWarp(int levs,
Template t1,
Template t2)
levs - the number of levels to build the warp tot1 - the start Templatet2 - the target Template
public static void main(java.lang.String[] args)
throws java.io.IOException
args - not used
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||