|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Facemorph.Pyramid
public class Pyramid
A wavelet pyramid class for texture analysis / synthesis
Field Summary | |
---|---|
FloatImage[] |
horizontal
The set of horizontally filtered images at different resolutions |
int |
levels
The number of levels in this pyramid |
FloatImage |
smooth
The low pass residual |
FloatImage[] |
vertical
The set of vertically filtered images at different resolutions |
Constructor Summary | |
---|---|
Pyramid()
Construct an empty Pyramid |
|
Pyramid(int width,
int height,
int levels)
|
Method Summary | |
---|---|
boolean |
adaptAverage(Pyramid magPyr,
boolean smooth)
Multiplies this by the ratio of magPyr / variance(this) |
boolean |
adaptComplexAverage(Pyramid imag,
Pyramid magPyr)
Treats this as the real part and imag as the imaginary part and converts the values by multiplying by the ratio of complex magnitudes |
boolean |
adaptVariance(Pyramid varPyr,
boolean smooth)
Modifies this by multiplying by the ratio of varPyr over variance of this |
boolean |
add_to_average(Pyramid pyr,
int n)
Add pyr to this as part of constructing an average |
boolean |
add_to_variance(Pyramid pyr,
int n)
Adds pyr to this as part of estimating the average absolute value |
boolean |
add_to_varianceSquared(Pyramid pyr,
int n)
Adds pyr to this as part of estimating the variance squared |
void |
add(FloatImage image,
int level)
|
void |
add(Pyramid pyr,
boolean applyToSmooth)
Adds to the value of each subband of this Pyramid with the corresponding subband in the other Pyramid |
boolean |
addToComplexMagnitudeAverage(Pyramid real,
Pyramid imag,
int n)
Adds real and image to this as part of making an average magnitude |
boolean |
addWeighted(Pyramid pyr,
float w)
Adds a weighted amount of pyr to this |
void |
build_pyramid(Filter H,
Filter G,
int levs)
Build a Pyramid |
int |
calculateVariance(java.util.ArrayList<Pyramid> pyr,
int count)
Calculates the pixelwise variance of a set of Pyramids |
void |
collapse_pyramid(Filter H,
Filter L1,
Filter K1,
Filter L2,
Filter K2,
int bm)
Collapse the Pyramid |
void |
convolve(Filter H)
Filter all subbands |
Pyramid |
copy(boolean copySmooth)
Create a copy of this pyramid. |
void |
copy(Pyramid pyr)
Copy the given pyramid into this, including the low pass residual |
void |
copy(Pyramid pyr,
boolean copySmooth)
Copy the given Pyramis into this |
boolean |
copySubband(Pyramid pyr,
int lev)
Copy a subband of the given pyramid |
double |
dotProduct(Pyramid pyr)
Dot product, each level's contribution scaled up to match largest |
double |
dotProduct(Pyramid pyr,
FloatImage mask)
Dot product, each level's contribution scaled up to match largest |
void |
magnitude()
Convert each subband into a rectified (magnitude) image |
void |
magnitudeSquared()
Convert each subband into a rectified (magnitude squared) image |
static void |
main(java.lang.String[] args)
Main method used for testing |
int |
MRFTransform(Pyramid original,
java.util.ArrayList<Pyramid> source,
java.util.ArrayList<Pyramid> target,
float min,
float max,
int bins,
double[] coefs,
boolean weighted)
Pyramid based MRF transformation |
boolean |
read(java.lang.String fname)
Read a binary format FloatImage from a file |
static java.awt.Image |
readPPM(java.lang.String filename)
Read a PPM image from the named file |
void |
scale(float dp)
Multiplies the values in each subband by the value specified |
void |
setImage(FloatImage img)
Set the low pass residual (at level 0) and delete the bandpass images |
void |
subtract(FloatImage image,
int level)
|
void |
subtract(Pyramid pyr,
boolean applyToSmooth)
Adds to the value of each subband of this Pyramid with the corresponding subband in the other Pyramid |
boolean |
transformTexture(Pyramid oldPyr,
Pyramid source,
Pyramid destination,
float shift)
Transform using the magnitude |
boolean |
transformTextureSquared(Pyramid oldPyr,
Pyramid source,
Pyramid destination,
float shift)
Performs a texture transform using the squared magnitude values. |
boolean |
write(java.io.File f)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public FloatImage smooth
public FloatImage[] horizontal
public FloatImage[] vertical
public int levels
Constructor Detail |
---|
public Pyramid()
public Pyramid(int width, int height, int levels)
Method Detail |
---|
public void setImage(FloatImage img)
img
- the image to setpublic void copy(Pyramid pyr, boolean copySmooth)
pyr
- the Pyramid to copycopySmooth
- boolean indicating if the low pass residual should also be copiedpublic void copy(Pyramid pyr)
pyr
- the Pyramid to copypublic Pyramid copy(boolean copySmooth)
copySmooth
- boolean indicating if the low pass residual should also be copiedpublic boolean copySubband(Pyramid pyr, int lev)
pyr
- the pyramid to copylev
- the subband to copy
public void build_pyramid(Filter H, Filter G, int levs)
H
- the low-pass filterG
- the high pass filterlevs
- the number of levels to buildpublic void collapse_pyramid(Filter H, Filter L1, Filter K1, Filter L2, Filter K2, int bm)
H
- the low-pass filterL1
- the parallel even pixel filterK1
- the orthogonal even pixel filterL2
- the parallel odd pixel filterK2
- the orthogonal odd pixel filterbm
- the border model to use in the parallel directionpublic void magnitude()
public void magnitudeSquared()
public boolean add_to_variance(Pyramid pyr, int n)
pyr
- the pyramid to addn
- the number of pyramids that have been added previously
public boolean add_to_varianceSquared(Pyramid pyr, int n)
pyr
- the pyramid to addn
- the number of pyramids that have been added previously
public boolean addToComplexMagnitudeAverage(Pyramid real, Pyramid imag, int n)
real
- the real pyramid to addimag
- the imaginary pyramid to addn
- the number of pyramids that have been added previously
public boolean add_to_average(Pyramid pyr, int n)
pyr
- the pyramid to addn
- the number of pyramids that have been added previously
public boolean addWeighted(Pyramid pyr, float w)
pyr
- the pyramid to addw
- the weight to use
public void convolve(Filter H)
H
- the filter to usepublic boolean adaptAverage(Pyramid magPyr, boolean smooth)
magPyr
- the desired variancesmooth
- flag indicating if magPyr should be smoothed
public boolean adaptVariance(Pyramid varPyr, boolean smooth)
varPyr
- the desired variancesmooth
- flag indicating if varPyr should be smoothed
public boolean adaptComplexAverage(Pyramid imag, Pyramid magPyr)
imag
- the imaginary componentsmagPyr
- the target magnitude pyramid
public boolean transformTexture(Pyramid oldPyr, Pyramid source, Pyramid destination, float shift)
oldPyr
- the pyramid of the original (not-texture transformed) imagesource
- the pyramid of the source averagedestination
- the pyramid of the destination pyramidshift
- the amount to transform by
public boolean transformTextureSquared(Pyramid oldPyr, Pyramid source, Pyramid destination, float shift)
oldPyr
- the Pyramid decomposition before the colour transform was appliedsource
- the source average pyramiddestination
- the detination average pyramidshift
- the amount to transform by
public int calculateVariance(java.util.ArrayList<Pyramid> pyr, int count)
pyr
- the set of pyramidscount
- the number of pyramids
public int MRFTransform(Pyramid original, java.util.ArrayList<Pyramid> source, java.util.ArrayList<Pyramid> target, float min, float max, int bins, double[] coefs, boolean weighted)
original
- the original image pyramidsource
- the (warped) source image pyramidstarget
- the (warped) target image pyramidsmin
- the minimum value to put in the histogramsmax
- the maximum value to hold in the histogramsbins
- the number of bins
public boolean read(java.lang.String fname)
fname
- The name of the file to read
public boolean write(java.io.File f)
public double dotProduct(Pyramid pyr)
pyr
- the Pyramid to dot product with
public double dotProduct(Pyramid pyr, FloatImage mask)
pyr
- the Pyramid to dot product withmask
- the mask to use
public void scale(float dp)
dp
- the scale factorpublic void add(Pyramid pyr, boolean applyToSmooth)
pyr
- The pyramid to add to this one.applyToSmooth
- IF true the apply the addition to the smoothed image as wellpublic void add(FloatImage image, int level)
public void subtract(Pyramid pyr, boolean applyToSmooth)
pyr
- The pyramid to add to this one.applyToSmooth
- IF true the apply the addition to the smoothed image as wellpublic void subtract(FloatImage image, int level)
public static java.awt.Image readPPM(java.lang.String filename)
filename
- the name of the file to read from
public static void main(java.lang.String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |