JIGL
v1.6

jigl.image
Class InterpolatedGrayImage

java.lang.Object
  |
  +--jigl.image.GrayImage
        |
        +--jigl.image.InterpolatedGrayImage
All Implemented Interfaces:
Image, InterpolatedImage

public class InterpolatedGrayImage
extends GrayImage
implements InterpolatedImage

An InterpolatedGrayImage is a GrayImage that can be accessed at other than integral locations. Supports nearest neighbor, bilinear, and bicubic interpolation.


Field Summary
static int CUBIC
          Bicubic constant
protected  int interpolationMethod
          The interpolation method that will be used.
static int LINEAR
          Linear Interpolation constant
static int NEIGHBOR
          Nearest neighbor constant
 
Fields inherited from class jigl.image.GrayImage
data, X, Y
 
Constructor Summary
InterpolatedGrayImage()
          Create an empty InterpolatedGrayImage.
InterpolatedGrayImage(GrayImage img)
          Create an InterpolatedGrayImage from a GrayImage.
InterpolatedGrayImage(Image img)
          Create an InterpolatedGrayImage from a Java image.
InterpolatedGrayImage(InterpolatedGrayImage img)
          Deep copy of an InterpolatedGrayImage.
InterpolatedGrayImage(int x, int y)
          Create an InterpolatedGrayImage with width x and height y.
 
Method Summary
 void accum(double x, double y, int value)
          Add value to the surrounding area of (x,y).
 void accum(double x, int value)
          Add value to the surrounding area of (x,0).
private static double CatMull(double t, double y0, double y1, double y2, double y3)
          cubic interpolation using the CatMull-Rom method
 Image copy()
          deep copy
 int getInterpolationMethod()
          Returns the interpolation method used.
 int interp(double x)
          Returns the interpolated value at (x,0).
 int interp(double x, double y)
          Returns the interpolated value at (x,y).
 void setInterpolationMethod(int m)
          Sets the interpolation method to be used.
 void splat(double x, double y, int value)
          Spread value to the surrounding area of (x,y).
 void splat(double x, int value)
          Spread value in the surrounding area of (x,0).
 
Methods inherited from class jigl.image.GrayImage
absSum, add, add, add, add, add, add, addbuffer, addbuffer, addSum, byteSize, byteSize, clear, clear, clip, clip, copy, diff, divide, divide, divide, divide, divide, divide, get, getData, getJavaImage, main, max, max, median, median, min, min, multiply, multiply, multiply, multiply, multiply, multiply, set, set, sqrSum, subtract, subtract, subtract, subtract, subtract, subtract, toString, toString, X, Y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jigl.image.Image
copy, getJavaImage, toString, X, Y
 

Field Detail

NEIGHBOR

public static final int NEIGHBOR
Nearest neighbor constant

See Also:
Constant Field Values

LINEAR

public static final int LINEAR
Linear Interpolation constant

See Also:
Constant Field Values

CUBIC

public static final int CUBIC
Bicubic constant

See Also:
Constant Field Values

interpolationMethod

protected int interpolationMethod
The interpolation method that will be used. Default= NEIGHBOR

Constructor Detail

InterpolatedGrayImage

public InterpolatedGrayImage()
Create an empty InterpolatedGrayImage.


InterpolatedGrayImage

public InterpolatedGrayImage(int x,
                             int y)
Create an InterpolatedGrayImage with width x and height y.


InterpolatedGrayImage

public InterpolatedGrayImage(GrayImage img)
Create an InterpolatedGrayImage from a GrayImage.


InterpolatedGrayImage

public InterpolatedGrayImage(InterpolatedGrayImage img)
Deep copy of an InterpolatedGrayImage.


InterpolatedGrayImage

public InterpolatedGrayImage(Image img)
Create an InterpolatedGrayImage from a Java image.

Method Detail

copy

public Image copy()
deep copy

Specified by:
copy in interface Image
Overrides:
copy in class GrayImage
Returns:
a deep copy of GrayImage

getInterpolationMethod

public final int getInterpolationMethod()
Returns the interpolation method used.

Specified by:
getInterpolationMethod in interface InterpolatedImage

setInterpolationMethod

public final void setInterpolationMethod(int m)
Sets the interpolation method to be used. The edge cases of linear and cubic interpolation are treated differently to avoid ArrayIndexOutOfBoundsExceptions. Cubic uses linear interpolation when it is nest to the edge, and linear uses single-linear interpolation when it is right on the edge.

Specified by:
setInterpolationMethod in interface InterpolatedImage

interp

public final int interp(double x)
                 throws ArrayIndexOutOfBoundsException
Returns the interpolated value at (x,0).

ArrayIndexOutOfBoundsException

interp

public final int interp(double x,
                        double y)
                 throws ArrayIndexOutOfBoundsException
Returns the interpolated value at (x,y).

ArrayIndexOutOfBoundsException

accum

public final void accum(double x,
                        int value)
Add value to the surrounding area of (x,0).


accum

public final void accum(double x,
                        double y,
                        int value)
Add value to the surrounding area of (x,y).


splat

public final void splat(double x,
                        int value)
Spread value in the surrounding area of (x,0).


splat

public final void splat(double x,
                        double y,
                        int value)
Spread value to the surrounding area of (x,y).


CatMull

private static final double CatMull(double t,
                                    double y0,
                                    double y1,
                                    double y2,
                                    double y3)
cubic interpolation using the CatMull-Rom method


JIGL
v1.6

Submit a bug or feature
Revised in May 2002 by Weiming Liu