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
-
bpels
- pixel array used for gray-level image
-
icol
- number of columns (width)
-
ipels
- pixel array used for color image
-
irow
- number of rows (height)
-
ImageData(byte[], int, int)
- Create ImageData from a byte array using IndexColor(8) model
-
ImageData(int[], int, int)
- Create ImageData from an integer array using DirectColor model
-
ImageData(String)
- Load ImageData from a local file or URL;
Input formats: GIF, JPEG, PPM, PGM; Output formats: PPM, PGM
-
clone()
- Create a new ImageData object (with same content)
-
col()
- Get number of columns (height)
-
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);
-
drawpolygon(Polygon, byte)
-
Draws a polygon with given gray level.
-
getImage()
- Get java.awt.Image object
-
getImage(double)
- Get scaled java.awt.Image object
-
getIntensityMap()
- Convert to gray level image, return intensity map in 2-D float array
-
getIntensityMap(Rectangle)
- Convert to gray level image, return intensity map in 2-D float array
-
getLuvImage(Rectangle)
- Convert to Luv iamge, return in 3-D float array
-
isColor()
- Return true if it is a color image
-
pc(int)
- Get pixel value, make sure index is valid and this is a color image
-
pc(int, int)
- Get pixel value, make sure coords are valid and this is a color image
-
pg(int)
- Get pixel value, make sure index is valid and it is a gray-level image
-
pg(int, int)
- Get pixel value, make sure coords are valid and it is a gray-level image
-
row()
- Get number of rows (width)
-
savePGM(String)
- Save ImageData into a PGM file (convert to intensity for color image)
-
savePPM(String)
- Save ImageData into a PPM file if it is a true color image
-
scale(double)
- Scale the image
-
size()
- Get number of pixels (row*column)
-
spc(int, int)
- Set pixel value, make sure index is valid and this is a color image
-
spc(int, int, int)
- Set pixel value, make sure coords are valid and this is a color image
-
spg(int, byte)
- Set pixel value, make sure index is valid and this is a gray-level image
-
spg(int, int, byte)
- Set pixel value, make sure coords are valid and this is a gray-level image
ipels
protected int ipels[]
- pixel array used for color image
bpels
protected byte bpels[]
- pixel array used for gray-level image
irow
protected int irow
- number of rows (height)
icol
protected int icol
- number of columns (width)
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)
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)
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
getImage
public Image getImage()
- Get java.awt.Image object
getImage
public Image getImage(double s)
- Get scaled java.awt.Image object
- Parameters:
- s - The scale factor
scale
public void scale(double s)
- Scale the image
- Parameters:
- s - the scale (should be >0)
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
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
row
public final int row()
- Get number of rows (width)
col
public final int col()
- Get number of columns (height)
size
public final int size()
- Get number of pixels (row*column)
isColor
public final boolean isColor()
- Return true if it is a color image
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
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
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
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
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
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
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
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
getIntensityMap
public float[][] getIntensityMap()
- Convert to gray level image, return intensity map in 2-D float array
getIntensityMap
public float[][] getIntensityMap(Rectangle bbox)
- Convert to gray level image, return intensity map in 2-D float array
- Parameters:
- bbox - bounding box
getLuvImage
public float[][][] getLuvImage(Rectangle bbox)
- Convert to Luv iamge, return in 3-D float array
- Parameters:
- bbox - bounding box (null for whole frame)
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
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
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