|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFacemorph.Warp
public abstract class Warp
Base warping class
Field Summary | |
---|---|
int |
height
The height of the warping function |
static int |
LINEAR
Linear warp constant |
static int |
MULTISCALE
Multiscale (affine) warp constant |
static int |
MULTISCALERB
Multiscale (rigid body)warp constant |
int |
theight
The height of the original image to warp |
static int |
TPS
Thin plate spline warp constant |
int |
twidth
The width of the original image to warp |
int |
width
The width of the warping function |
float[] |
xshift
The array of xshifts |
float[] |
yshift
The array of y-shifts |
Constructor Summary | |
---|---|
Warp()
Construct an empty warp |
Method Summary | |
---|---|
void |
concatenate(Warp warp)
Concatenates warp with this |
void |
concatenate(Warp warp1,
Warp warp2)
Concatenates the two warps and puts the result in this |
void |
convert(FloatImage Wx,
FloatImage Wy)
Converts this warp into the two FloatImages |
static Warp |
createWarp(int type,
int w,
int h,
int ow,
int oh,
boolean r)
Factory method for creating a warp of the specified type |
float[] |
get(int x,
int y)
Gets the value of this warp at (x,y) |
int |
getHeight()
Gets the height of this warp |
int |
getWidth()
Gets the width of this warp |
abstract boolean |
interpolate(int n,
java.awt.geom.Point2D.Float[] source,
java.awt.geom.Point2D.Float[] dest,
boolean borders)
Method to interpolate the warping function |
boolean |
interpolate(int n,
java.awt.geom.Point2D.Float[] source,
java.awt.geom.Point2D.Float[] dest,
boolean borders,
boolean overlap)
Interpolates the given 2D values across the 2D space, by performing setup then calling interpolate() |
boolean |
interpolate(Template tmp1,
Template tmp2,
boolean sample,
boolean borders)
Interpolate this warping function from tmp1 to tmp2 |
boolean |
interpolate(Template tmp1,
Template tmp2,
boolean sample,
boolean borders,
boolean overlap)
Interpolate this warping function from tmp1 to tmp2 |
int |
iterate(int n,
java.awt.geom.Point2D.Float[] source,
java.awt.geom.Point2D.Float[] dest,
Warp tmp,
float minJ,
boolean borders)
Implements an overlap control algorithm |
float |
overlap(float minJ)
Calculates the scaling parameter to ensure the Jacobean >= minJ and applies (if less than 1) it to this warp |
void |
reconvert(FloatImage Wx,
FloatImage Wy)
Converts the warp sepcified as two float images into this |
float[] |
sample(float x,
float y)
Samples this warp at non-intege pixels using bi-linear interpolation |
static java.awt.Color |
sample(int[] pix,
int width,
int height,
float x,
float y)
Sample from a non-integer point in an image (as an int array) using linear interpolated sampling |
void |
scaleWarp(float scaleFactor)
Scales a warp by the amount specified |
void |
set(int x,
int y,
float X,
float Y)
Sets the value of this warp at the specified point |
int |
stripPoints(java.awt.geom.Point2D.Float[] source,
java.awt.geom.Point2D.Float[] dest,
java.awt.geom.Point2D.Float[] newSource,
java.awt.geom.Point2D.Float[] newDest,
int n,
int w1,
int h1,
int w2,
int h2)
Removes points from both lists that are outside the image borders of their respective images |
FloatImage |
warpFloatImage(FloatImage fimg)
Warp a FloatImage using this warping function |
java.awt.image.BufferedImage |
warpImage(java.awt.image.BufferedImage img)
Warp an image using this warping function |
java.awt.Image |
warpImage(java.awt.Image img,
java.awt.image.ImageObserver ob)
Warp an image using this warping function |
int[] |
warpImage(java.awt.Image img,
int twidth,
int theight)
Warp an image using this warping function |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public float[] xshift
public float[] yshift
public int width
public int height
public int twidth
public int theight
public static final int MULTISCALE
public static final int LINEAR
public static final int TPS
public static final int MULTISCALERB
Constructor Detail |
---|
public Warp()
Method Detail |
---|
public static Warp createWarp(int type, int w, int h, int ow, int oh, boolean r)
type
- the type of warp to make, one of MULTISCALE, LINEAR, TPS or MULTISCALERBw
- the output widthh
- the output heightow
- the input widthoh
- the input heightr
- indicates reverse of the triangulation (i.e. triangulate the output not the input)
public boolean interpolate(int n, java.awt.geom.Point2D.Float[] source, java.awt.geom.Point2D.Float[] dest, boolean borders, boolean overlap)
n
- The number of constraints to interpolatesource
- The array of start pointsdest
- The array of end pointsborders
- Specifies whether to fix the points on the bordersoverlap
- indicates that overlap control should be used
public boolean interpolate(Template tmp1, Template tmp2, boolean sample, boolean borders, boolean overlap)
tmp1
- Source templatetmp2
- target templatesample
- should the contour samples be used, or just the control pointsborders
- Should we pin the border downoverlap
- indicates that overlap control should be used
public int getWidth()
public int getHeight()
public float[] get(int x, int y)
x
- The x-coordy
- The y-coord
public void set(int x, int y, float X, float Y)
x
- The x-coordy
- The y-coordX
- The X valueY
- The Y valuepublic abstract boolean interpolate(int n, java.awt.geom.Point2D.Float[] source, java.awt.geom.Point2D.Float[] dest, boolean borders)
n
- The number of constraintssource
- The start pointsdest
- The target pointsborders
- if true fix the borders
public boolean interpolate(Template tmp1, Template tmp2, boolean sample, boolean borders)
tmp1
- Source templatetmp2
- target templatesample
- should the contour samples be used, or just the control pointsborders
- Should we pin the border down
public int stripPoints(java.awt.geom.Point2D.Float[] source, java.awt.geom.Point2D.Float[] dest, java.awt.geom.Point2D.Float[] newSource, java.awt.geom.Point2D.Float[] newDest, int n, int w1, int h1, int w2, int h2)
source
- List of source pointsdest
- List of destination pointsnewSource
- output source point listnewDest
- output de3stination point listn
- the number of input pointsw1
- he width of image 1h1
- The height of image 1w2
- The width of image 2h2
- The height of image 2
public static java.awt.Color sample(int[] pix, int width, int height, float x, float y)
pix
- An array of the images pixels as RGB intswidth
- The width of the imageheight
- The height of theimagex
- The x-coord of the sample pointy
- Te y-coord of the sample point
public float[] sample(float x, float y)
x
- the x-coord to sampley
- the y-coord to sample
public int[] warpImage(java.awt.Image img, int twidth, int theight)
img
- The image to warptwidth
- The width of the input imagetheight
- The height of the input image
public java.awt.Image warpImage(java.awt.Image img, java.awt.image.ImageObserver ob)
img
- The image to warpob
- An image observer object
public java.awt.image.BufferedImage warpImage(java.awt.image.BufferedImage img)
img
- The image to warp
public FloatImage warpFloatImage(FloatImage fimg)
fimg
- The image to warp
public void concatenate(Warp warp)
warp
- the warp to concatenatepublic void concatenate(Warp warp1, Warp warp2)
warp1
- the first warpwarp2
- the second warppublic void convert(FloatImage Wx, FloatImage Wy)
Wx
- the output x shiftsWy
- the output y shiftspublic void reconvert(FloatImage Wx, FloatImage Wy)
Wx
- warp x-componentWy
- warp y componentpublic int iterate(int n, java.awt.geom.Point2D.Float[] source, java.awt.geom.Point2D.Float[] dest, Warp tmp, float minJ, boolean borders)
n
- number of pointssource
- source pointsdest
- target pointstmp
- tempory warp workspaceminJ
- minimum allowed value of the Jacobean in any partial warpborders
- indicates if borders should be pinned down
public float overlap(float minJ)
minJ
- the minimum allowed value of the Jacobean
public void scaleWarp(float scaleFactor)
scaleFactor
- the scale factor to apply to this warp
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |