public class ImageInputTokenizer extends java.lang.Object implements PatternTokenizer
Colour Mode In colour mode the tokenizer produces seperate RGB input values in the range 0 to 1 from the image. So using an image of width 10 and height 10 there will be 10x10x3 inputs in the range 0 to 1. The individual colour components are calculated by obtaining the RGB values from the image. These value are initially in an ARGB format. Transparency is removed and the RGB value extracted and normalised between 0 and 1.
Non Colour Mode / Grey Scale Mode In this mode the tokenizer treats each input value as a grey scale value for each pixel. In this mode only Width*Height values are required. To produce the final image the Red, Green and Blue components are the set to this same value. The grey scale component is calculated by obtaining the RGB values from the image. These value are initially in an ARGB format. Transparency is removed and the RGB value extracted, averaged and normalised to produce one grey scale value between 0 and 1.
Constructor and Description |
---|
ImageInputTokenizer(int req_width,
int req_height,
java.awt.Image[] the_images,
boolean colour)
Creates new ImageInputTokenizer
|
ImageInputTokenizer(int req_width,
int req_height,
java.util.Vector file_list,
boolean colour)
Creates new ImageInputTokenizer
|
Modifier and Type | Method and Description |
---|---|
char |
getDecimalPoint() |
int |
getLineno()
Return the current line number.
|
int |
getNumTokens()
Gets the number of tokens on the current line.
|
double |
getTokenAt(int posiz)
Gets the token (RGB normalised between 0 and 1) at the specified position.
|
double[] |
getTokensArray()
Insert the method's description here.
|
void |
mark()
Mark the current position.
|
boolean |
nextLine()
Fetchs the next line and extracts all the tokens
|
void |
resetInput()
Go to the last marked position.
|
void |
setDecimalPoint(char dp) |
public ImageInputTokenizer(int req_width, int req_height, java.util.Vector file_list, boolean colour) throws java.io.IOException
in
- java.io.IOException
public ImageInputTokenizer(int req_width, int req_height, java.awt.Image[] the_images, boolean colour) throws java.io.IOException
in
- java.io.IOException
public int getLineno()
getLineno
in interface PatternTokenizer
public int getNumTokens() throws java.io.IOException
getNumTokens
in interface PatternTokenizer
java.io.IOException
public double getTokenAt(int posiz) throws java.io.IOException
getTokenAt
in interface PatternTokenizer
posiz
- An int index into the current lines tokens.java.io.IOException
public double[] getTokensArray()
getTokensArray
in interface PatternTokenizer
public void mark() throws java.io.IOException
mark
in interface PatternTokenizer
IOException
- if an I/O Error occurspublic boolean nextLine() throws java.io.IOException
nextLine
in interface PatternTokenizer
java.io.IOException
- if an I/O Error occurspublic void resetInput() throws java.io.IOException
resetInput
in interface PatternTokenizer
java.io.IOException
public void setDecimalPoint(char dp)
setDecimalPoint
in interface PatternTokenizer
public char getDecimalPoint()
getDecimalPoint
in interface PatternTokenizer
Submit Feedback to pmarrone@users.sourceforge.net