org.joone.io
Class ImageInputSynapse

java.lang.Object
  extended by org.joone.engine.Synapse
      extended by org.joone.io.StreamInputSynapse
          extended by org.joone.io.ImageInputSynapse
All Implemented Interfaces:
java.io.Serializable, InputPatternListener, Learnable, LearnableSynapse, NeuralElement, OutputPatternListener, Inspectable, InputSynapse, PlugInListener

public class ImageInputSynapse
extends StreamInputSynapse

This synapse collects data from Image files or Image objects and feeds the data from the Images into the Neural network. GIF, JPG and PNG image file formats can be read. The synapse operates in two modes, colour and grey scale.

Colour Mode In colour mode ImageInputSynapse 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 synapse 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.

Author:
Julien Norman
See Also:
Serialized Form

Field Summary
(package private) static long serialVersionUID
           
 
Fields inherited from class org.joone.io.StreamInputSynapse
cols, currentRow, EOF, InputVector, plugInListeners, tokens
 
Fields inherited from class org.joone.engine.Synapse
array, b_pattern, bitems, bouts, count, enabled, fwdLock, inps, items, learnable, m_batch, m_pattern, myLearner, notFirstTime, notFirstTimeB, outs, revLock
 
Constructor Summary
ImageInputSynapse()
          Creates a new instance of ImageInputSynapse
 
Method Summary
protected  void calculateNewACS()
          Calculates the new value for AdvancedColumnSelector
 java.util.TreeSet check()
          Checks and returns any problems found with the settings of this synapse.
 boolean getColourMode()
           
 int getDesiredHeight()
           
 int getDesiredWidth()
           
 java.lang.String getFileFilter()
           
 java.io.File getImageDirectory()
           
protected  void initInputStream()
           
 void setColourMode(boolean ColourMode)
           
 void setDesiredHeight(int DesiredHeight)
           
 void setDesiredWidth(int DesiredWidth)
           
 void setFileFilter(java.lang.String newFileFilter)
           
 void setImageDirectory(java.io.File imgDir)
           
 void setImageInput(java.awt.Image[] theImages)
           
 
Methods inherited from class org.joone.io.StreamInputSynapse
addPlugIn, addPlugInListener, backward, dataChanged, fireDataChanged, forward, fwdGet, fwdGet, getAdvancedColumnSelector, getAllPlugInListeners, getCurrentRow, getDecimalPoint, getFirstCol, getFirstRow, getInputPatterns, getInputVector, getLastCol, getLastRow, getMaxBufSize, getPlugIn, getStream, getTokens, gotoFirstLine, gotoLine, InspectableTitle, Inspections, isBuffered, isEOF, isStepCounter, numColumns, readAll, readObjectBase, removeAllPlugIns, removePlugInListener, reset, resetInput, revPut, setAdvancedColumnSelector, setArrays, setBuffered, setColList, setDecimalPoint, setDimensions, setEOF, setFirstCol, setFirstRow, setInputPatterns, setLastCol, setLastRow, setMaxBufSize, setPlugin, setPlugIn, setStepCounter, setTokens, writeObjectBase, zeroPattern
 
Methods inherited from class org.joone.engine.Synapse
addNoise, canCountSteps, fwdPut, getFwdLock, getIgnoreBefore, getInputDimension, getLearner, getLearningRate, getMomentum, getMonitor, getName, getOutputDimension, getRevLock, getWeights, init, initLearner, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, readResolve, revGet, setEnabled, setIgnoreBefore, setInputDimension, setInputFull, setLearningRate, setLoopBack, setMomentum, setMonitor, setName, setOutputDimension, setOutputFull, setWeights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

ImageInputSynapse

public ImageInputSynapse()
Creates a new instance of ImageInputSynapse

Method Detail

setFileFilter

public void setFileFilter(java.lang.String newFileFilter)

getFileFilter

public java.lang.String getFileFilter()

setImageInput

public void setImageInput(java.awt.Image[] theImages)

initInputStream

protected void initInputStream()
                        throws JooneRuntimeException
Specified by:
initInputStream in class StreamInputSynapse
Throws:
JooneRuntimeException

getDesiredWidth

public int getDesiredWidth()

setDesiredWidth

public void setDesiredWidth(int DesiredWidth)

getDesiredHeight

public int getDesiredHeight()

setDesiredHeight

public void setDesiredHeight(int DesiredHeight)

getImageDirectory

public java.io.File getImageDirectory()

setImageDirectory

public void setImageDirectory(java.io.File imgDir)

getColourMode

public boolean getColourMode()

setColourMode

public void setColourMode(boolean ColourMode)

check

public java.util.TreeSet check()
Checks and returns any problems found with the settings of this synapse.

Specified by:
check in interface NeuralElement
Overrides:
check in class StreamInputSynapse
Returns:
A TreeSet of problems or errors found with this synapse.
See Also:
Synapse

calculateNewACS

protected void calculateNewACS()
Calculates the new value for AdvancedColumnSelector



Submit Feedback to pmarrone@users.sourceforge.net