|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.aerith.misao.image.MonoImage
The MonoImage
is a class of monochrome image. The real
pixel values are stored in the field buffer, a
Buffer
object. To invoke methods of this class, the
data type (byte, int, etc.) is not need to consider.
Field Summary | |
protected double |
bscale
The magnification value to get true pixel value. |
protected Buffer |
buffer
The buffer of pixel values. |
protected double |
bzero
The zero point value to get true pixel value. |
protected boolean |
signed_flag
If the value is to be considered as signed, it is true. |
static int |
TYPE_BYTE
The type number of buffer indicating byte. |
static int |
TYPE_DOUBLE
The type number of buffer indicating double. |
static int |
TYPE_FLOAT
The type number of buffer indicating float. |
static int |
TYPE_INT
The type number of buffer indicating int. |
static int |
TYPE_SHORT
The type number of buffer indicating short. |
Constructor Summary | |
MonoImage()
Constructs an empty monochrome image. |
|
MonoImage(Buffer image_buffer)
Constructs a MonoImage from a buffer. |
Method Summary | |
MonoImage |
cloneImage()
Creates a clone image buffer. |
MonoImage |
cloneImage(Size new_size)
Creates a clone image buffer of the new size. |
static int |
convertRGBToGray(int r,
int g,
int b)
Converts the RGB value into gray value. |
double |
getAveragedValue(double x,
double y)
Gets pixel value of a specified position exactly, calculated from the pixels around the position. |
int |
getBufferType()
Gets the data type of buffer. |
int |
getDataCount()
Gets the number of data. |
java.awt.Image |
getImage()
Creates an java.awt.Image from the image buffer. |
java.awt.Image |
getImage(double minimum,
double maximum)
Creates an java.awt.Image from the image buffer. |
Size |
getSize()
Gets the image size. |
double |
getValue(int x,
int y)
Gets pixel value of a specified position. |
double |
getValueAt(int index)
Gets the value of data at the specified location. |
double |
getValueOnFlatExtension(int x,
int y)
Gets pixel value of a specified position. |
double |
getValueOnRepeatedTiling(int x,
int y)
Gets pixel value of a specified position. |
double |
getValueOnReversingTiling(int x,
int y)
Gets pixel value of a specified position. |
void |
inverse()
Inverses white and black. |
private void |
read(java.io.DataInput input,
Size size,
int type)
Reads pixel values, allocates memory buffer and set pixel values into the buffer. |
void |
readByteImage(java.io.DataInput input,
Size size)
Reads pixel values, allocates memory buffer and set pixel values into the buffer. |
void |
readDoubleImage(java.io.DataInput input,
Size size)
Reads pixel values, allocates memory buffer and set pixel values into the buffer. |
void |
readFloatImage(java.io.DataInput input,
Size size)
Reads pixel values, allocates memory buffer and set pixel values into the buffer. |
void |
readIntImage(java.io.DataInput input,
Size size)
Reads pixel values, allocates memory buffer and set pixel values into the buffer. |
void |
readShortImage(java.io.DataInput input,
Size size)
Reads pixel values, allocates memory buffer and set pixel values into the buffer. |
void |
reverseHorizontally()
Reverses left to the right. |
void |
reverseVertically()
Reverses upside down. |
void |
setPixelValueConvertParameters(double zero_point,
double magnification)
Sets the zero point value and the magnification value to get true pixel value. |
void |
setSigned()
Sets the flag to be signed. |
void |
setValue(int x,
int y,
double value)
Sets pixel value of a specified position. |
void |
subtract(MonoImage image)
Subtracts the specified image from this image. |
void |
write(java.io.DataOutput output)
Write pixel values into the specified stream. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int TYPE_BYTE
public static final int TYPE_SHORT
public static final int TYPE_INT
public static final int TYPE_FLOAT
public static final int TYPE_DOUBLE
protected Buffer buffer
protected double bzero
protected double bscale
protected boolean signed_flag
Constructor Detail |
public MonoImage()
public MonoImage(Buffer image_buffer)
MonoImage
from a buffer.image_buffer
- the buffer to create a
MonoImage
.Method Detail |
public static int convertRGBToGray(int r, int g, int b)
r
- the R value.g
- the G value.b
- the B value.public Size getSize()
public void setPixelValueConvertParameters(double zero_point, double magnification)
zero_point
- the zero point value.magnification
- the magnification value.public int getBufferType() throws UnsupportedBufferTypeException
public void setSigned()
public int getDataCount()
public double getValueAt(int index) throws java.lang.IndexOutOfBoundsException
index
- the location of the data.public double getValue(int x, int y) throws java.lang.IndexOutOfBoundsException
x
- the x position.y
- the y position.public double getValueOnRepeatedTiling(int x, int y)
x
- the x position.y
- the y position.public double getValueOnReversingTiling(int x, int y)
x
- the x position.y
- the y position.public double getValueOnFlatExtension(int x, int y)
x
- the x position.y
- the y position.public double getAveragedValue(double x, double y)
x
- the x position.y
- the y position.public void setValue(int x, int y, double value) throws java.lang.IndexOutOfBoundsException
x
- the x position.y
- the y position.value
- the value to set.public void readByteImage(java.io.DataInput input, Size size) throws java.io.IOException
input
- the input stream pointing to the start of byte
data.size
- the size of image.public void readShortImage(java.io.DataInput input, Size size) throws java.io.IOException
input
- the input stream pointing to the start of short
data.size
- the size of image.public void readIntImage(java.io.DataInput input, Size size) throws java.io.IOException
input
- the input stream pointing to the start of int
data.size
- the size of image.public void readFloatImage(java.io.DataInput input, Size size) throws java.io.IOException
input
- the input stream pointing to the start of int
data.size
- the size of image.public void readDoubleImage(java.io.DataInput input, Size size) throws java.io.IOException
input
- the input stream pointing to the start of int
data.size
- the size of image.private void read(java.io.DataInput input, Size size, int type) throws java.io.IOException, UnsupportedBufferTypeException
input
- the input stream pointing to the start of int
data.size
- the size of image.type
- the type of data (byte, short or int).public void write(java.io.DataOutput output) throws java.io.IOException
output
- the output stream.public java.awt.Image getImage()
java.awt.Image
from the image buffer.
The range of pixel values is expanded so that the minimum value
becomes 0 and the maximum value becomes 255.java.awt.Image
.public java.awt.Image getImage(double minimum, double maximum)
java.awt.Image
from the image buffer.
The range of pixel values is expanded so that the specified
minimum value becomes 0 and the specified maximum value becomes
255.minimum
- the pixel value to be 0.maximum
- the pixel value to be 255.java.awt.Image
.public void inverse()
public void reverseVertically()
public void reverseHorizontally()
public void subtract(MonoImage image) throws java.lang.IndexOutOfBoundsException
image
- the image to subtract.public MonoImage cloneImage()
public MonoImage cloneImage(Size new_size)
new_size
- the new size.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |