Class ImageInputTokenizer
- java.lang.Object
-
- org.joone.io.ImageInputTokenizer
-
- All Implemented Interfaces:
- PatternTokenizer
public class ImageInputTokenizer extends java.lang.Object implements PatternTokenizer
This tokenizer is responsible for collecting data from a list of Image file names or Image objects and feeding the data from the Images into a tokenized array of values for feeding into the Neural network. GIF, JPG and PNG image file formats can be read. The tokenizer operates in two modes, colour and grey scale.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 Summary
Constructors Constructor and Description ImageInputTokenizer(int req_width, int req_height, java.awt.Image[] the_images, boolean colour)Creates new ImageInputTokenizerImageInputTokenizer(int req_width, int req_height, java.util.Vector file_list, boolean colour)Creates new ImageInputTokenizer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description chargetDecimalPoint()intgetLineno()Return the current line number.intgetNumTokens()Gets the number of tokens on the current line.doublegetTokenAt(int posiz)Gets the token (RGB normalised between 0 and 1) at the specified position.double[]getTokensArray()Insert the method's description here.voidmark()Mark the current position.booleannextLine()Fetchs the next line and extracts all the tokensvoidresetInput()Go to the last marked position.voidsetDecimalPoint(char dp)
-
-
-
Constructor Detail
-
ImageInputTokenizer
public ImageInputTokenizer(int req_width, int req_height, java.util.Vector file_list, boolean colour) throws java.io.IOExceptionCreates new ImageInputTokenizer- Parameters:
in-- Throws:
java.io.IOException
-
ImageInputTokenizer
public ImageInputTokenizer(int req_width, int req_height, java.awt.Image[] the_images, boolean colour) throws java.io.IOExceptionCreates new ImageInputTokenizer- Parameters:
in-- Throws:
java.io.IOException
-
-
Method Detail
-
getLineno
public int getLineno()
Return the current line number.- Specified by:
getLinenoin interfacePatternTokenizer- Returns:
- the current line number
-
getNumTokens
public int getNumTokens() throws java.io.IOExceptionGets the number of tokens on the current line.- Specified by:
getNumTokensin interfacePatternTokenizer- Throws:
java.io.IOException
-
getTokenAt
public double getTokenAt(int posiz) throws java.io.IOExceptionGets the token (RGB normalised between 0 and 1) at the specified position.- Specified by:
getTokenAtin interfacePatternTokenizer- Parameters:
posiz- An int index into the current lines tokens.- Returns:
- double The token (combined RGB) at the specified position on the current line.
- Throws:
java.io.IOException
-
getTokensArray
public double[] getTokensArray()
Insert the method's description here. Creation date: (17/10/2000 0.13.45)- Specified by:
getTokensArrayin interfacePatternTokenizer- Returns:
- float[]
-
mark
public void mark() throws java.io.IOExceptionMark the current position.- Specified by:
markin interfacePatternTokenizer- Throws:
IOException- if an I/O Error occurs
-
nextLine
public boolean nextLine() throws java.io.IOExceptionFetchs the next line and extracts all the tokens- Specified by:
nextLinein interfacePatternTokenizer- Returns:
- false if EOF, otherwise true
- Throws:
java.io.IOException- if an I/O Error occurs
-
resetInput
public void resetInput() throws java.io.IOExceptionGo to the last marked position. Begin of input stream if no mark detected.- Specified by:
resetInputin interfacePatternTokenizer- Throws:
java.io.IOException
-
setDecimalPoint
public void setDecimalPoint(char dp)
- Specified by:
setDecimalPointin interfacePatternTokenizer
-
getDecimalPoint
public char getDecimalPoint()
- Specified by:
getDecimalPointin interfacePatternTokenizer
-
-
DataMelt 3.0 © DataMelt by jWork.ORG