no.hiof.imagepr.filters
Class ImageScaler

java.lang.Object
  extended byno.hiof.imagepr.filters.ImageScaler
All Implemented Interfaces:
ImageFilter

public class ImageScaler
extends java.lang.Object
implements ImageFilter

This class takes data-matrices and can perform scale operations on them. One can choose either to use "Nearest neighbour"-interpolation for to get a jaggy look or "Bi-linear interpolation" for smoother scaling.

The class is adjusted to version 2 of the API by Per-Olav Rus�s.

Author:
Rune Andre Melgaard, Mads Hansen, Chao-Ching, Mai Burner.

Field Summary
static int BILINEAR
           
static int NEAREST
           
 
Constructor Summary
ImageScaler(double scaleVertical, double scaleHorizontal, int interpolType)
          Constructor for an ImageScaler.
ImageScaler(double scale, int interpolType)
          Constructor for an ImageScaler.
 
Method Summary
 Image filter(Image image)
          Perform the scaling on a an image, which may be a RGBImage, IntensityImage or HSIImage.
 short[][] filter(short[][] matrix)
          Perform the scaling on a matrix of pixel values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEAREST

public static final int NEAREST
See Also:
Constant Field Values

BILINEAR

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

ImageScaler

public ImageScaler(double scaleVertical,
                   double scaleHorizontal,
                   int interpolType)
Constructor for an ImageScaler. The parameter interpolType may be either NEAREST or BILINEAR.

Parameters:
scaleVertical - Vertical scale.
scaleHorizontal - Horizontal scale.
interpolType - Type of interpolation.

ImageScaler

public ImageScaler(double scale,
                   int interpolType)
Constructor for an ImageScaler. The parameter interpolType may be either NEAREST or BILINEAR.

Parameters:
scale - The scale in both vertical and horizontal directions.
interpolType - Type of interpolation.
Method Detail

filter

public short[][] filter(short[][] matrix)
Perform the scaling on a matrix of pixel values.

Specified by:
filter in interface ImageFilter
Parameters:
matrix - The original matrix.
Returns:
The scaled matrix.

filter

public Image filter(Image image)
Perform the scaling on a an image, which may be a RGBImage, IntensityImage or HSIImage. Scaling for BinaryImage is not implemented.

Specified by:
filter in interface ImageFilter
Parameters:
image - The original image.
Returns:
The scaled image