|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.hiof.imagepr.BinaryImage
BinaryImage is a class for Binary images (black and white images). The BinaryImage class contains a Bitset containing the pixel values. There is one bit, which is 0 or 1 (or equally false or true) for each pixel.
IntensityImage
,
RGBImage
,
HSIImage
,
Serialized FormField Summary | |
protected java.util.BitSet |
data
|
protected int |
height
|
protected java.awt.Color |
oneColor
|
protected int |
width
|
protected java.awt.Color |
zeroColor
|
Fields inherited from interface no.hiof.imagepr.Image |
BLUE, GREEN, RED |
Constructor Summary | |
BinaryImage()
Constructor for an empty BinaryImage. |
|
BinaryImage(BinaryImage otherImage)
Construcs a BinaryImage by copying another BinaryImage. |
|
BinaryImage(IntensityImage original,
int threshold)
Construcs a BinaryImage with an IntensityImage as a basis. |
|
BinaryImage(int height,
int width)
Constructs a BinaryImage with a given height and width. |
Method Summary | |
Image |
createScaledImage(double scale,
int interpolType)
Creates a scaled image. |
void |
draw(java.awt.Graphics g,
int x,
int y)
Draw the image to a Graphics object at a given position. |
void |
draw(java.awt.Graphics g,
int x,
int y,
double scaleX,
double scaleY,
double rotateAngle)
Draw the image to a Graphics object at a given position with a given scale and rotation. |
java.util.BitSet |
getData()
Gets the BitSet width the image data. |
int |
getHeight()
Get the height of the BinaryImage. |
boolean |
getValueAt(int row,
int col)
Gets the value at a given pixel. |
int |
getWidth()
Get the width of the BinaryImage. |
void |
load(java.lang.String filename)
Loads the image from a file. |
java.awt.image.BufferedImage |
makeBufferedImage()
|
IntensityImage |
makeIntensityImage()
Make a IntensityImage of the BinaryImage |
IntensityImage |
makeIntensityImage(short zeroValue,
short oneValue)
Make a IntensityImage of the BinaryImage |
RGBImage |
makeRGBImage()
Make a RGBImage of the BinaryImage |
void |
save(java.lang.String filename)
Saves the image to a binary file. |
void |
setData(java.util.BitSet data)
Sets the BitSet of the BinaryImage |
void |
setOneColor(java.awt.Color c)
Sets the color of the pixels whith value one. |
void |
setValueAt(int row,
int col,
boolean value)
Sets the value at a given pixel as true or false (representing 1 or 0). |
void |
setZeroColor(java.awt.Color c)
Sets the color of the pixels whith value zero. |
void |
show()
Shows the BinaryImage in a modal window. |
void |
show(java.lang.String title)
Shows the BinaryImage in a modal window. |
void |
show(java.lang.String title,
double scale)
|
java.lang.String |
toString()
Returns a description of the image. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int width
protected int height
protected java.util.BitSet data
protected java.awt.Color zeroColor
protected java.awt.Color oneColor
Constructor Detail |
public BinaryImage()
public BinaryImage(int height, int width)
height
- The height.width
- The width.public BinaryImage(BinaryImage otherImage)
otherImage
- Another BinaryImage.public BinaryImage(IntensityImage original, int threshold)
original
- The original IntensityImagethreshold
- The thresholdMethod Detail |
public boolean getValueAt(int row, int col)
row
- The row-number of the pixel.col
- The column-number of the pixel.
public void setValueAt(int row, int col, boolean value)
row
- The row-number of the pixel.col
- The column-number of the pixel.public void show()
public void show(java.lang.String title)
show
in interface Image
title
- The title on top of the window.public void show(java.lang.String title, double scale)
show
in interface Image
public void draw(java.awt.Graphics g, int x, int y)
draw
in interface Image
g
- The Graphics object to draw on.x
- The horizontal position of the image.y
- The vertical position of the image.public void draw(java.awt.Graphics g, int x, int y, double scaleX, double scaleY, double rotateAngle)
draw
in interface Image
g
- The Graphics object to draw on.x
- The horizontal position of the image.y
- The vertical position of the image.scaleX
- The scale in x-direction. 1.0 means unscaled.scaleY
- The scale in y-direction. 1.0 means unscaled.rotateAngle
- Rotation of the image in degrees (0-360).public RGBImage makeRGBImage()
public IntensityImage makeIntensityImage()
public IntensityImage makeIntensityImage(short zeroValue, short oneValue)
zeroValue
- Value in IntensityImage corresponding to binary 0.oneValue
- Value in IntensityImage corresponding to binary 1.
public void setZeroColor(java.awt.Color c)
c
- The color.public void setOneColor(java.awt.Color c)
c
- The color.public void setData(java.util.BitSet data)
data
- The BitSet.public int getWidth()
getWidth
in interface Image
public int getHeight()
getHeight
in interface Image
public void save(java.lang.String filename) throws java.io.IOException
filename
- The filename.
java.io.IOException
public void load(java.lang.String filename) throws java.io.IOException
filename
- The filename.
java.io.IOException
public java.util.BitSet getData()
public java.awt.image.BufferedImage makeBufferedImage()
makeBufferedImage
in interface Image
public java.lang.String toString()
public Image createScaledImage(double scale, int interpolType)
createScaledImage
in interface Image
scale
- The scaleinterpolType
- The type of interpolation (unused)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |