|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Facemorph.FloatImage
public class FloatImage
Floating point image data type Supports operations such as filtering
Nested Class Summary | |
---|---|
class |
FloatImage.FloatImageException
Thrown if a problem with a BigMat operation |
Constructor Summary | |
---|---|
FloatImage()
Constructs an empty FloatImage |
|
FloatImage(int w,
int h)
Constructs a FloatImage of the size specified |
|
FloatImage(int w,
int h,
double[] d)
Constructs a FloatImage of the size specified from a suitably sized array of floats |
|
FloatImage(int w,
int h,
float[] d)
Constructs a FloatImage of the size specified from a suitably sized array of floats |
Method Summary | |
---|---|
boolean |
adaptAverage(FloatImage varSquared)
Adapts the average to have the same locally smoothed magnitude as varSquared |
boolean |
add(float w)
Adds a constant to each pixel |
boolean |
add(FloatImage fimg)
Adds fimg to this to give this = this + fimg |
boolean |
add(FloatImage fimg,
float w)
Adds a scaled amount of fimg to this to give this = this + w*fimg |
void |
add(FloatImage fimg1,
FloatImage fimg2)
Adds two FloatImages, putting the result in this |
int |
addToAverage(FloatImage fimg,
int n)
Adds an image into this average image |
boolean |
addToVariance(FloatImage fimg1,
FloatImage fimg2,
int n)
Adds fimg1 and fimg2 to this complex magnitude average as the real and imaginary parts |
boolean |
addToVariance(FloatImage fimg1,
int n)
Adds fimg1 to the average of absolute values |
boolean |
addToVarianceSquared(FloatImage fimg1,
int n)
Add fimg1 to the average of squared images |
int |
adjust(FloatImage xshift,
FloatImage yshift,
FloatImage xtmp,
FloatImage ytmp)
Replaces xshift(x,y)=xtmp(x,y) and yshift(x,y)=ytmp(x,y at locations where this(x,y)=0 |
static double |
bytesToDouble(byte[] bytes,
int offset)
Convert a byte array into a double |
static float |
bytesToFloat(byte[] bytes,
int offset)
Convert a byte array into a float |
static int |
bytesToInt(byte[] bytes,
int offset)
Converts some bytes into an int |
static long |
bytesToLong(byte[] bytes,
int offset)
Converts some bytes into a long |
static FloatImage[] |
calculateCurvature(FloatImage[] pmap,
int scale)
Calculates the curvature after scaling by the amount indicated |
void |
classify(FloatImage R,
FloatImage G,
FloatImage B,
FloatImage probCol,
FloatImage probColGivenSkin)
Classifies the liklihood of pixels in an image belonging to the class defined by 2 histograms. |
static FloatImage |
combineUV(FloatImage U,
FloatImage V)
Attempts to combine the U and V components to a single channel for skin detection using U*U*(U*U-U/V)*(U*U-U/V) |
void |
convertImage(java.awt.image.BufferedImage bimg)
Converts the given image into this float image, the pixel values are the mean of the r,g,b values |
static void |
convertImage(java.awt.image.BufferedImage img,
FloatImage red,
FloatImage green,
FloatImage blue)
Converts a BufferedImage into three FloatImages for red, green and blue |
void |
convertImage(java.awt.Image img)
Converts the given image into this float image, the pixel values are the mean of the r,g,b values |
static boolean |
convertImage(java.awt.Image img,
FloatImage R,
FloatImage G,
FloatImage B,
java.awt.image.ImageObserver ob)
Splits a colour image into 3 FloatImages |
void |
convertImage(int[] pixels,
int w,
int h)
Convert the int array (each int is an RGB colour) into an intensity image |
static boolean |
convertImageHSV(java.awt.Image img,
FloatImage H,
FloatImage S,
FloatImage V,
java.awt.image.ImageObserver ob)
Splits a colour image into 3 FloatImages Note: this isn't proper HSV, more like YUV components, with UV converted to polar coords ... |
static boolean |
convertImageLAB(java.awt.Image img,
FloatImage L,
FloatImage A,
FloatImage B,
java.awt.image.ImageObserver ob)
Splits a colour image into 3 (LAB) component FloatImages |
static boolean |
convertImageRGB(java.awt.Image img,
FloatImage R,
FloatImage G,
FloatImage B,
java.awt.image.ImageObserver ob)
Splits a colour image into 3 FloatImages |
static boolean |
convertImageYUV(java.awt.Image img,
FloatImage Y,
FloatImage U,
FloatImage V,
java.awt.image.ImageObserver ob)
Splits a colour image into 3 (YUV) component FloatImages |
static void |
convertInterleaveImageRGB(java.awt.image.BufferedImage img,
FloatImage rgb)
Converts a BufferedImage into one interleaved FloatImages in Red, Green, Blue order |
void |
convertSubImage(int[] pixels,
int width,
int height,
int x,
int y,
int w,
int h)
Convert the int array (each int is an RGB colour) into an intensity image |
static java.awt.Image |
convertToImage(FloatImage R,
FloatImage G,
FloatImage B)
Create a colour image from three float images representing the R, G and B components |
static java.awt.Image |
convertToImageYUV(FloatImage Y,
FloatImage U,
FloatImage V)
Create a colour image from three float images representing the Y, U and V components |
void |
convolve_x(FloatImage fimg,
float[] filter,
int m,
int scale)
Filter this FloatImage in the x direction |
void |
convolve_x(FloatImage fimg,
FloatImage mask,
float[] filter,
int m,
int scale)
Filter this FloatImage in the x direction with masking |
void |
convolve_y(FloatImage fimg,
float[] filter,
int m,
int scale)
Filter this FloatImage in the y direction |
void |
convolve_y(FloatImage fimg,
FloatImage mask,
float[] filter,
int m,
int scale)
Filter this FloatImage in the y direction with masking |
void |
convolve(float[] filter,
int m,
int scale)
Filter the image in the x and y directions (separably) with the filter specified |
void |
convolve(FloatImage fimg,
float[][] filter,
int m,
int n,
int scale)
Non-separable convolution |
void |
convolve(FloatImage mask,
float[] filter,
int m,
int scale)
Filter the image in the x and y directions (separably) with the filter specified with masking |
void |
convolve(FloatImage fimg,
FloatImage filter,
int m,
int n,
int scale)
Convolve this float image with a filter defined by an image |
boolean |
convolveFFT(FloatImage fimg1,
FloatImage fimg2,
boolean inverse)
FFT based convolution, the result is put in this |
FloatImage |
copy()
Creates and returns a copy of this image |
void |
copy(FloatImage fimg)
Copy fimg into this |
int |
correlationFFT(FloatImage fimg1,
FloatImage fimg2)
Correlation using FFT, the result is held in this |
static FloatImage |
createColourHistogram(FloatImage R,
FloatImage G,
FloatImage B)
Creates a 2D colour histogram (R/(R+G+B), G/(R+G+B)) for an image. |
static FloatImage |
createColourHistogram(FloatImage R,
FloatImage G,
FloatImage B,
FloatImage mask)
Creates a 2D colour histogram (R/(R+G+B), G/(R+G+B)) for part of an image defines by a mask. |
java.util.ArrayList<KdTreePoint> |
createTreePoints(FloatImage edges,
FloatImage xdir,
FloatImage ydir,
FloatImage xxdir,
FloatImage yydir,
FloatImage xydir)
Create an array of kd tree points using pre-selected edge points |
static FloatImage[] |
deinterleaveImages(FloatImage rgb)
Take an interleaved image, eg. |
static void |
deinterleaveImages(FloatImage rgb,
FloatImage red,
FloatImage green,
FloatImage blue)
|
boolean |
divide(FloatImage fimg,
float tol)
Divides this image by fimg to give this = this / fimg |
int |
divide(FloatImage f,
FloatImage g)
Pixelwise divide f and g by this and set this to 1 (where this is not zero) |
float |
dotProduct(FloatImage fimg)
Finds the dot product (aka scalar product or sum of pixel products) of this image with fimg |
float |
dotProduct(FloatImage fimg,
FloatImage mask)
Finds the dot product (aka scalar product or sum of pixel products) of a masked part of this image with fimg |
static void |
doubleToBytes(double val,
byte[] bytes,
int offset)
Convert a double into a byte array |
void |
dual_convolve_x(FloatImage fimg,
float[] filter1,
float[] filter2,
int m1,
int m2,
int bm)
Convolves in x-direction with two different filters at odd and even pixels respectively |
void |
dual_convolve_y(FloatImage fimg,
float[] filter1,
float[] filter2,
int m1,
int m2,
int bm)
Convolves in y-direction with two different filters at odd and even pixels respectively |
void |
edgeMagnitude(FloatImage dx,
FloatImage dy)
Calculates the magnitude of edges |
void |
edgeWarp(FloatImage dest,
MultiscaleWarp shift,
int level,
int warpType,
java.lang.String output)
Non-recursive edge matching |
FloatImage |
erodeMask()
Perform binary erosion on this FloatImage, any pixels adjacent to zero values are set to zero |
void |
expand(FloatImage fimg,
float[] filter,
int m)
Make a double sized version of this and put it in fimg, the filter is used after placing zeros between rows and cols |
void |
expand(FloatImage fimg,
float[] filter,
int m,
int outW,
int outH)
Make a double sized version of this and put it in fimg, the filter is used after placing zeros between rows and cols |
int |
fillPolygon(java.awt.geom.Point2D.Float[] pts,
float[] vals)
Draws a filled polygon on this image with the value v |
int |
fillPolygon(java.awt.geom.Point2D.Float[] pts,
float u,
float v)
Draws a filled polygon on this image with the value v |
static float |
findThreshold(float[] data,
float percent)
Attempts to find a suitable threshold on data to keep percentage points |
static void |
floatToBytes(float val,
byte[] bytes,
int offset)
Convert a float to a byte array |
static float |
germanMcClure(FloatImage[] fimg,
FloatImage[] av,
float d)
Calculates the German-McClure error function between this and fimg using weighting d |
float |
germanMcClure(FloatImage fimg,
float d)
Calculates the German-McClure error function between this and fimg using weighting d |
float |
get_nocheck(int x,
int y)
Gets without checking the bounds |
float |
get(int i)
Get the ith element of the data array |
float |
get(int x,
int y)
Gets (x,y) and maps values outside the image onto the nearest internal point |
float[] |
getData()
Get the data vector for this image |
int |
getHeight()
Get the height of this image |
int |
getMatchingPoints(FloatImage dest_edge,
FloatImage[] sourceData,
FloatImage[] destData,
java.util.ArrayList<java.awt.geom.Point2D.Float> srcPts,
java.util.ArrayList<java.awt.geom.Point2D.Float> dstPts)
Gets two-way matching points |
float |
getMean()
Gets the mean of this images pixel values |
float[] |
getMeanAndSD()
Get the mean and standard deviation of this image |
float[] |
getMeanAndSD(FloatImage mask)
Get the mean and standard deviation of this image |
float[] |
getMeanAndSD(int x,
int y,
int w,
int h)
Get the mean and standard deviation of a patch of this image |
FloatImage |
getSubImage(int x,
int y,
int w,
int h)
Gets a sub-part of this image |
int |
getWidth()
Get the width of this image |
int |
icpEdgeWarp(FloatImage dest,
MultiscaleWarp shift,
int minwidth)
Iterative closest point warp |
static FloatImage |
interleaveImages(FloatImage red,
FloatImage green,
FloatImage blue)
Turn separate three red green and blue images into one image by interleaving the pixels |
int |
interpolate(FloatImage xshift,
FloatImage yshift,
float[] f1,
float[] f2,
int n1,
int n2,
int levels,
float minJ,
int rlevel)
Performs a multiscale interpolation scheme |
static void |
intToBytes(int val,
byte[] bytes,
int offset)
Converts an int to a byte array |
void |
invScale(FloatImage fimg)
Scale each pixel in this image by the inverse of the value of the corresponding pixel in the other image |
static void |
longToBytes(long val,
byte[] bytes,
int offset)
Converts a long into a byte array |
void |
magnitude()
Replaces each pixel with its absolute value |
void |
magnitudeSquared()
Replaces each pixel with itself squared |
static void |
main(java.lang.String[] args)
Main method used for testing |
boolean |
mask(FloatImage maskImg)
Masks this FloatImage |
boolean |
mask(FloatImage maskImg,
float outside)
Masks this FloatImage |
int |
maxima(FloatImage xdir,
FloatImage ydir,
FloatImage edges,
float thresh)
Find the maxima in the directions given |
java.util.ArrayList<KdTreePoint> |
maxima(FloatImage xdir,
FloatImage ydir,
FloatImage xxdir,
FloatImage yydir,
FloatImage xydir,
float thresh)
Create a kd-tree of maxima points using edge information |
int |
multiEdgeWarp(FloatImage dest,
FloatImage[] pmapSrc,
FloatImage[] pmapDst,
MultiscaleWarp shift,
int minwidth,
int level)
Multiscale edge based warping with curvature |
int |
multiEdgeWarp(FloatImage dest,
FloatImage xshift,
FloatImage yshift)
Edge based warping method |
void |
multiEdgeWarp(FloatImage dest,
MultiscaleWarp shift,
int minwidth,
int warpType)
Recursive edge matching & warping |
void |
multiEdgeWarp(FloatImage dest,
MultiscaleWarp shift,
int minwidth,
int level,
boolean allscales,
int warpType,
java.lang.String output)
Recursive edge matching & warping |
boolean |
multiply(FloatImage fimg)
Mulitplies this image by fimg to give this = this * fimg |
int |
MultiscaleBlendWaveletMRF_fast2(java.util.ArrayList<FloatImage> source,
int count,
int lev,
Filter H,
Filter G,
Filter H2,
Filter K1,
Filter K2,
Filter L1,
Filter L2)
Blends a set of greyscale images using a multiscale MRF method Algorithm for each source image calculate the low pass version (save for pass to recursive call), calculate the horizontal and vertical wavelet filtered versions, Calculate the low pass version of the input image via recursive call Estimate the horizontal and vertical images using MRF method on wavelet & low pass images Reconstruct image using low-pass and horizontal & vertical wavelets |
void |
multiscaleOpticFlow(FloatImage target,
MultiscaleWarp shift,
int minwidth)
Multi scale optical flow method |
int |
MultiscaleTransformWaveletMRF_fast2(FloatImage original,
java.util.ArrayList<FloatImage> source,
java.util.ArrayList<FloatImage> target,
int lev,
Filter H,
Filter G,
Filter H2,
Filter K1,
Filter K2,
Filter L1,
Filter L2)
Algorithm for each source image calculate the low pass version (save for pass to recursive call), calculate the horizontal and vertical wavelet filtered versions, Calculate the low pass version of the input image via recursive call Estimate the horizontal and vertical images using MRF method on wavelet & low pass images Reconstruct image using low-pass and horizontal & vertical wavelets |
float |
ncc(FloatImage fimg)
Calculates the normalised cross correlation (NCC) with fimg |
float |
ncc(FloatImage fimg,
FloatImage mask)
Calculates the normalised cross correlation (NCC) with fimg using only the masked regions |
float |
nccPatch(FloatImage fimg,
int x,
int y)
Calculates the normalised cross correlation (NCC) with fimg |
float[] |
nccPatchArray(FloatImage fimg)
Calculates the normalised cross correlation (NCC) with fimg |
float |
nccPatches(FloatImage fimg)
Calculates the normalised cross correlation (NCC) with fimg |
void |
normalise(float mean,
float sd)
Adjusts this image to have the specified mean and s.d. |
void |
normalise(float mean,
float sd,
FloatImage mask)
Adjusts this image to have the specified mean and s.d. |
void |
normalise(FloatImage fimg)
Adjusts this image to have the same mean and s.d. |
void |
normalise(FloatImage fimg,
FloatImage mask)
Adjusts this image to have the same mean and s.d. |
void |
opticFlow(FloatImage target,
MultiscaleWarp shift)
Basic optical flow implementation |
static void |
quicksort(float[] data,
int start,
int end)
Quicksort implementation |
void |
read(java.io.DataInputStream in)
Read a binary format FloatImage from a file |
boolean |
read(java.lang.String fname)
Read a binary format FloatImage from a file |
int[] |
reconvertImage()
Creates an int array of colour values from this FloatImage |
static java.awt.image.BufferedImage |
reconvertImage(FloatImage red,
FloatImage green,
FloatImage blue)
Converts the red, green and blue colour components into a BufferedImage |
static java.awt.image.BufferedImage |
reconvertImage(FloatImage red,
FloatImage green,
FloatImage blue,
FloatImage alpha)
Converts the red, green and blue colour components into a BufferedImage |
static java.awt.image.BufferedImage |
reconvertImageYUV(FloatImage Y,
FloatImage U,
FloatImage V)
Create a colour image from three float images representing the Y, U and V components |
void |
reduce(FloatImage fimg,
float[] filter,
int m)
Make this a shrunken version of fimg by subsampling every other pixel (in x and y) after convolving with filter |
FloatImage |
reduce(FloatImage fimg,
FloatImage mask,
float[] filter,
int m)
Make this a shrunken version of fimg by subsampling every other pixel (in x and y) after convolving with filter |
void |
reduce(FloatImage fimg,
FloatImage filter,
int m)
Make this a shrunken version of fimg by subsampling every other pixel (in x and y) after convolving with filter |
static java.awt.Image |
reduce(java.awt.Image img,
float[] filter,
int m)
Make this a shrunken version of img by subsampling every other pixel (in x and y) after convolving with filter |
FloatImage |
resize(int w,
int h)
Resize this image using bilinear resampling to the specified dimensions |
float |
sample(float x,
float y)
Samples (x,y) using bi-linear interpolation |
double |
sampleAverage()
|
void |
scale(float w)
Adds a scaled amount of fimg to this i.e. |
void |
scale(FloatImage fimg)
Scale each pixel in this image by the value of the corresponding pixel in the other image |
void |
set_nocheck(int i,
float v)
Sets (x,y)=v without checking the bounds |
void |
set_nocheck(int x,
int y,
float v)
Sets (x,y)=v without checking the bounds |
int |
set(int x,
int y,
float v)
Sets (x,y)=v if (x,y) is within the image |
void |
setSize(int w,
int h)
Sets the dimension of the image and reallocates the memory (i.e. |
FloatImage |
shift(float w,
float t)
Creates a scaled and shift version of this image i.e. |
void |
sqrDifference(FloatImage fimg,
FloatImage filter,
int m,
int n,
int scale)
find the square difference between this float image with a filter defined by an image using a windowing technique |
void |
sqrt()
Fill in the square root of this FloatImage |
void |
subtract(float val)
Subtract val from each pixel |
boolean |
subtract(FloatImage fimg)
Subtracts fimg from this i.e. |
static int |
subtractIgnoreZeros(FloatImage[] current,
FloatImage[] fimg)
Subtracts fimg from current i.e. |
double |
sum()
Return the sum of all pixels in this image |
static float |
sumError(FloatImage[] fimg,
FloatImage[] av)
Calculates the sum error function between this and fimg using weighting d |
static float |
sumErrorSquared(FloatImage[] fimg,
FloatImage[] av)
Calculates the sum squared error function between this and fimg using weighting d |
int |
threshold(FloatImage edges,
float thresh)
Find the points bigger than the threshold |
int |
thresholdPercent(FloatImage edges,
float thresh)
Thresholds the image at a certain percentage of points are kept |
FloatImage |
transform(float[][] mat,
int w,
int h)
Perform an affine transform on the image geometry |
int |
transform(FloatImage src,
FloatImage dst,
float scale)
Transforms the image by adding (dst-src)*scale |
boolean |
transformMagnitude(FloatImage var1,
FloatImage var2,
float shift)
Transforms this by multiplying by var2(x,y)/var1(x,y)^shift |
boolean |
transformMagSquared(FloatImage var1,
FloatImage var2,
float shift)
Transforms this by multiplying by var2(x,y)/var1(x,y)^(shift*0.5) |
double[] |
vectorise(double[] vec)
Converts a FloatImage to a double array |
boolean |
vectorise(double[] vec,
int offset)
Converts a FloatImage to a double array |
static double[] |
vectorise(FloatImage[] colImg)
Vectorises a colour image stored as 3 FloatImages. |
FloatImage |
warp(FloatImage xshift,
FloatImage yshift,
int w,
int h)
Warps this using the x and y shifts specified and returns the result as a w by h size image |
FloatImage |
warpShift(FloatImage xshift,
FloatImage yshift,
int w,
int h)
Warps this using the x and y functions specified and returns the result as a w by h size image |
int |
weightedTransformMRFHorizontal(FloatImage original,
FloatImage this_small,
FloatImage original_small,
FloatImage magnitude,
FloatImage[] source,
java.util.ArrayList<FloatImage> source_small,
int scount,
FloatImage[] target,
java.util.ArrayList<FloatImage> target_small,
int tcount,
double alpha)
MRF transform method |
int |
weightedTransformMRFVertical(FloatImage original,
FloatImage this_small,
FloatImage original_small,
FloatImage magnitude,
FloatImage[] source,
java.util.ArrayList<FloatImage> source_small,
int scount,
FloatImage[] target,
java.util.ArrayList<FloatImage> target_small,
int tcount,
double alpha)
MRF transform method |
void |
write(java.io.DataOutputStream out)
Write a binary format FloatImage to a DataOutputStream |
boolean |
write(java.lang.String fname)
Write a binary format FloatImage to a file |
void |
writeCurvImage(FloatImage[] srcCurv,
java.lang.String outfile)
Writes a curvature image to file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FloatImage()
public FloatImage(int w, int h)
w
- the widthh
- the heightpublic FloatImage(int w, int h, float[] d)
w
- the widthh
- the heightd
- the array of floating point datapublic FloatImage(int w, int h, double[] d)
w
- the widthh
- the heightd
- the array of floating point dataMethod Detail |
---|
public float[] getData()
public int getWidth()
public int getHeight()
public float get_nocheck(int x, int y)
x
- coordinatey
- coordinate
public float get(int x, int y)
x
- coordinatey
- coordinate
public float get(int i)
i
- the element to get
public void set_nocheck(int x, int y, float v)
x
- coordinatey
- coordinatev
- valuepublic void set_nocheck(int i, float v)
i
- index in data arrayv
- valuepublic int set(int x, int y, float v)
x
- coordinatey
- coordinatev
- value
public float sample(float x, float y)
x
- coordinatey
- coordinate
public static float bytesToFloat(byte[] bytes, int offset)
bytes
- The array of bytes containgin those to convertoffset
- The index in the byte array to start
public static void floatToBytes(float val, byte[] bytes, int offset)
val
- the value to convert into a byte arraybytes
- The array of bytes containgin those to convertoffset
- The index in the byte array to startpublic static double bytesToDouble(byte[] bytes, int offset)
bytes
- The array of bytes containgin those to convertoffset
- The index in the byte array to start
public static void doubleToBytes(double val, byte[] bytes, int offset)
bytes
- The array of bytes containgin those to convertoffset
- The index in the byte array to startval
- The double value to writepublic static long bytesToLong(byte[] bytes, int offset)
bytes
- The array of bytes containg those to convertoffset
- The index to start at in the byte array
public static int bytesToInt(byte[] bytes, int offset)
bytes
- The array of bytes containg those to convertoffset
- The index to start at in the byte array
public static void intToBytes(int val, byte[] bytes, int offset)
val
- The value to convert to a byte arraybytes
- The array of bytes containg those to convertoffset
- The index to start at in the byte arraypublic static void longToBytes(long val, byte[] bytes, int offset)
val
- The value to convert to a byte arraybytes
- The array of bytes containg those to convertoffset
- The index to start at in the byte arraypublic static void main(java.lang.String[] args)
args
- The arguments to pass to mainpublic boolean read(java.lang.String fname)
fname
- The name of the file to read
public void read(java.io.DataInputStream in) throws java.io.IOException
in
- A dataInputStream opened on the file to read
java.io.IOException
- thrown if there is an IO problempublic void write(java.io.DataOutputStream out) throws java.io.IOException
out
- The DataOutputSAtream to write to
java.io.IOException
- thrown if there is an IO problempublic boolean write(java.lang.String fname)
fname
- The name of the file to read
public void reduce(FloatImage fimg, float[] filter, int m)
fimg
- The image to shrinkfilter
- Filter to apply before shrinkingm
- the midpoint of the filterpublic void reduce(FloatImage fimg, FloatImage filter, int m)
fimg
- The image to shrinkfilter
- Filter to apply before shrinkingm
- the midpoint of the filterpublic FloatImage reduce(FloatImage fimg, FloatImage mask, float[] filter, int m)
fimg
- The image to shrinkmask
- Masking imagefilter
- Filter to apply before shrinkingm
- the midpoint of the filter
public static java.awt.Image reduce(java.awt.Image img, float[] filter, int m)
img
- The Image to shrinkfilter
- Filter to apply before shrinkingm
- the midpoint of the filter
public void expand(FloatImage fimg, float[] filter, int m)
fimg
- the destination FloatImagefilter
- the upsampling filter coefficeintsm
- the filter midpointpublic void expand(FloatImage fimg, float[] filter, int m, int outW, int outH)
fimg
- the destination FloatImagefilter
- the upsampling filter coefficeintsm
- the filter midpointoutW
- the output widthoutH
- the output heightpublic void convolve(FloatImage fimg, float[][] filter, int m, int n, int scale)
fimg
- the output image, should have same width and height as thisfilter
- the filter to usem
- the mid-point in xn
- the mid-point in yscale
- the scale factorpublic void convolve(FloatImage fimg, FloatImage filter, int m, int n, int scale)
fimg
- out imagefilter
- the filter to convolve withm
- the horizonal midpoint of the filtern
- the vertical midpoint of the filterscale
- the scale factor of the convolutionpublic void sqrDifference(FloatImage fimg, FloatImage filter, int m, int n, int scale)
fimg
- out imagefilter
- the filter to convolve withm
- the horizonal midpoint of the filtern
- the vertical midpoint of the filterscale
- the scale factor of the convolutionpublic void convolve(float[] filter, int m, int scale)
filter
- The array of values representing the filterm
- The index ofthe mid point of the filterscale
- The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)public void convolve_x(FloatImage fimg, float[] filter, int m, int scale)
fimg
- Stores the output FloatImagefilter
- The filter to applym
- The mid point of the filterscale
- The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)public void convolve_y(FloatImage fimg, float[] filter, int m, int scale)
fimg
- Stores the output FloatImagefilter
- The filter to applym
- The mid point of the filterscale
- The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)public void convolve(FloatImage mask, float[] filter, int m, int scale)
mask
- the mask image to usefilter
- The array of values representing the filterm
- The index ofthe mid point of the filterscale
- The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)public void convolve_x(FloatImage fimg, FloatImage mask, float[] filter, int m, int scale)
fimg
- Stores the output FloatImagemask
- the mask image to usefilter
- The filter to applym
- The mid point of the filterscale
- The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)public void convolve_y(FloatImage fimg, FloatImage mask, float[] filter, int m, int scale)
fimg
- Stores the output FloatImagemask
- mask image to usefilter
- The filter to applym
- The mid point of the filterscale
- The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)public FloatImage erodeMask()
public boolean add(FloatImage fimg, float w)
fimg
- The FloatImage to addw
- The weight
public float germanMcClure(FloatImage fimg, float d)
fimg
- The FloatImage to compare tod
- The weight
public static float germanMcClure(FloatImage[] fimg, FloatImage[] av, float d)
fimg
- The FloatImage to compare toav
- the (average) image that the error is being measured fromd
- The weight
public static float sumError(FloatImage[] fimg, FloatImage[] av)
fimg
- The FloatImage to compare toav
- the (average) image that the error is being measured from
public static float sumErrorSquared(FloatImage[] fimg, FloatImage[] av)
fimg
- The FloatImage to compare toav
- the (average) image that the error is being measured from
public boolean add(FloatImage fimg)
fimg
- The FloatImage to add
public void add(FloatImage fimg1, FloatImage fimg2)
fimg1
- the first image to addfimg2
- the second image to addpublic boolean multiply(FloatImage fimg)
fimg
- The FloatImage to add
public boolean divide(FloatImage fimg, float tol)
fimg
- The FloatImage to addtol
- values in fimg below tol are not divided
public void magnitude()
public void magnitudeSquared()
public void edgeMagnitude(FloatImage dx, FloatImage dy)
dx
- the x-derivative imagedy
- the y-derivative imagepublic void dual_convolve_x(FloatImage fimg, float[] filter1, float[] filter2, int m1, int m2, int bm)
fimg
- the output imagefilter1
- the even pixel filterfilter2
- the odd pixel fitlerm1
- the even filter midpointm2
- the odd fitler midpointbm
- the border modelpublic void dual_convolve_y(FloatImage fimg, float[] filter1, float[] filter2, int m1, int m2, int bm)
fimg
- the output imagefilter1
- the even pixel filterfilter2
- the odd pixel fitlerm1
- the even filter midpointm2
- the odd fitler midpointbm
- the border modelpublic void setSize(int w, int h)
w
- widthh
- heightpublic FloatImage resize(int w, int h)
w
- the desired widthh
- the desired height
public FloatImage getSubImage(int x, int y, int w, int h)
x
- The x-coordy
- the y-coordw
- the output widthh
- the output height
public boolean mask(FloatImage maskImg)
maskImg
- Zeros pixels defined by the mask image
public boolean mask(FloatImage maskImg, float outside)
maskImg
- Zeros pixels defined by the mask imageoutside
- the constant value to put outside the masked area
public FloatImage copy()
public void copy(FloatImage fimg)
fimg
- the image to copypublic boolean add(float w)
w
- The constant to add
public int addToAverage(FloatImage fimg, int n)
fimg
- The image to add to thisn
- The number of images in the average already
public boolean adaptAverage(FloatImage varSquared)
varSquared
- the variance squared image
public boolean addToVariance(FloatImage fimg1, int n)
fimg1
- the image to addn
- the number of images added previously
public boolean addToVarianceSquared(FloatImage fimg1, int n)
fimg1
- the image to addn
- the number of images previously added to the average
public boolean addToVariance(FloatImage fimg1, FloatImage fimg2, int n)
fimg1
- the real part to addfimg2
- the imaginary part to addn
- the number of images previously added to this
public FloatImage transform(float[][] mat, int w, int h)
mat
- the transform parameters in a 2 by 3 matrixw
- the output widthh
- the output height
public int transform(FloatImage src, FloatImage dst, float scale)
src
- The source imagedst
- The destingation imagescale
- The amount of transform (0 - no transform, 1 = 100% transform)
public boolean transformMagnitude(FloatImage var1, FloatImage var2, float shift)
var1
- the variance of thisvar2
- the desired varianceshift
- the amount to transform by
public boolean transformMagSquared(FloatImage var1, FloatImage var2, float shift)
var1
- the mag squared of thisvar2
- the desired mag squaredshift
- the amount to transform by
public FloatImage shift(float w, float t)
w
- The ammount to add to each pixel after scalingt
- The amount to scale this image by
public void scale(float w)
w
- The weightpublic void scale(FloatImage fimg)
fimg
- image with scaling values.public void invScale(FloatImage fimg)
fimg
- image with scaling values.public void normalise(FloatImage fimg)
fimg
- The image whose mean and s.d. to copypublic void normalise(FloatImage fimg, FloatImage mask)
fimg
- The image whose mean and s.d. to copymask
- the selection function to usepublic void normalise(float mean, float sd)
mean
- the desired meansd
- the desired sdpublic void normalise(float mean, float sd, FloatImage mask)
mean
- the desired meansd
- the desired sdmask
- selection function (usually 0 or 1)public float[] getMeanAndSD()
public float[] getMeanAndSD(int x, int y, int w, int h)
x
- the smallest x coord of the patchy
- the smallest y coord of the patchw
- the width of the patchh
- the height of the patch
public float[] getMeanAndSD(FloatImage mask)
mask
- the mask that selects pixels (usually values are 0 or 1)
public float ncc(FloatImage fimg)
fimg
- the image to find the NCC with
public float nccPatches(FloatImage fimg)
fimg
- the image to find the NCC with
public float[] nccPatchArray(FloatImage fimg)
fimg
- the image to find the NCC with
public float nccPatch(FloatImage fimg, int x, int y)
fimg
- the image to find the NCC withx
- the x coordinate of the location to calculate the ncc aty
- the y coordinate of the location to calculate the ncc at
public float ncc(FloatImage fimg, FloatImage mask)
fimg
- the image to calulate the NCC withmask
- the mask specifying which image regions to use
public boolean subtract(FloatImage fimg)
fimg
- The FloatImage to subtract
public void sqrt()
public static int subtractIgnoreZeros(FloatImage[] current, FloatImage[] fimg)
current
- the image to subtract fimg fromfimg
- The FloatImage to subtract
public static boolean convertImageYUV(java.awt.Image img, FloatImage Y, FloatImage U, FloatImage V, java.awt.image.ImageObserver ob)
img
- The image to splitU
- The output container for the U componentV
- The output container for the V componentY
- The output container for the intensity componentob
- An image observer for img
public static boolean convertImageLAB(java.awt.Image img, FloatImage L, FloatImage A, FloatImage B, java.awt.image.ImageObserver ob)
img
- The image to splitL
- The output container for the intensity componentA
- The output container for the A componentB
- The output container for the B componentob
- An image observer for img
public static java.awt.image.BufferedImage reconvertImageYUV(FloatImage Y, FloatImage U, FloatImage V)
Y
- The Y (intensity) componentU
- The U colour componentV
- The V colour component
public static java.awt.Image convertToImageYUV(FloatImage Y, FloatImage U, FloatImage V)
Y
- The Y (intensity) componentU
- The U colour componentV
- The V colour component
public static FloatImage combineUV(FloatImage U, FloatImage V)
U
- The U colour componentV
- The V colour component
public static FloatImage createColourHistogram(FloatImage R, FloatImage G, FloatImage B, FloatImage mask)
R
- The red component of the imageG
- The green component of the imageB
- The blue component of the imagemask
- The mask that selects which points to include
public static FloatImage createColourHistogram(FloatImage R, FloatImage G, FloatImage B)
R
- The red component of the imageG
- The green component of the imageB
- The blue component of the image
public void classify(FloatImage R, FloatImage G, FloatImage B, FloatImage probCol, FloatImage probColGivenSkin)
R
- The red component of the imageG
- The green component of the imageB
- The blue component of the imageprobCol
- the 2D histogram of (R/(R+G+B), G/(R+G+B)) colours for the whole imageprobColGivenSkin
- the 2D histogram of (R/(R+G+B), G/(R+G+B)) colours for the desired objectpublic float dotProduct(FloatImage fimg)
fimg
- The FloatImage to dot product with
public float dotProduct(FloatImage fimg, FloatImage mask)
mask
- The mask to use to select a sub-regionfimg
- The FloatImage to dot product with
public static java.awt.Image convertToImage(FloatImage R, FloatImage G, FloatImage B)
R
- The red componentG
- The green componentB
- The blue component
public static boolean convertImageRGB(java.awt.Image img, FloatImage R, FloatImage G, FloatImage B, java.awt.image.ImageObserver ob)
img
- The image to splitR
- The output container for the red componentG
- The output container for the green componentB
- The output container for the blue componentob
- An image observer for img
public static boolean convertImage(java.awt.Image img, FloatImage R, FloatImage G, FloatImage B, java.awt.image.ImageObserver ob)
img
- The image to splitR
- The output container for the red componentG
- The output container for the green componentB
- The output container for the blue componentob
- An image observer for img
public static void convertImage(java.awt.image.BufferedImage img, FloatImage red, FloatImage green, FloatImage blue)
img
- The input BufferedImagered
- The output red componentgreen
- The output green componentblue
- The output blue componentpublic static void convertInterleaveImageRGB(java.awt.image.BufferedImage img, FloatImage rgb)
img
- The input BufferedImagergb
- The output interleaved componentspublic static FloatImage interleaveImages(FloatImage red, FloatImage green, FloatImage blue)
red
- the input red part of the imagegreen
- the input green part of the imageblue
- the input blue part of the image
public static FloatImage[] deinterleaveImages(FloatImage rgb)
rgb
- the interleaved image
public static void deinterleaveImages(FloatImage rgb, FloatImage red, FloatImage green, FloatImage blue)
public static java.awt.image.BufferedImage reconvertImage(FloatImage red, FloatImage green, FloatImage blue)
red
- The input red componentgreen
- The input green componentblue
- The input blue component
public static java.awt.image.BufferedImage reconvertImage(FloatImage red, FloatImage green, FloatImage blue, FloatImage alpha)
red
- The input red componentgreen
- The input green componentblue
- The input blue componentalpha
- The input blue component
public static boolean convertImageHSV(java.awt.Image img, FloatImage H, FloatImage S, FloatImage V, java.awt.image.ImageObserver ob)
img
- The image to splitH
- The output container for the hue componentS
- The output container for the saturation componentV
- The output container for the intensity componentob
- An image observer for img
public void convertImage(java.awt.image.BufferedImage bimg)
bimg
- The image to convertpublic void convertImage(java.awt.Image img)
img
- The image to convertpublic void convertImage(int[] pixels, int w, int h)
pixels
- The pixels to convertw
- The width of the input imageh
- The height of the input imagepublic void convertSubImage(int[] pixels, int width, int height, int x, int y, int w, int h)
x
- the x-coord of the sub image rectangley
- the y-coord of the sub image rectanglew
- the width of the sub image rectangleh
- the height of the sub image rectanglepixels
- The pixels to convertwidth
- The width of the input imageheight
- The height of the input imagepublic int[] reconvertImage()
public int fillPolygon(java.awt.geom.Point2D.Float[] pts, float u, float v)
u
- The value to write to pixels outside this polygonpts
- The list of points forming the boundary of this polygonv
- The value to write to the pixels inside this polygon
public int fillPolygon(java.awt.geom.Point2D.Float[] pts, float[] vals)
vals
- The values at the vertices to interpolatepts
- The list of points forming the boundary of this polygon
public double[] vectorise(double[] vec)
vec
- the vector in which to place the vectorised image,
if it is the wrong size a new vector is created and returned
public static double[] vectorise(FloatImage[] colImg)
colImg
- the colour image as an array of 3 FLoatImage
public boolean vectorise(double[] vec, int offset)
vec
- The vectorised version of this imageoffset
- the place to start adding values to the vector
public float getMean()
public void subtract(float val)
val
- the value to subtractpublic FloatImage warp(FloatImage xshift, FloatImage yshift, int w, int h)
xshift
- the shifts in the x directionyshift
- the shifts in the y directionw
- the output widthh
- the output height
public FloatImage warpShift(FloatImage xshift, FloatImage yshift, int w, int h)
xshift
- the locations to sample from in xyshift
- the locations to sample from in yw
- the output widthh
- the output height
public int multiEdgeWarp(FloatImage dest, FloatImage xshift, FloatImage yshift)
dest
- the target image to warp toxshift
- the x component of the warpyshift
- the y component of the warp
public void multiEdgeWarp(FloatImage dest, MultiscaleWarp shift, int minwidth, int warpType)
dest
- target image to warp toshift
- stores the warp functionminwidth
- the minimum width to stop the recursion atwarpType
- type of twarp to use e.g. full, affine or rigidpublic void multiEdgeWarp(FloatImage dest, MultiscaleWarp shift, int minwidth, int level, boolean allscales, int warpType, java.lang.String output)
dest
- target image to warp toshift
- stores the warp functionminwidth
- the minimum width to stop the recursion atlevel
- amount of smoothing to applyallscales
- indicates that matching should be performed at all scales, not just lowestwarpType
- type of twarp to use e.g. full, affine or rigidoutput
- name of output debug image or nullpublic void edgeWarp(FloatImage dest, MultiscaleWarp shift, int level, int warpType, java.lang.String output)
dest
- target imageshift
- warplevel
- amount of smoothing to apply to the warpwarpType
- constant indicating type of warp to use e.g. affine or rigid only, or fulloutput
- name of file to write debugging output image to, or nullpublic void writeCurvImage(FloatImage[] srcCurv, java.lang.String outfile)
srcCurv
- the 2 curvature componenents, e.g. positive and negative curvatureoutfile
- the file to write to (as a jpeg)public int multiEdgeWarp(FloatImage dest, FloatImage[] pmapSrc, FloatImage[] pmapDst, MultiscaleWarp shift, int minwidth, int level)
dest
- the destination imagepmapSrc
- the point map of the source surfacepmapDst
- the point map of the destination imageshift
- the warp to hold the resultminwidth
- the smallest size to go in the multiscale pyramidlevel
- the current level
public int getMatchingPoints(FloatImage dest_edge, FloatImage[] sourceData, FloatImage[] destData, java.util.ArrayList<java.awt.geom.Point2D.Float> srcPts, java.util.ArrayList<java.awt.geom.Point2D.Float> dstPts)
dest_edge
- target edge point imagesourceData
- additional source datadestData
- additional dest datasrcPts
- source point array to add todstPts
- dest point array to add to
public static FloatImage[] calculateCurvature(FloatImage[] pmap, int scale)
pmap
- the 3D points in a 3 2D float imagesscale
- the number of levels to smooth to
public int threshold(FloatImage edges, float thresh)
edges
- Output image to hold the edge locations (edge = 255, not edge =0)thresh
- the threshold value
public static void quicksort(float[] data, int start, int end)
data
- the data to sortstart
- the start of the sub-array to sortend
- the end of the subarray to sortpublic static float findThreshold(float[] data, float percent)
data
- the data to thresholdpercent
- the fraction of point you want to keep
public int thresholdPercent(FloatImage edges, float thresh)
edges
- output image to keep the location of points > thresholdthresh
- the fraction of points to keep
public int icpEdgeWarp(FloatImage dest, MultiscaleWarp shift, int minwidth)
dest
- the target float imageshift
- holds the output warp functionminwidth
- the smallest image width to recurse down to
public int maxima(FloatImage xdir, FloatImage ydir, FloatImage edges, float thresh)
xdir
- x-directionydir
- y-directionedges
- holds the output edge locationsthresh
- edges whose size is below thresh are ignored
public java.util.ArrayList<KdTreePoint> maxima(FloatImage xdir, FloatImage ydir, FloatImage xxdir, FloatImage yydir, FloatImage xydir, float thresh)
xdir
- x-directionydir
- y-directionxxdir
- 2nd x derivativeyydir
- 2nd y derivativexydir
- 2nd x-y derivativethresh
- threshold on maxima points
public java.util.ArrayList<KdTreePoint> createTreePoints(FloatImage edges, FloatImage xdir, FloatImage ydir, FloatImage xxdir, FloatImage yydir, FloatImage xydir)
edges
- contains non-zero values at edge pointsxdir
- x-directionydir
- y-directionxxdir
- 2nd x derivativeyydir
- 2nd y derivativexydir
- 2nd x-y derivative
public void opticFlow(FloatImage target, MultiscaleWarp shift)
target
- the target image for the flowshift
- the warppublic void multiscaleOpticFlow(FloatImage target, MultiscaleWarp shift, int minwidth)
target
- target image to flow toshift
- the output warpminwidth
- the smallest width to recurse topublic int interpolate(FloatImage xshift, FloatImage yshift, float[] f1, float[] f2, int n1, int n2, int levels, float minJ, int rlevel)
xshift
- output x-shiftyshift
- output y-shiftf1
- downsampling filterf2
- upsampling filtern1
- length of f1 (port from C)n2
- length of f2 (port from C)levels
- number of levels to go tominJ
- not usedrlevel
- maximum level to interpolate to, above this just smoothed
public int divide(FloatImage f, FloatImage g)
f
- the first image to divideg
- the second image to divide
public int adjust(FloatImage xshift, FloatImage yshift, FloatImage xtmp, FloatImage ytmp)
xshift
- the x-shift imageyshift
- the y-shift imagextmp
- the (low pass) x-shiftytmp
- the (low-pass) y-shift
public int correlationFFT(FloatImage fimg1, FloatImage fimg2)
fimg1
- first imagefimg2
- second image
public boolean convolveFFT(FloatImage fimg1, FloatImage fimg2, boolean inverse)
fimg1
- the first input imagefimg2
- the second input imageinverse
- flag indicates that inverse onvolution (i.e. deconvolution) should be performed
public int MultiscaleBlendWaveletMRF_fast2(java.util.ArrayList<FloatImage> source, int count, int lev, Filter H, Filter G, Filter H2, Filter K1, Filter K2, Filter L1, Filter L2)
source
- array of images to blendcount
- number of images to blend (port from C)lev
- level number in pyramid, starting from 0H
- low-pass filterG
- high pass filterH2
- low pass reconstruction filterK1
- high pass reconstruction filterK2
- high pass reconstruction filterL1
- high pass reconstruction filterL2
- high pass reconstruction filter
public int MultiscaleTransformWaveletMRF_fast2(FloatImage original, java.util.ArrayList<FloatImage> source, java.util.ArrayList<FloatImage> target, int lev, Filter H, Filter G, Filter H2, Filter K1, Filter K2, Filter L1, Filter L2)
original
- the original imagesource
- the set of source group imagestarget
- the set of target group imageslev
- the number of levels to build the pyramidH
- the low pass filterG
- the high pass filterH2
- the reconstructing low pass filterK1
- the reconstructing high pass filterK2
- the reconstructing high pass filterL1
- the reconstructing high pass filterL2
- the reconstructing high pass filter
public int weightedTransformMRFHorizontal(FloatImage original, FloatImage this_small, FloatImage original_small, FloatImage magnitude, FloatImage[] source, java.util.ArrayList<FloatImage> source_small, int scount, FloatImage[] target, java.util.ArrayList<FloatImage> target_small, int tcount, double alpha)
original
- the original to transformthis_small
- small version of thisoriginal_small
- small version of originalmagnitude
- float image of wavelet magnitudesource
- array of source imagessource_small
- array of small versions of source imagesscount
- number of source imagestarget
- array of target imagestarget_small
- array of small target imagestcount
- number of target imagesalpha
- amount to scale the "standard" smoothing width by
public int weightedTransformMRFVertical(FloatImage original, FloatImage this_small, FloatImage original_small, FloatImage magnitude, FloatImage[] source, java.util.ArrayList<FloatImage> source_small, int scount, FloatImage[] target, java.util.ArrayList<FloatImage> target_small, int tcount, double alpha)
original
- the original to transformthis_small
- small version of thisoriginal_small
- small version of originalmagnitude
- float image of wavelet magnitudesource
- array of source imagessource_small
- array of small versions of source imagesscount
- number of source imagestarget
- array of target imagestarget_small
- array of small target imagestcount
- number of target imagesalpha
- amount to scale the "standard" smoothing width by
public double sum()
public double sampleAverage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |