uk.ac.essex.common.image
Class Raster2

java.lang.Object
  extended by java.awt.image.Raster
      extended by uk.ac.essex.common.image.Raster2

public class Raster2
extends java.awt.image.Raster

A simple extension of Raster which adds some convenience methods for access pixel values in a more intuitive way (grey(), red(), green(), blue(), etc.) and a set of statistical operations on pixel values.


Field Summary
static int BLACK
           
static int WHITE
           
 
Fields inherited from class java.awt.image.Raster
dataBuffer, height, minX, minY, numBands, numDataElements, parent, sampleModel, sampleModelTranslateX, sampleModelTranslateY, width
 
Constructor Summary
Raster2(java.awt.image.Raster src)
          Effectively type-casts a Raster as a Raster2 by calling parent constructor with the given parameters.
Raster2(java.awt.image.SampleModel sampleModel, java.awt.image.DataBuffer dataBuffer, java.awt.Point origin)
          constructs a Raster2 by calling parent constructor with the given parameters.
Raster2(java.awt.image.SampleModel sampleModel, java.awt.image.DataBuffer dataBuffer, java.awt.Rectangle aRegion, java.awt.Point sampleModelTranslate, java.awt.image.Raster parent)
          constructs a Raster2 by calling parent constructor with the given parameters.
Raster2(java.awt.image.SampleModel sampleModel, java.awt.Point origin)
          constructs a Raster2 by calling parent constructor with the given parameters.
 
Method Summary
 int blue(int u, int v)
          returns the blue pixel value in band 2 at the given position.
 double blueCovariance()
          returns the covariance of the blue pixels in band 2.
 double blueGreenCrossCovariance()
          returns the covariance between the pixel values in bands 1 and 2 (blue, green).
 double blueMean()
          returns the mean blue pixel value in band 2.
 int eastNeighbor(int u, int v)
          returns the pixel value in band 0 at position east of the given position, if it exists, otherwise returns -1.
 int green(int u, int v)
          returns the green pixel value in band 1 at the given position.
 double greenCovariance()
          returns the covariance of the green pixels in band 1.
 double greenMean()
          returns the mean green pixel value in band 1.
 int grey(int u, int v)
          returns the pixel value in band 0 at the given position.
 double greyCovariance()
          returns the covariance of the pixels in band 0.
 double greyMean()
          returns the mean pixel value in band 0.
 int maxBlue()
          returns the maximum blue pixel value in band 2.
 int maxGreen()
          returns the maximum green pixel value in band 1.
 int maxGrey()
          returns the maximum pixel value in band 0
 int maxRed()
          returns the maximum red pixel value in band 0.
 int minBlue()
          returns the minimum blue pixel value in band 2.
 int minGreen()
          returns the minimum green pixel value in band 1.
 int minGrey()
          returns the minimum pixel value in band 0.
 int minRed()
          returns the minimum red pixel value in band 0.
 int northNeighbor(int u, int v)
          returns the pixel value in band 0 at position north of the given position, if it exists, otherwise returns -1.
 int red(int u, int v)
          returns the red pixel value in band 0 at the given position.
 double redBlueCrossCovariance()
          returns the covariance between the pixel values in bands 0 and 2 (red, blue).
 double redCovariance()
          returns the covariance of the red pixels in band 0.
 double redGreenCrossCovariance()
          returns the covariance between the pixel values in bands 0 and 1 (red, green).
 double redMean()
          returns the mean red pixel value in band 0.
 int southNeighbor(int u, int v)
          returns the pixel value in band 0 at position south of the given position, if it exists, otherwise returns -1.
 int westNeighbor(int u, int v)
          returns the pixel value in band 0 at position west of the given position, if it exists, otherwise returns -1.
 
Methods inherited from class java.awt.image.Raster
createBandedRaster, createBandedRaster, createBandedRaster, createChild, createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createInterleavedRaster, createInterleavedRaster, createInterleavedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createRaster, createTranslatedChild, createWritableRaster, createWritableRaster, getBounds, getDataBuffer, getDataElements, getDataElements, getHeight, getMinX, getMinY, getNumBands, getNumDataElements, getParent, getPixel, getPixel, getPixel, getPixels, getPixels, getPixels, getSample, getSampleDouble, getSampleFloat, getSampleModel, getSampleModelTranslateX, getSampleModelTranslateY, getSamples, getSamples, getSamples, getTransferType, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLACK

public static final int BLACK
See Also:
Constant Field Values

WHITE

public static final int WHITE
See Also:
Constant Field Values
Constructor Detail

Raster2

public Raster2(java.awt.image.SampleModel sampleModel,
               java.awt.image.DataBuffer dataBuffer,
               java.awt.Point origin)
constructs a Raster2 by calling parent constructor with the given parameters.


Raster2

public Raster2(java.awt.image.SampleModel sampleModel,
               java.awt.image.DataBuffer dataBuffer,
               java.awt.Rectangle aRegion,
               java.awt.Point sampleModelTranslate,
               java.awt.image.Raster parent)
constructs a Raster2 by calling parent constructor with the given parameters.


Raster2

public Raster2(java.awt.image.SampleModel sampleModel,
               java.awt.Point origin)
constructs a Raster2 by calling parent constructor with the given parameters.


Raster2

public Raster2(java.awt.image.Raster src)
Effectively type-casts a Raster as a Raster2 by calling parent constructor with the given parameters.

Parameters:
src - the Raster to cast
Method Detail

grey

public int grey(int u,
                int v)
returns the pixel value in band 0 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the pixel value at position u,v.

westNeighbor

public int westNeighbor(int u,
                        int v)
returns the pixel value in band 0 at position west of the given position, if it exists, otherwise returns -1.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the pixel value at position u-1,v or -1.

eastNeighbor

public int eastNeighbor(int u,
                        int v)
returns the pixel value in band 0 at position east of the given position, if it exists, otherwise returns -1.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the pixel value at position u+1,v or -1.

northNeighbor

public int northNeighbor(int u,
                         int v)
returns the pixel value in band 0 at position north of the given position, if it exists, otherwise returns -1.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the pixel value at position u,v-1, or -1.

southNeighbor

public int southNeighbor(int u,
                         int v)
returns the pixel value in band 0 at position south of the given position, if it exists, otherwise returns -1.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the pixel value at position u,v+1.

blue

public int blue(int u,
                int v)
returns the blue pixel value in band 2 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the blue pixel value at position u,v.

green

public int green(int u,
                 int v)
returns the green pixel value in band 1 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the green pixel value at position u,v.

red

public int red(int u,
               int v)
returns the red pixel value in band 0 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
Returns:
the red pixel value at position u,v.

minGrey

public int minGrey()
returns the minimum pixel value in band 0.

Returns:
the minimum pixel value.

minRed

public int minRed()
returns the minimum red pixel value in band 0.

Returns:
the minimum red pixel value.

minGreen

public int minGreen()
returns the minimum green pixel value in band 1.

Returns:
the minimum green pixel value.

minBlue

public int minBlue()
returns the minimum blue pixel value in band 2.

Returns:
the minimum blue pixel value.

maxGrey

public int maxGrey()
returns the maximum pixel value in band 0

Returns:
the maximum pixel value.

maxRed

public int maxRed()
returns the maximum red pixel value in band 0.

Returns:
the maximum red pixel value.

maxGreen

public int maxGreen()
returns the maximum green pixel value in band 1.

Returns:
the maximum green pixel value.

maxBlue

public int maxBlue()
returns the maximum blue pixel value in band 2.

Returns:
the maximum blue pixel value.

redMean

public double redMean()
returns the mean red pixel value in band 0.

Returns:
the mean red pixel value.

redCovariance

public double redCovariance()
returns the covariance of the red pixels in band 0.

Returns:
the red pixel value covariance.

greenMean

public double greenMean()
returns the mean green pixel value in band 1.

Returns:
the mean green pixel value.

greenCovariance

public double greenCovariance()
returns the covariance of the green pixels in band 1.

Returns:
the green pixel value covariance.

blueMean

public double blueMean()
returns the mean blue pixel value in band 2.

Returns:
the mean blue pixel value.

blueCovariance

public double blueCovariance()
returns the covariance of the blue pixels in band 2.

Returns:
the blue pixel value covariance.

greyMean

public double greyMean()
returns the mean pixel value in band 0.

Returns:
the mean pixel value.

greyCovariance

public double greyCovariance()
returns the covariance of the pixels in band 0.

Returns:
the pixel value covariance.

redGreenCrossCovariance

public double redGreenCrossCovariance()
returns the covariance between the pixel values in bands 0 and 1 (red, green).

Returns:
the covariance between the red and green pixel values.

blueGreenCrossCovariance

public double blueGreenCrossCovariance()
returns the covariance between the pixel values in bands 1 and 2 (blue, green).

Returns:
the covariance between the blue and green pixel values.

redBlueCrossCovariance

public double redBlueCrossCovariance()
returns the covariance between the pixel values in bands 0 and 2 (red, blue).

Returns:
the covariance between the red and blue pixel values.