Facemorph
Class FloatImage

java.lang.Object
  extended by Facemorph.FloatImage
All Implemented Interfaces:
Vectorisable

public class FloatImage
extends java.lang.Object
implements Vectorisable

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
 void abs()
          Set the image to the absolute value of the image samples
 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 clamp(float min, float max)
          Clamp the values in the Float map to the range specified by min and max.
 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.
 FloatImage close2D(float zstep)
          Perform greyscale close (dilate then erode) on this FloatImage, treats pixels like height and performs binary close
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(FloatImage red, FloatImage green, FloatImage blue, FloatImage L, FloatImage A, FloatImage B, java.awt.image.ImageObserver ob)
          Splits a colour image into 3 (LAB) component FloatImages
static boolean convertImageLAB(java.awt.Image img, FloatImage L, FloatImage A, FloatImage B, java.awt.image.ImageObserver ob)
          Splits a colour image into 3 ( ) 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(FloatImage R, FloatImage G, FloatImage B, FloatImage Y, FloatImage U, FloatImage V, java.awt.image.ImageObserver ob)
          Splits a set of colour FloatImages into 3 (YUV) component 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
static void convertYUVToRGB(FloatImage Y, FloatImage U, FloatImage V, FloatImage R, FloatImage G, FloatImage B)
          Create a colour image from three float images representing the Y, U and V components
 void convolve_angle(FloatImage fimg, float[] filter, int m, float theta)
          Filter the image in the direction specified by the angle (c.w.
 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)
           
 FloatImage dilate2D(float zstep)
          Perform greyscale dilation on this FloatImage, treats pixels like height and performs binary dilation i.e.
 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
 FloatImage edgeDistance()
          For each point in the image computes the distance to the nearest edge Assumes that the image given has been run through a edge detection filter
 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 erode2D(float zstep)
          Perform greyscale erosion on this FloatImage, treats pixels like height and performs binary erosion i.e.
 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
 void fillAll(float value)
           
 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_sym(int x, int y)
          Return the value of the float image at the specified coordinates.
 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 getMax()
          Gets the max of this images pixel values
 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
 float getMin()
          Gets the min of this images pixel values
 FloatImage getRect(int left, int top, int width, int height)
          Chops a rectangle from the image and returns it as a new float image
 FloatImage getSubImage(int x, int y, int w, int h)
          Gets a sub-part of this image
 FloatImage getSubImage(int x, int y, int w, int h, int scale)
          Cuts a rectangle from the image at a given scale.
 FloatImage getSubImageWrap(int x, int y, int w, int h, int scale)
          Cuts a rectangle from the image at a given scale.
 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
 FloatImage lbp()
          Construct an LBP image from this
 java.util.ArrayList<float[]> lbpHist(int xdiv, int ydiv)
          Construct LBP histograms from this lbp 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.
 FloatImage open2D(float zstep)
          Perform greyscale open (erode then dilate) on this FloatImage, treats pixels like height and performs binary open
 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 rms(FloatImage fimg)
          Calculates the root mean square error with fimg
 FloatImage rot180()
          Flip the image both horizontally and verticaly
 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 setData(float[] pixels, int newWidth, int newHeight)
          Replace the current image data with new data.
 void setRect(FloatImage patch, int left, int top)
          Insert a patch into the FloatImage at the specified location
 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.
 FloatImage sobelEdge(double thresh)
          Finds edges in the image with the sobel edge detector
 FloatImage sobelEdgeMag()
          Finds edges in the image with the sobel edge detector
 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
 FloatImage square()
          Fill in the image with the square of all the cells
 float sse(FloatImage fimg)
          Calculates the sum of squared errors with fimg
 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)
 java.util.ArrayList<float[]> uniformLbpHist(int xdiv, int ydiv)
          Construct Uniform LBP histograms from this lbp image
 void unvectorise(double[] vec)
          Fill the object with the contents of the variable, might require some guess-work about dimensions
 double[] vectorise()
          Convert the contents of this FloatImage to a single vector of doubles
 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.io.File fname)
          Write a binary format FloatImage to a file
 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

FloatImage

public FloatImage()
Constructs an empty FloatImage


FloatImage

public FloatImage(int w,
                  int h)
Constructs a FloatImage of the size specified

Parameters:
w - the width
h - the height

FloatImage

public FloatImage(int w,
                  int h,
                  float[] d)
Constructs a FloatImage of the size specified from a suitably sized array of floats

Parameters:
w - the width
h - the height
d - the array of floating point data

FloatImage

public FloatImage(int w,
                  int h,
                  double[] d)
Constructs a FloatImage of the size specified from a suitably sized array of floats

Parameters:
w - the width
h - the height
d - the array of floating point data
Method Detail

getData

public float[] getData()
Get the data vector for this image

Returns:
returns the data vector of length width by height

getWidth

public int getWidth()
Get the width of this image

Returns:
Return the width of this image

getHeight

public int getHeight()
Get the height of this image

Returns:
The height of this image

get_nocheck

public float get_nocheck(int x,
                         int y)
Gets without checking the bounds

Parameters:
x - coordinate
y - coordinate
Returns:
fimg(x,y)

get_sym

public float get_sym(int x,
                     int y)
Return the value of the float image at the specified coordinates. If the coordinates are beyond the boundaries of the image the coordinates are moved back into the image by reflection.

Parameters:
x - the x-coordinate to read from
y - the y-coordinate to read from
Returns:
the value at the specified location

get

public float get(int x,
                 int y)
Gets (x,y) and maps values outside the image onto the nearest internal point

Parameters:
x - coordinate
y - coordinate
Returns:
fimg(x,y)

get

public float get(int i)
Get the ith element of the data array

Parameters:
i - the element to get
Returns:
returns the ith element of the data array

getRect

public FloatImage getRect(int left,
                          int top,
                          int width,
                          int height)
Chops a rectangle from the image and returns it as a new float image

Parameters:
left - the left edge of the rectangle to chop, in pixels.
top - the top edge of the rectangle to chop, in pixels.
width - the width of the rectangle to chop, in pixeles.
height - the height of the rectangle to chop, in pixeles.
Returns:
a new FloatImage containing the chopped image.

set_nocheck

public void set_nocheck(int x,
                        int y,
                        float v)
Sets (x,y)=v without checking the bounds

Parameters:
x - coordinate
y - coordinate
v - value

set_nocheck

public void set_nocheck(int i,
                        float v)
Sets (x,y)=v without checking the bounds

Parameters:
i - index in data array
v - value

set

public int set(int x,
               int y,
               float v)
Sets (x,y)=v if (x,y) is within the image

Parameters:
x - coordinate
y - coordinate
v - value
Returns:
1 if set, 0 if not

setRect

public void setRect(FloatImage patch,
                    int left,
                    int top)
Insert a patch into the FloatImage at the specified location

Parameters:
patch - The patch to insert
left - the left edge of the location to insert the patch
top - the left edge of the location to insert the patch

setData

public void setData(float[] pixels,
                    int newWidth,
                    int newHeight)
Replace the current image data with new data.

Parameters:
pixels - new intensity values for the image
newWidth - the width of the new image
newHeight - the height of the new image

fillAll

public void fillAll(float value)

sample

public float sample(float x,
                    float y)
Samples (x,y) using bi-linear interpolation

Parameters:
x - coordinate
y - coordinate
Returns:
the sampled value

bytesToFloat

public static float bytesToFloat(byte[] bytes,
                                 int offset)
Convert a byte array into a float

Parameters:
bytes - The array of bytes containgin those to convert
offset - The index in the byte array to start
Returns:
The float value of the bytes

floatToBytes

public static void floatToBytes(float val,
                                byte[] bytes,
                                int offset)
Convert a float to a byte array

Parameters:
val - the value to convert into a byte array
bytes - The array of bytes containgin those to convert
offset - The index in the byte array to start

bytesToDouble

public static double bytesToDouble(byte[] bytes,
                                   int offset)
Convert a byte array into a double

Parameters:
bytes - The array of bytes containgin those to convert
offset - The index in the byte array to start
Returns:
The float value of the bytes

doubleToBytes

public static void doubleToBytes(double val,
                                 byte[] bytes,
                                 int offset)
Convert a double into a byte array

Parameters:
bytes - The array of bytes containgin those to convert
offset - The index in the byte array to start
val - The double value to write

bytesToLong

public static long bytesToLong(byte[] bytes,
                               int offset)
Converts some bytes into a long

Parameters:
bytes - The array of bytes containg those to convert
offset - The index to start at in the byte array
Returns:
The long represented by these bytes

bytesToInt

public static int bytesToInt(byte[] bytes,
                             int offset)
Converts some bytes into an int

Parameters:
bytes - The array of bytes containg those to convert
offset - The index to start at in the byte array
Returns:
The int represented by these bytes

intToBytes

public static void intToBytes(int val,
                              byte[] bytes,
                              int offset)
Converts an int to a byte array

Parameters:
val - The value to convert to a byte array
bytes - The array of bytes containg those to convert
offset - The index to start at in the byte array

longToBytes

public static void longToBytes(long val,
                               byte[] bytes,
                               int offset)
Converts a long into a byte array

Parameters:
val - The value to convert to a byte array
bytes - The array of bytes containg those to convert
offset - The index to start at in the byte array

main

public static void main(java.lang.String[] args)
Main method used for testing

Parameters:
args - The arguments to pass to main

read

public boolean read(java.lang.String fname)
Read a binary format FloatImage from a file

Parameters:
fname - The name of the file to read
Returns:
True if the file was read successfully

read

public void read(java.io.DataInputStream in)
          throws java.io.IOException
Read a binary format FloatImage from a file

Parameters:
in - A dataInputStream opened on the file to read
Throws:
java.io.IOException - thrown if there is an IO problem

write

public void write(java.io.DataOutputStream out)
           throws java.io.IOException
Write a binary format FloatImage to a DataOutputStream

Parameters:
out - The DataOutputSAtream to write to
Throws:
java.io.IOException - thrown if there is an IO problem

write

public boolean write(java.lang.String fname)
Write a binary format FloatImage to a file

Parameters:
fname - The name of the file to read
Returns:
True if the file was read successfully

write

public boolean write(java.io.File fname)
Write a binary format FloatImage to a file

Parameters:
fname - The file to read
Returns:
True if the file was read successfully

reduce

public 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

Parameters:
fimg - The image to shrink
filter - Filter to apply before shrinking
m - the midpoint of the filter

reduce

public 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

Parameters:
fimg - The image to shrink
filter - Filter to apply before shrinking
m - the midpoint of the filter

reduce

public 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

Parameters:
fimg - The image to shrink
mask - Masking image
filter - Filter to apply before shrinking
m - the midpoint of the filter
Returns:
returns a small version of the mask

reduce

public 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

Parameters:
img - The Image to shrink
filter - Filter to apply before shrinking
m - the midpoint of the filter
Returns:
the reduced Image

expand

public 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

Parameters:
fimg - the destination FloatImage
filter - the upsampling filter coefficeints
m - the filter midpoint

expand

public 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

Parameters:
fimg - the destination FloatImage
filter - the upsampling filter coefficeints
m - the filter midpoint
outW - the output width
outH - the output height

convolve

public void convolve(FloatImage fimg,
                     float[][] filter,
                     int m,
                     int n,
                     int scale)
Non-separable convolution

Parameters:
fimg - the output image, should have same width and height as this
filter - the filter to use
m - the mid-point in x
n - the mid-point in y
scale - the scale factor

convolve

public void convolve(FloatImage fimg,
                     FloatImage filter,
                     int m,
                     int n,
                     int scale)
Convolve this float image with a filter defined by an image

Parameters:
fimg - out image
filter - the filter to convolve with
m - the horizonal midpoint of the filter
n - the vertical midpoint of the filter
scale - the scale factor of the convolution

sqrDifference

public 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

Parameters:
fimg - out image
filter - the filter to convolve with
m - the horizonal midpoint of the filter
n - the vertical midpoint of the filter
scale - the scale factor of the convolution

convolve

public void convolve(float[] filter,
                     int m,
                     int scale)
Filter the image in the x and y directions (separably) with the filter specified

Parameters:
filter - The array of values representing the filter
m - The index ofthe mid point of the filter
scale - The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)

convolve_x

public void convolve_x(FloatImage fimg,
                       float[] filter,
                       int m,
                       int scale)
Filter this FloatImage in the x direction

Parameters:
fimg - Stores the output FloatImage
filter - The filter to apply
m - The mid point of the filter
scale - The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)

convolve_y

public void convolve_y(FloatImage fimg,
                       float[] filter,
                       int m,
                       int scale)
Filter this FloatImage in the y direction

Parameters:
fimg - Stores the output FloatImage
filter - The filter to apply
m - The mid point of the filter
scale - The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)

convolve

public 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

Parameters:
mask - the mask image to use
filter - The array of values representing the filter
m - The index ofthe mid point of the filter
scale - The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)

convolve_angle

public void convolve_angle(FloatImage fimg,
                           float[] filter,
                           int m,
                           float theta)
Filter the image in the direction specified by the angle (c.w. from the vertical) and store in fimg.

Parameters:
fimg - Image to store the result in
filter - the filter to convolve the image with
m - the mid point of the filter
theta - the angle to convolve at.

convolve_x

public void convolve_x(FloatImage fimg,
                       FloatImage mask,
                       float[] filter,
                       int m,
                       int scale)
Filter this FloatImage in the x direction with masking

Parameters:
fimg - Stores the output FloatImage
mask - the mask image to use
filter - The filter to apply
m - The mid point of the filter
scale - The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)

convolve_y

public void convolve_y(FloatImage fimg,
                       FloatImage mask,
                       float[] filter,
                       int m,
                       int scale)
Filter this FloatImage in the y direction with masking

Parameters:
fimg - Stores the output FloatImage
mask - mask image to use
filter - The filter to apply
m - The mid point of the filter
scale - The amount to dilate the filter (e.g. by placing zeros betwen the coefficients)

erodeMask

public FloatImage erodeMask()
Perform binary erosion on this FloatImage, any pixels adjacent to zero values are set to zero

Returns:
the eroded version of this image

erode2D

public FloatImage erode2D(float zstep)
Perform greyscale erosion on this FloatImage, treats pixels like height and performs binary erosion i.e. pixels are set to minimum of itself-1 and neigbours

Returns:
the eroded version of this image

dilate2D

public FloatImage dilate2D(float zstep)
Perform greyscale dilation on this FloatImage, treats pixels like height and performs binary dilation i.e. pixels are set to maximum of itself+1 and neigbours

Returns:
the dilated version of this image

open2D

public FloatImage open2D(float zstep)
Perform greyscale open (erode then dilate) on this FloatImage, treats pixels like height and performs binary open

Returns:
the opened version of this image

close2D

public FloatImage close2D(float zstep)
Perform greyscale close (dilate then erode) on this FloatImage, treats pixels like height and performs binary close

Returns:
the closed version of this image

add

public boolean add(FloatImage fimg,
                   float w)
Adds a scaled amount of fimg to this to give this = this + w*fimg

Parameters:
fimg - The FloatImage to add
w - The weight
Returns:
true if added successfully

germanMcClure

public float germanMcClure(FloatImage fimg,
                           float d)
Calculates the German-McClure error function between this and fimg using weighting d

Parameters:
fimg - The FloatImage to compare to
d - The weight
Returns:
error if compared successfully

germanMcClure

public static float germanMcClure(FloatImage[] fimg,
                                  FloatImage[] av,
                                  float d)
Calculates the German-McClure error function between this and fimg using weighting d

Parameters:
fimg - The FloatImage to compare to
av - the (average) image that the error is being measured from
d - The weight
Returns:
error if compared successfully

sumError

public static float sumError(FloatImage[] fimg,
                             FloatImage[] av)
Calculates the sum error function between this and fimg using weighting d

Parameters:
fimg - The FloatImage to compare to
av - the (average) image that the error is being measured from
Returns:
error if compared successfully

sumErrorSquared

public static float sumErrorSquared(FloatImage[] fimg,
                                    FloatImage[] av)
Calculates the sum squared error function between this and fimg using weighting d

Parameters:
fimg - The FloatImage to compare to
av - the (average) image that the error is being measured from
Returns:
error if compared successfully

add

public boolean add(FloatImage fimg)
Adds fimg to this to give this = this + fimg

Parameters:
fimg - The FloatImage to add
Returns:
true if added successfully

add

public void add(FloatImage fimg1,
                FloatImage fimg2)
Adds two FloatImages, putting the result in this

Parameters:
fimg1 - the first image to add
fimg2 - the second image to add

multiply

public boolean multiply(FloatImage fimg)
Mulitplies this image by fimg to give this = this * fimg

Parameters:
fimg - The FloatImage to add
Returns:
true if added successfully

divide

public boolean divide(FloatImage fimg,
                      float tol)
Divides this image by fimg to give this = this / fimg

Parameters:
fimg - The FloatImage to add
tol - values in fimg below tol are not divided
Returns:
true if added successfully

magnitude

public void magnitude()
Replaces each pixel with its absolute value


magnitudeSquared

public void magnitudeSquared()
Replaces each pixel with itself squared


edgeMagnitude

public void edgeMagnitude(FloatImage dx,
                          FloatImage dy)
Calculates the magnitude of edges

Parameters:
dx - the x-derivative image
dy - the y-derivative image

dual_convolve_x

public 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

Parameters:
fimg - the output image
filter1 - the even pixel filter
filter2 - the odd pixel fitler
m1 - the even filter midpoint
m2 - the odd fitler midpoint
bm - the border model

dual_convolve_y

public 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

Parameters:
fimg - the output image
filter1 - the even pixel filter
filter2 - the odd pixel fitler
m1 - the even filter midpoint
m2 - the odd fitler midpoint
bm - the border model

setSize

public void setSize(int w,
                    int h)
Sets the dimension of the image and reallocates the memory (i.e. zeros all pixels)

Parameters:
w - width
h - height

resize

public FloatImage resize(int w,
                         int h)
Resize this image using bilinear resampling to the specified dimensions

Parameters:
w - the desired width
h - the desired height
Returns:
returns the resized version of this

getSubImage

public FloatImage getSubImage(int x,
                              int y,
                              int w,
                              int h)
Gets a sub-part of this image

Parameters:
x - The x-coord
y - the y-coord
w - the output width
h - the output height
Returns:
the sub image from (x, y) of size w by h

getSubImage

public FloatImage getSubImage(int x,
                              int y,
                              int w,
                              int h,
                              int scale)
Cuts a rectangle from the image at a given scale. If the rectangle goes off the edge of the image the undefined areas of the patch are fixed to zero.

Parameters:
x - The x-coord
y - the y-coord
w - the output width
h - the output height
scale - the scale or multiplication factor to grab the rectangle at.
Returns:
the sub image from (x, y) of size w by h. The sampled area is w*scale by h*scale

getSubImageWrap

public FloatImage getSubImageWrap(int x,
                                  int y,
                                  int w,
                                  int h,
                                  int scale)
Cuts a rectangle from the image at a given scale. Theis version wraps the images

Parameters:
x - The x-coord
y - the y-coord
w - the output width
h - the output height
scale - the scale or multiplication factor to grab the rectangle at.
Returns:
the sub image from (x, y) of size w by h. The sampled area is w*scale by h*scale

mask

public boolean mask(FloatImage maskImg)
Masks this FloatImage

Parameters:
maskImg - Zeros pixels defined by the mask image
Returns:
returns true if the images aer the same size and the mask has been successfully applied

mask

public boolean mask(FloatImage maskImg,
                    float outside)
Masks this FloatImage

Parameters:
maskImg - Zeros pixels defined by the mask image
outside - the constant value to put outside the masked area
Returns:
returns true if the images aer the same size and the mask has been successfully applied

copy

public FloatImage copy()
Creates and returns a copy of this image

Returns:
A copy of this image

copy

public void copy(FloatImage fimg)
Copy fimg into this

Parameters:
fimg - the image to copy

add

public boolean add(float w)
Adds a constant to each pixel

Parameters:
w - The constant to add
Returns:
return true if all goes OK

addToAverage

public int addToAverage(FloatImage fimg,
                        int n)
Adds an image into this average image

Parameters:
fimg - The image to add to this
n - The number of images in the average already
Returns:
Return true if the image was added successfully

adaptAverage

public boolean adaptAverage(FloatImage varSquared)
Adapts the average to have the same locally smoothed magnitude as varSquared

Parameters:
varSquared - the variance squared image
Returns:
true if successful

addToVariance

public boolean addToVariance(FloatImage fimg1,
                             int n)
Adds fimg1 to the average of absolute values

Parameters:
fimg1 - the image to add
n - the number of images added previously
Returns:
true if added successfully, false otherwise

addToVarianceSquared

public boolean addToVarianceSquared(FloatImage fimg1,
                                    int n)
Add fimg1 to the average of squared images

Parameters:
fimg1 - the image to add
n - the number of images previously added to the average
Returns:
true if added successfully

addToVariance

public boolean addToVariance(FloatImage fimg1,
                             FloatImage fimg2,
                             int n)
Adds fimg1 and fimg2 to this complex magnitude average as the real and imaginary parts

Parameters:
fimg1 - the real part to add
fimg2 - the imaginary part to add
n - the number of images previously added to this
Returns:
true if add successfully, false otherwise

transform

public FloatImage transform(float[][] mat,
                            int w,
                            int h)
Perform an affine transform on the image geometry

Parameters:
mat - the transform parameters in a 2 by 3 matrix
w - the output width
h - the output height
Returns:
return the transformed image

transform

public int transform(FloatImage src,
                     FloatImage dst,
                     float scale)
Transforms the image by adding (dst-src)*scale

Parameters:
src - The source image
dst - The destingation image
scale - The amount of transform (0 - no transform, 1 = 100% transform)
Returns:
Return true if the image was transformed successfully (i.e. all images must be same size).

transformMagnitude

public boolean transformMagnitude(FloatImage var1,
                                  FloatImage var2,
                                  float shift)
Transforms this by multiplying by var2(x,y)/var1(x,y)^shift

Parameters:
var1 - the variance of this
var2 - the desired variance
shift - the amount to transform by
Returns:
true if transformed successfully

transformMagSquared

public boolean transformMagSquared(FloatImage var1,
                                   FloatImage var2,
                                   float shift)
Transforms this by multiplying by var2(x,y)/var1(x,y)^(shift*0.5)

Parameters:
var1 - the mag squared of this
var2 - the desired mag squared
shift - the amount to transform by
Returns:
true if transformed successfully

shift

public FloatImage shift(float w,
                        float t)
Creates a scaled and shift version of this image i.e. out = this*t + w

Parameters:
w - The ammount to add to each pixel after scaling
t - The amount to scale this image by
Returns:
The scaled and shifted image

scale

public void scale(float w)
Adds a scaled amount of fimg to this i.e. this = this + w*fimg

Parameters:
w - The weight

scale

public void scale(FloatImage fimg)
Scale each pixel in this image by the value of the corresponding pixel in the other image

Parameters:
fimg - image with scaling values.

invScale

public void invScale(FloatImage fimg)
Scale each pixel in this image by the inverse of the value of the corresponding pixel in the other image

Parameters:
fimg - image with scaling values.

abs

public void abs()
Set the image to the absolute value of the image samples


normalise

public void normalise(FloatImage fimg)
Adjusts this image to have the same mean and s.d. as fimg

Parameters:
fimg - The image whose mean and s.d. to copy

normalise

public void normalise(FloatImage fimg,
                      FloatImage mask)
Adjusts this image to have the same mean and s.d. as fimg

Parameters:
fimg - The image whose mean and s.d. to copy
mask - the selection function to use

normalise

public void normalise(float mean,
                      float sd)
Adjusts this image to have the specified mean and s.d.

Parameters:
mean - the desired mean
sd - the desired sd

normalise

public void normalise(float mean,
                      float sd,
                      FloatImage mask)
Adjusts this image to have the specified mean and s.d.

Parameters:
mean - the desired mean
sd - the desired sd
mask - selection function (usually 0 or 1)

getMeanAndSD

public float[] getMeanAndSD()
Get the mean and standard deviation of this image

Returns:
The {mean, s.f.} pair as an array

getMeanAndSD

public float[] getMeanAndSD(int x,
                            int y,
                            int w,
                            int h)
Get the mean and standard deviation of a patch of this image

Parameters:
x - the smallest x coord of the patch
y - the smallest y coord of the patch
w - the width of the patch
h - the height of the patch
Returns:
The {mean, s.f.} pair as an array

getMeanAndSD

public float[] getMeanAndSD(FloatImage mask)
Get the mean and standard deviation of this image

Parameters:
mask - the mask that selects pixels (usually values are 0 or 1)
Returns:
The {mean, s.d.} pair as an array

ncc

public float ncc(FloatImage fimg)
Calculates the normalised cross correlation (NCC) with fimg

Parameters:
fimg - the image to find the NCC with
Returns:
returns the NCC with fimg

rms

public float rms(FloatImage fimg)
Calculates the root mean square error with fimg

Parameters:
fimg - the image to find the NCC with
Returns:
returns the NCC with fimg

sse

public float sse(FloatImage fimg)
Calculates the sum of squared errors with fimg

Parameters:
fimg - the image to find the NCC with
Returns:
returns the NCC with fimg

nccPatches

public float nccPatches(FloatImage fimg)
Calculates the normalised cross correlation (NCC) with fimg

Parameters:
fimg - the image to find the NCC with
Returns:
returns the NCC with fimg

nccPatchArray

public float[] nccPatchArray(FloatImage fimg)
Calculates the normalised cross correlation (NCC) with fimg

Parameters:
fimg - the image to find the NCC with
Returns:
returns the NCC with fimg

nccPatch

public float nccPatch(FloatImage fimg,
                      int x,
                      int y)
Calculates the normalised cross correlation (NCC) with fimg

Parameters:
fimg - the image to find the NCC with
x - the x coordinate of the location to calculate the ncc at
y - the y coordinate of the location to calculate the ncc at
Returns:
returns the NCC with fimg

ncc

public float ncc(FloatImage fimg,
                 FloatImage mask)
Calculates the normalised cross correlation (NCC) with fimg using only the masked regions

Parameters:
fimg - the image to calulate the NCC with
mask - the mask specifying which image regions to use
Returns:
returns the NCC with fimg in the masked regions

subtract

public boolean subtract(FloatImage fimg)
Subtracts fimg from this i.e. this = this - fimg

Parameters:
fimg - The FloatImage to subtract
Returns:
true if subtracted successfully

sqrt

public void sqrt()
Fill in the square root of this FloatImage


square

public FloatImage square()
Fill in the image with the square of all the cells


subtractIgnoreZeros

public static int subtractIgnoreZeros(FloatImage[] current,
                                      FloatImage[] fimg)
Subtracts fimg from current i.e. current = current - fimg, except where either current or fimg are black

Parameters:
current - the image to subtract fimg from
fimg - The FloatImage to subtract
Returns:
true if subtracted successfully

convertImageYUV

public static boolean convertImageYUV(FloatImage R,
                                      FloatImage G,
                                      FloatImage B,
                                      FloatImage Y,
                                      FloatImage U,
                                      FloatImage V,
                                      java.awt.image.ImageObserver ob)
Splits a set of colour FloatImages into 3 (YUV) component FloatImages

Parameters:
R - The input container for the R component
G - The input container for the G component
B - The input container for the B component
U - The output container for the U component
V - The output container for the V component
Y - The output container for the intensity component
ob - An image observer for img
Returns:
true if successfully converted

convertImageYUV

public 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

Parameters:
img - The image to split
U - The output container for the U component
V - The output container for the V component
Y - The output container for the intensity component
ob - An image observer for img
Returns:
true if successfully converted

convertImageLAB

public static boolean convertImageLAB(java.awt.Image img,
                                      FloatImage L,
                                      FloatImage A,
                                      FloatImage B,
                                      java.awt.image.ImageObserver ob)
Splits a colour image into 3 ( ) component FloatImages

Parameters:
img - The image to split
L - The output container for the intensity component
A - The output container for the A component
B - The output container for the B component
ob - An image observer for img
Returns:
true if successfully converted

convertImageLAB

public static boolean convertImageLAB(FloatImage red,
                                      FloatImage green,
                                      FloatImage blue,
                                      FloatImage L,
                                      FloatImage A,
                                      FloatImage B,
                                      java.awt.image.ImageObserver ob)
Splits a colour image into 3 (LAB) component FloatImages

Parameters:
img - The image to split
L - The output container for the intensity component
A - The output container for the A component
B - The output container for the B component
ob - An image observer for img
Returns:
true if successfully converted

reconvertImageYUV

public 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

Parameters:
Y - The Y (intensity) component
U - The U colour component
V - The V colour component
Returns:
The reconstructed image

convertYUVToRGB

public static void convertYUVToRGB(FloatImage Y,
                                   FloatImage U,
                                   FloatImage V,
                                   FloatImage R,
                                   FloatImage G,
                                   FloatImage B)
Create a colour image from three float images representing the Y, U and V components

Parameters:
Y - The Y (intensity) component
U - The U colour component
V - The V colour component

convertToImageYUV

public 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

Parameters:
Y - The Y (intensity) component
U - The U colour component
V - The V colour component
Returns:
The reconstructed image

combineUV

public 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)

Parameters:
U - The U colour component
V - The V colour component
Returns:
The image that combines U and V

createColourHistogram

public 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.

Parameters:
R - The red component of the image
G - The green component of the image
B - The blue component of the image
mask - The mask that selects which points to include
Returns:
The 2D colour histogram as a FloatImage (to allow easier smoothing etc).

createColourHistogram

public 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.

Parameters:
R - The red component of the image
G - The green component of the image
B - The blue component of the image
Returns:
The 2D colour histogram as a FloatImage (to allow easier smoothing etc).

classify

public 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.

Parameters:
R - The red component of the image
G - The green component of the image
B - The blue component of the image
probCol - the 2D histogram of (R/(R+G+B), G/(R+G+B)) colours for the whole image
probColGivenSkin - the 2D histogram of (R/(R+G+B), G/(R+G+B)) colours for the desired object

dotProduct

public float dotProduct(FloatImage fimg)
Finds the dot product (aka scalar product or sum of pixel products) of this image with fimg

Parameters:
fimg - The FloatImage to dot product with
Returns:
Returns the calculated dot propduct

dotProduct

public 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

Parameters:
mask - The mask to use to select a sub-region
fimg - The FloatImage to dot product with
Returns:
Returns the calculated dot propduct

convertToImage

public 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

Parameters:
R - The red component
G - The green component
B - The blue component
Returns:
The reconstructed image

convertImageRGB

public 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

Parameters:
img - The image to split
R - The output container for the red component
G - The output container for the green component
B - The output container for the blue component
ob - An image observer for img
Returns:
true if successfully converted

convertImage

public 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

Parameters:
img - The image to split
R - The output container for the red component
G - The output container for the green component
B - The output container for the blue component
ob - An image observer for img
Returns:
true if successfully converted

convertImage

public 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

Parameters:
img - The input BufferedImage
red - The output red component
green - The output green component
blue - The output blue component

convertInterleaveImageRGB

public static void convertInterleaveImageRGB(java.awt.image.BufferedImage img,
                                             FloatImage rgb)
Converts a BufferedImage into one interleaved FloatImages in Red, Green, Blue order

Parameters:
img - The input BufferedImage
rgb - The output interleaved components

interleaveImages

public static FloatImage interleaveImages(FloatImage red,
                                          FloatImage green,
                                          FloatImage blue)
Turn separate three red green and blue images into one image by interleaving the pixels

Parameters:
red - the input red part of the image
green - the input green part of the image
blue - the input blue part of the image
Returns:
the interleaved image.

deinterleaveImages

public static FloatImage[] deinterleaveImages(FloatImage rgb)
Take an interleaved image, eg. one produced by interleaveImages and produce the separate rgb images.

Parameters:
rgb - the interleaved image
Returns:
a set of interleaved images

deinterleaveImages

public static void deinterleaveImages(FloatImage rgb,
                                      FloatImage red,
                                      FloatImage green,
                                      FloatImage blue)

reconvertImage

public static java.awt.image.BufferedImage reconvertImage(FloatImage red,
                                                          FloatImage green,
                                                          FloatImage blue)
Converts the red, green and blue colour components into a BufferedImage

Parameters:
red - The input red component
green - The input green component
blue - The input blue component
Returns:
A BufferedImage created from the red, green and blue FloatImages

reconvertImage

public 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

Parameters:
red - The input red component
green - The input green component
blue - The input blue component
alpha - The input blue component
Returns:
A BufferedImage created from the red, green, blue and alpha FloatImages

convertImageHSV

public 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 ...

Parameters:
img - The image to split
H - The output container for the hue component
S - The output container for the saturation component
V - The output container for the intensity component
ob - An image observer for img
Returns:
true if successfully converted

convertImage

public 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

Parameters:
bimg - The image to convert

convertImage

public 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

Parameters:
img - The image to convert

convertImage

public void convertImage(int[] pixels,
                         int w,
                         int h)
Convert the int array (each int is an RGB colour) into an intensity image

Parameters:
pixels - The pixels to convert
w - The width of the input image
h - The height of the input image

convertSubImage

public 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

Parameters:
x - the x-coord of the sub image rectangle
y - the y-coord of the sub image rectangle
w - the width of the sub image rectangle
h - the height of the sub image rectangle
pixels - The pixels to convert
width - The width of the input image
height - The height of the input image

reconvertImage

public int[] reconvertImage()
Creates an int array of colour values from this FloatImage

Returns:
An array of int values, each one represents an RGB triple

fillPolygon

public int fillPolygon(java.awt.geom.Point2D.Float[] pts,
                       float u,
                       float v)
Draws a filled polygon on this image with the value v

Parameters:
u - The value to write to pixels outside this polygon
pts - The list of points forming the boundary of this polygon
v - The value to write to the pixels inside this polygon
Returns:
1 if all is OK

fillPolygon

public int fillPolygon(java.awt.geom.Point2D.Float[] pts,
                       float[] vals)
Draws a filled polygon on this image with the value v

Parameters:
vals - The values at the vertices to interpolate
pts - The list of points forming the boundary of this polygon
Returns:
1 if all is OK

vectorise

public double[] vectorise(double[] vec)
Converts a FloatImage to a double array

Parameters:
vec - the vector in which to place the vectorised image, if it is the wrong size a new vector is created and returned
Returns:
Returns the vectorised image

vectorise

public static double[] vectorise(FloatImage[] colImg)
Vectorises a colour image stored as 3 FloatImages. the vector is in plane order i.e. {r0,r1,r2, ..., rn, g0, g1, ..., gn, b0, b1, ..., bn

Parameters:
colImg - the colour image as an array of 3 FLoatImage
Returns:
a 1D array representing the colour image

vectorise

public boolean vectorise(double[] vec,
                         int offset)
Converts a FloatImage to a double array

Parameters:
vec - The vectorised version of this image
offset - the place to start adding values to the vector
Returns:
true if values are added to the vector OK, false if it failed e.g. if the array is too small

vectorise

public double[] vectorise()
Convert the contents of this FloatImage to a single vector of doubles

Specified by:
vectorise in interface Vectorisable
Returns:

unvectorise

public void unvectorise(double[] vec)
Fill the object with the contents of the variable, might require some guess-work about dimensions

Specified by:
unvectorise in interface Vectorisable
Parameters:
vec - vector of doubles to fill the object with.

getMean

public float getMean()
Gets the mean of this images pixel values

Returns:
Returns the mean value

getMax

public float getMax()
Gets the max of this images pixel values

Returns:
Returns the max value

getMin

public float getMin()
Gets the min of this images pixel values

Returns:
Returns the min value

subtract

public void subtract(float val)
Subtract val from each pixel

Parameters:
val - the value to subtract

warp

public 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

Parameters:
xshift - the shifts in the x direction
yshift - the shifts in the y direction
w - the output width
h - the output height
Returns:
returns the warped image

warpShift

public 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

Parameters:
xshift - the locations to sample from in x
yshift - the locations to sample from in y
w - the output width
h - the output height
Returns:
returns the warped image

multiEdgeWarp

public int multiEdgeWarp(FloatImage dest,
                         FloatImage xshift,
                         FloatImage yshift)
Edge based warping method

Parameters:
dest - the target image to warp to
xshift - the x component of the warp
yshift - the y component of the warp
Returns:
return 1, for some reason

multiEdgeWarp

public void multiEdgeWarp(FloatImage dest,
                          MultiscaleWarp shift,
                          int minwidth,
                          int warpType)
Recursive edge matching & warping

Parameters:
dest - target image to warp to
shift - stores the warp function
minwidth - the minimum width to stop the recursion at
warpType - type of twarp to use e.g. full, affine or rigid

multiEdgeWarp

public void multiEdgeWarp(FloatImage dest,
                          MultiscaleWarp shift,
                          int minwidth,
                          int level,
                          boolean allscales,
                          int warpType,
                          java.lang.String output)
Recursive edge matching & warping

Parameters:
dest - target image to warp to
shift - stores the warp function
minwidth - the minimum width to stop the recursion at
level - amount of smoothing to apply
allscales - indicates that matching should be performed at all scales, not just lowest
warpType - type of twarp to use e.g. full, affine or rigid
output - name of output debug image or null

edgeWarp

public void edgeWarp(FloatImage dest,
                     MultiscaleWarp shift,
                     int level,
                     int warpType,
                     java.lang.String output)
Non-recursive edge matching

Parameters:
dest - target image
shift - warp
level - amount of smoothing to apply to the warp
warpType - constant indicating type of warp to use e.g. affine or rigid only, or full
output - name of file to write debugging output image to, or null

writeCurvImage

public void writeCurvImage(FloatImage[] srcCurv,
                           java.lang.String outfile)
Writes a curvature image to file

Parameters:
srcCurv - the 2 curvature componenents, e.g. positive and negative curvature
outfile - the file to write to (as a jpeg)

multiEdgeWarp

public int multiEdgeWarp(FloatImage dest,
                         FloatImage[] pmapSrc,
                         FloatImage[] pmapDst,
                         MultiscaleWarp shift,
                         int minwidth,
                         int level)
Multiscale edge based warping with curvature

Parameters:
dest - the destination image
pmapSrc - the point map of the source surface
pmapDst - the point map of the destination image
shift - the warp to hold the result
minwidth - the smallest size to go in the multiscale pyramid
level - the current level
Returns:
returns 1 for some reason

getMatchingPoints

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)
Gets two-way matching points

Parameters:
dest_edge - target edge point image
sourceData - additional source data
destData - additional dest data
srcPts - source point array to add to
dstPts - dest point array to add to
Returns:
returns the number of edges matched

calculateCurvature

public static FloatImage[] calculateCurvature(FloatImage[] pmap,
                                              int scale)
Calculates the curvature after scaling by the amount indicated

Parameters:
pmap - the 3D points in a 3 2D float images
scale - the number of levels to smooth to
Returns:
returns the curvature in the form of an array: {kmxMax, dx[0], dx[1], dx[2], kmnMax, dy[0], dy[1], dy[2]} kmxMax and kmnMax are the points of maximum +ve and -ve curvature dx[0], dy[0] hold the +ve and -ve curvature values (dx[1], dx[2]) and (dy[1], dy[2]) give the directions of principal curvature

threshold

public int threshold(FloatImage edges,
                     float thresh)
Find the points bigger than the threshold

Parameters:
edges - Output image to hold the edge locations (edge = 255, not edge =0)
thresh - the threshold value
Returns:
returns 1 for some reason

quicksort

public static void quicksort(float[] data,
                             int start,
                             int end)
Quicksort implementation

Parameters:
data - the data to sort
start - the start of the sub-array to sort
end - the end of the subarray to sort

findThreshold

public static float findThreshold(float[] data,
                                  float percent)
Attempts to find a suitable threshold on data to keep percentage points

Parameters:
data - the data to threshold
percent - the fraction of point you want to keep
Returns:
returns the threshold to use

thresholdPercent

public int thresholdPercent(FloatImage edges,
                            float thresh)
Thresholds the image at a certain percentage of points are kept

Parameters:
edges - output image to keep the location of points > threshold
thresh - the fraction of points to keep
Returns:
returns 1

icpEdgeWarp

public int icpEdgeWarp(FloatImage dest,
                       MultiscaleWarp shift,
                       int minwidth)
Iterative closest point warp

Parameters:
dest - the target float image
shift - holds the output warp function
minwidth - the smallest image width to recurse down to
Returns:
returns 1

maxima

public int maxima(FloatImage xdir,
                  FloatImage ydir,
                  FloatImage edges,
                  float thresh)
Find the maxima in the directions given

Parameters:
xdir - x-direction
ydir - y-direction
edges - holds the output edge locations
thresh - edges whose size is below thresh are ignored
Returns:
returns 1

maxima

public 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

Parameters:
xdir - x-direction
ydir - y-direction
xxdir - 2nd x derivative
yydir - 2nd y derivative
xydir - 2nd x-y derivative
thresh - threshold on maxima points
Returns:
retuns an array of kd tree points

createTreePoints

public 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

Parameters:
edges - contains non-zero values at edge points
xdir - x-direction
ydir - y-direction
xxdir - 2nd x derivative
yydir - 2nd y derivative
xydir - 2nd x-y derivative
Returns:
retuns an array of kd tree points

opticFlow

public void opticFlow(FloatImage target,
                      MultiscaleWarp shift)
Basic optical flow implementation

Parameters:
target - the target image for the flow
shift - the warp

multiscaleOpticFlow

public void multiscaleOpticFlow(FloatImage target,
                                MultiscaleWarp shift,
                                int minwidth)
Multi scale optical flow method

Parameters:
target - target image to flow to
shift - the output warp
minwidth - the smallest width to recurse to

interpolate

public 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

Parameters:
xshift - output x-shift
yshift - output y-shift
f1 - downsampling filter
f2 - upsampling filter
n1 - length of f1 (port from C)
n2 - length of f2 (port from C)
levels - number of levels to go to
minJ - not used
rlevel - maximum level to interpolate to, above this just smoothed
Returns:
returns 1

divide

public int divide(FloatImage f,
                  FloatImage g)
Pixelwise divide f and g by this and set this to 1 (where this is not zero)

Parameters:
f - the first image to divide
g - the second image to divide
Returns:
returns 1 if all images are the same size, or zero otherwise

adjust

public 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

Parameters:
xshift - the x-shift image
yshift - the y-shift image
xtmp - the (low pass) x-shift
ytmp - the (low-pass) y-shift
Returns:
return 0

correlationFFT

public int correlationFFT(FloatImage fimg1,
                          FloatImage fimg2)
Correlation using FFT, the result is held in this

Parameters:
fimg1 - first image
fimg2 - second image
Returns:
returns 0 if different sizes, else 1

convolveFFT

public boolean convolveFFT(FloatImage fimg1,
                           FloatImage fimg2,
                           boolean inverse)
FFT based convolution, the result is put in this

Parameters:
fimg1 - the first input image
fimg2 - the second input image
inverse - flag indicates that inverse onvolution (i.e. deconvolution) should be performed
Returns:
returns true if successful (images same size), false otherwise

MultiscaleBlendWaveletMRF_fast2

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)
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

Parameters:
source - array of images to blend
count - number of images to blend (port from C)
lev - level number in pyramid, starting from 0
H - low-pass filter
G - high pass filter
H2 - low pass reconstruction filter
K1 - high pass reconstruction filter
K2 - high pass reconstruction filter
L1 - high pass reconstruction filter
L2 - high pass reconstruction filter
Returns:
returns 1 if successful, 0 otherwise

MultiscaleTransformWaveletMRF_fast2

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)
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

Parameters:
original - the original image
source - the set of source group images
target - the set of target group images
lev - the number of levels to build the pyramid
H - the low pass filter
G - the high pass filter
H2 - the reconstructing low pass filter
K1 - the reconstructing high pass filter
K2 - the reconstructing high pass filter
L1 - the reconstructing high pass filter
L2 - the reconstructing high pass filter
Returns:
returns 1 if successful, 0 otherwise

weightedTransformMRFHorizontal

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)
MRF transform method

Parameters:
original - the original to transform
this_small - small version of this
original_small - small version of original
magnitude - float image of wavelet magnitude
source - array of source images
source_small - array of small versions of source images
scount - number of source images
target - array of target images
target_small - array of small target images
tcount - number of target images
alpha - amount to scale the "standard" smoothing width by
Returns:
returns 1

weightedTransformMRFVertical

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)
MRF transform method

Parameters:
original - the original to transform
this_small - small version of this
original_small - small version of original
magnitude - float image of wavelet magnitude
source - array of source images
source_small - array of small versions of source images
scount - number of source images
target - array of target images
target_small - array of small target images
tcount - number of target images
alpha - amount to scale the "standard" smoothing width by
Returns:
returns 1

sum

public double sum()
Return the sum of all pixels in this image

Returns:
the sum of all pixel values in this image

sampleAverage

public double sampleAverage()
Returns:
the average value of the pixels in this image

sobelEdge

public FloatImage sobelEdge(double thresh)
Finds edges in the image with the sobel edge detector

Parameters:
thresh - threshold at which to detect edges
Returns:
detected edges as a FloatImage

sobelEdgeMag

public FloatImage sobelEdgeMag()
Finds edges in the image with the sobel edge detector

Parameters:
thresh - threshold at which to detect edges
Returns:
detected edges as a FloatImage

edgeDistance

public FloatImage edgeDistance()
For each point in the image computes the distance to the nearest edge Assumes that the image given has been run through a edge detection filter

Returns:
FloatImage containing distance

rot180

public FloatImage rot180()
Flip the image both horizontally and verticaly

Returns:

clamp

public void clamp(float min,
                  float max)
Clamp the values in the Float map to the range specified by min and max. Values greater than max are set to max and values less than min are set to min

Parameters:
min - minimum value in the range
max - maximum value in the range

lbp

public FloatImage lbp()
Construct an LBP image from this

Returns:
returns the LBP image

lbpHist

public java.util.ArrayList<float[]> lbpHist(int xdiv,
                                            int ydiv)
Construct LBP histograms from this lbp image

Parameters:
xdiv - number of divisions in x
ydiv - number of divisions in y
Returns:
returns an array list of histograms

uniformLbpHist

public java.util.ArrayList<float[]> uniformLbpHist(int xdiv,
                                                   int ydiv)
Construct Uniform LBP histograms from this lbp image

Parameters:
xdiv - number of divisions in x
ydiv - number of divisions in y
Returns:
returns an array list of histograms