org.neuroph.contrib.imgrec
Class ImageRecognitionPlugin

java.lang.Object
  extended by org.neuroph.util.plugins.PluginBase
      extended by org.neuroph.contrib.imgrec.ImageRecognitionPlugin
All Implemented Interfaces:
java.io.Serializable

public class ImageRecognitionPlugin
extends PluginBase
implements java.io.Serializable

Provides image recognition specific properties like sampling resolution, and easy to use image recognition interface for neural network.

Author:
Jon Tait, Zoran Sevarac
See Also:
Serialized Form

Field Summary
static java.lang.String IMG_REC_PLUGIN_NAME
           
 
Constructor Summary
ImageRecognitionPlugin(java.awt.Dimension samplingResolution)
          Constructor
ImageRecognitionPlugin(java.awt.Dimension samplingResolution, ColorMode colorMode)
          Constructor
 
Method Summary
 ColorMode getColorMode()
          Returns color mode used for image recognition
 java.util.HashMap<java.lang.String,Neuron> getMaxOutput()
          Returns one or more image labels with the maximum output - recognized images
 java.util.HashMap<java.lang.String,java.lang.Double> getOutput()
          Returns image recognition result as map with image labels as keys and recogition result as value
 java.awt.Dimension getSamplingResolution()
          Returns image sampling resolution (dimensions)
 void processInput()
           
 java.util.HashMap<java.lang.String,java.lang.Double> recognizeImage(java.awt.image.BufferedImage img)
          This method performs the image recognition for specified image.
 java.util.HashMap<java.lang.String,java.lang.Double> recognizeImage(java.io.File imgFile)
          This method performs the image recognition for specified image file.
 java.util.HashMap<java.lang.String,java.lang.Double> recognizeImage(java.net.URL imgURL)
          This method performs the image recognition for specified image URL.
 void setInput(java.awt.image.BufferedImage img)
          Sets network input (image to recognize) from the specified BufferedImage object
 void setInput(java.io.File imgFile)
          Sets network input (image to recognize) from the specified File object
 void setInput(java.net.URL imgURL)
          Sets network input (image to recognize) from the specified URL object
 
Methods inherited from class org.neuroph.util.plugins.PluginBase
getName, getParentNetwork, setParentNetwork
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMG_REC_PLUGIN_NAME

public static final java.lang.String IMG_REC_PLUGIN_NAME
See Also:
Constant Field Values
Constructor Detail

ImageRecognitionPlugin

public ImageRecognitionPlugin(java.awt.Dimension samplingResolution)
Constructor

Parameters:
samplingResolution - image sampling resolution (dimensions)

ImageRecognitionPlugin

public ImageRecognitionPlugin(java.awt.Dimension samplingResolution,
                              ColorMode colorMode)
Constructor

Parameters:
samplingResolution - image sampling resolution (dimensions)
colorMode - recognition color mode
Method Detail

getSamplingResolution

public java.awt.Dimension getSamplingResolution()
Returns image sampling resolution (dimensions)

Returns:
image sampling resolution (dimensions)

getColorMode

public ColorMode getColorMode()
Returns color mode used for image recognition

Returns:
color mode used for image recognition

setInput

public void setInput(java.awt.image.BufferedImage img)
Sets network input (image to recognize) from the specified BufferedImage object

Parameters:
img - image to recognize

setInput

public void setInput(java.io.File imgFile)
              throws java.io.IOException
Sets network input (image to recognize) from the specified File object

Parameters:
imgFile - file of the image to recognize
Throws:
java.io.IOException

setInput

public void setInput(java.net.URL imgURL)
              throws java.io.IOException
Sets network input (image to recognize) from the specified URL object

Parameters:
imgURL - url of the image
Throws:
java.io.IOException

processInput

public void processInput()

getOutput

public java.util.HashMap<java.lang.String,java.lang.Double> getOutput()
Returns image recognition result as map with image labels as keys and recogition result as value

Returns:
image recognition result

recognizeImage

public java.util.HashMap<java.lang.String,java.lang.Double> recognizeImage(java.awt.image.BufferedImage img)
This method performs the image recognition for specified image. Returns image recognition result as map with image labels as keys and recogition result as value

Returns:
image recognition result

recognizeImage

public java.util.HashMap<java.lang.String,java.lang.Double> recognizeImage(java.io.File imgFile)
                                                                    throws java.io.IOException
This method performs the image recognition for specified image file. Returns image recognition result as map with image labels as keys and recogition result as value

Returns:
image recognition result
Throws:
java.io.IOException

recognizeImage

public java.util.HashMap<java.lang.String,java.lang.Double> recognizeImage(java.net.URL imgURL)
                                                                    throws java.io.IOException
This method performs the image recognition for specified image URL. Returns image recognition result as map with image labels as keys and recogition result as value

Returns:
image recognition result
Throws:
java.io.IOException

getMaxOutput

public java.util.HashMap<java.lang.String,Neuron> getMaxOutput()
Returns one or more image labels with the maximum output - recognized images

Returns:
one or more image labels with the maximum output