Documentation of 'org.joone.io.ImageInputTokenizer' Java class
ImageInputTokenizer
org.joone.io

Class 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 ImageInputTokenizer
      ImageInputTokenizer(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
      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) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageInputTokenizer

        public ImageInputTokenizer(int req_width,
                                   int req_height,
                                   java.util.Vector file_list,
                                   boolean colour)
                            throws java.io.IOException
        Creates 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.IOException
        Creates new ImageInputTokenizer
        Parameters:
        in -
        Throws:
        java.io.IOException
    • Method Detail

      • getLineno

        public int getLineno()
        Return the current line number.
        Specified by:
        getLineno in interface PatternTokenizer
        Returns:
        the current line number
      • getNumTokens

        public int getNumTokens()
                         throws java.io.IOException
        Gets the number of tokens on the current line.
        Specified by:
        getNumTokens in interface PatternTokenizer
        Throws:
        java.io.IOException
      • getTokenAt

        public double getTokenAt(int posiz)
                          throws java.io.IOException
        Gets the token (RGB normalised between 0 and 1) at the specified position.
        Specified by:
        getTokenAt in interface PatternTokenizer
        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:
        getTokensArray in interface PatternTokenizer
        Returns:
        float[]
      • mark

        public void mark()
                  throws java.io.IOException
        Mark the current position.
        Specified by:
        mark in interface PatternTokenizer
        Throws:
        IOException - if an I/O Error occurs
      • nextLine

        public boolean nextLine()
                         throws java.io.IOException
        Fetchs the next line and extracts all the tokens
        Specified by:
        nextLine in interface PatternTokenizer
        Returns:
        false if EOF, otherwise true
        Throws:
        java.io.IOException - if an I/O Error occurs
      • resetInput

        public void resetInput()
                        throws java.io.IOException
        Go to the last marked position. Begin of input stream if no mark detected.
        Specified by:
        resetInput in interface PatternTokenizer
        Throws:
        java.io.IOException

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.