All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class image.ImageData

java.lang.Object
   |
   +----image.ImageData

public class ImageData
extends Object
implements Cloneable
ImageData contains either true color rgb(8x8x8) data or 8-bit gray-level data

Author:
Di Zhong (Columbia University)
See Also:
ImageIO

Variable Index

 o bpels
pixel array used for gray-level image
 o icol
number of columns (width)
 o ipels
pixel array used for color image
 o irow
number of rows (height)

Constructor Index

 o ImageData(byte[], int, int)
Create ImageData from a byte array using IndexColor(8) model
 o ImageData(int[], int, int)
Create ImageData from an integer array using DirectColor model
 o ImageData(String)
Load ImageData from a local file or URL; Input formats: GIF, JPEG, PPM, PGM; Output formats: PPM, PGM

Method Index

 o clone()
Create a new ImageData object (with same content)
 o col()
Get number of columns (height)
 o drawline(int, int, int, int, byte)
Draws a line of given gray-level color from (x0,y0) to (x1,y1);
implements the Bresenham's incremental midpoint algorithm;
(adapted from J D Foley, A Van Dam, S K Feiner, J F Hughes
"Computer Graphics Principles and practice", * 2nd ed, 1990);
 o drawpolygon(Polygon, byte)
Draws a polygon with given gray level.
 o getImage()
Get java.awt.Image object
 o getImage(double)
Get scaled java.awt.Image object
 o getIntensityMap()
Convert to gray level image, return intensity map in 2-D float array
 o getIntensityMap(Rectangle)
Convert to gray level image, return intensity map in 2-D float array
 o getLuvImage(Rectangle)
Convert to Luv iamge, return in 3-D float array
 o isColor()
Return true if it is a color image
 o pc(int)
Get pixel value, make sure index is valid and this is a color image
 o pc(int, int)
Get pixel value, make sure coords are valid and this is a color image
 o pg(int)
Get pixel value, make sure index is valid and it is a gray-level image
 o pg(int, int)
Get pixel value, make sure coords are valid and it is a gray-level image
 o row()
Get number of rows (width)
 o savePGM(String)
Save ImageData into a PGM file (convert to intensity for color image)
 o savePPM(String)
Save ImageData into a PPM file if it is a true color image
 o scale(double)
Scale the image
 o size()
Get number of pixels (row*column)
 o spc(int, int)
Set pixel value, make sure index is valid and this is a color image
 o spc(int, int, int)
Set pixel value, make sure coords are valid and this is a color image
 o spg(int, byte)
Set pixel value, make sure index is valid and this is a gray-level image
 o spg(int, int, byte)
Set pixel value, make sure coords are valid and this is a gray-level image

Variables

 o ipels
 protected int ipels[]
pixel array used for color image

 o bpels
 protected byte bpels[]
pixel array used for gray-level image

 o irow
 protected int irow
number of rows (height)

 o icol
 protected int icol
number of columns (width)

Constructors

 o ImageData
 public ImageData(int pmap[],
                  int r,
                  int c)
Create ImageData from an integer array using DirectColor model

Parameters:
pmap - The integer array
r - height (or row)
c - width (or column)
 o ImageData
 public ImageData(byte pmap[],
                  int r,
                  int c)
Create ImageData from a byte array using IndexColor(8) model

Parameters:
pmap - The integer array
r - height (or row)
c - width (or column)
 o ImageData
 public ImageData(String filename) throws IOException
Load ImageData from a local file or URL; Input formats: GIF, JPEG, PPM, PGM; Output formats: PPM, PGM

Parameters:
filename - The local file name or URL of an image

Methods

 o getImage
 public Image getImage()
Get java.awt.Image object

 o getImage
 public Image getImage(double s)
Get scaled java.awt.Image object

Parameters:
s - The scale factor
 o scale
 public void scale(double s)
Scale the image

Parameters:
s - the scale (should be >0)
 o savePPM
 public void savePPM(String fname) throws IOException
Save ImageData into a PPM file if it is a true color image

Parameters:
fname - The file name
 o savePGM
 public void savePGM(String fname) throws IOException
Save ImageData into a PGM file (convert to intensity for color image)

Parameters:
fname - The file name
 o row
 public final int row()
Get number of rows (width)

 o col
 public final int col()
Get number of columns (height)

 o size
 public final int size()
Get number of pixels (row*column)

 o isColor
 public final boolean isColor()
Return true if it is a color image

 o pc
 public final int pc(int x,
                     int y)
Get pixel value, make sure coords are valid and this is a color image

Parameters:
x - x-coordinate
y - y-coordinate
 o pc
 public final int pc(int i)
Get pixel value, make sure index is valid and this is a color image

Parameters:
i - scanline index
 o spc
 public final void spc(int i,
                       int v)
Set pixel value, make sure index is valid and this is a color image

Parameters:
i - scanline index
v - pixel value
 o spc
 public final void spc(int x,
                       int y,
                       int v)
Set pixel value, make sure coords are valid and this is a color image

Parameters:
x - x-coordinate
y - y-coordinate
v - pixel value
 o pg
 public final byte pg(int i)
Get pixel value, make sure index is valid and it is a gray-level image

Parameters:
i - scanline index
 o pg
 public final byte pg(int x,
                      int y)
Get pixel value, make sure coords are valid and it is a gray-level image

Parameters:
i - scanline index
x - x-coordinate
y - y-coordinate
 o spg
 public final void spg(int i,
                       byte v)
Set pixel value, make sure index is valid and this is a gray-level image

Parameters:
i - scanline index
v - pixel value
 o spg
 public final void spg(int x,
                       int y,
                       byte v)
Set pixel value, make sure coords are valid and this is a gray-level image

Parameters:
x - x-coordinate
y - y-coordinate
v - pixel value
 o getIntensityMap
 public float[][] getIntensityMap()
Convert to gray level image, return intensity map in 2-D float array

 o getIntensityMap
 public float[][] getIntensityMap(Rectangle bbox)
Convert to gray level image, return intensity map in 2-D float array

Parameters:
bbox - bounding box
 o getLuvImage
 public float[][][] getLuvImage(Rectangle bbox)
Convert to Luv iamge, return in 3-D float array

Parameters:
bbox - bounding box (null for whole frame)
 o drawline
 public void drawline(int x0,
                      int y0,
                      int x1,
                      int y1,
                      byte color)
Draws a line of given gray-level color from (x0,y0) to (x1,y1);
implements the Bresenham's incremental midpoint algorithm;
(adapted from J D Foley, A Van Dam, S K Feiner, J F Hughes
"Computer Graphics Principles and practice", * 2nd ed, 1990);

Parameters:
x0 - x-coordinate of endpoint 1
y0 - y-coordinate of endpoint 1
x1 - x-coordinate of endpoint 2
y1 - y-coordinate of endpoint 2
color - gray-level; R,G and B are all set to "color" for color images
 o drawpolygon
 public void drawpolygon(Polygon poly,
                         byte color)
Draws a polygon with given gray level.

Parameters:
poly - polygon
color - gray-level; R,G and B are all set to "color" for color image
 o clone
 public Object clone()
Create a new ImageData object (with same content)

Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index