Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neuroph.contrib.imgrec
Class ImageSampler

    java.lang.Object
      org.neuroph.contrib.imgrec.ImageSampler

    public class ImageSampler

extends java.lang.Object

This class uses a given Robot object to sample images from the screen at an arbitrary sampling resolution. The coordinates of the scanning rectangle is (x, y) expressed as a fraction of the screen resolution, with the width also being a fraction. For example, when the screen is 800x600 resolution, to scan a rectangle with xy coordinates (400,300) to xy (600, 400), use the following rectangle as an argument: new Rectangle2D.Double(0.5, 0.5, 0.25, 0.16667) Scanning using sampling is faster than scanning using a screenshot, but is prone to introduce tearing and shearing into the scanned image. Scanning from a screenshot has no tearing or shearing at the cost of speed. Also provides method for downsampling (scaling) image. This class is based on the code from tileclassification by Jon Tait.

Constructor Summary
`ImageSampler()`

Method Summary
`static java.awt.image.BufferedImage` | `downSampleImage(java.awt.Dimension samplingResolution, java.awt.image.BufferedImage bigImg)` Scales image to the specified dimension
`static java.awt.image.BufferedImage` | `downSampleImage(java.awt.Dimension samplingResolution, java.awt.image.BufferedImage bigImg, int returnImageType)` Scales image to the specified dimension
`static java.awt.image.BufferedImage` | `scanLocationUsingSampling(java.awt.Robot robot, java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent, java.awt.Dimension samplingResolution)` Scans screen location using sampling
`static java.awt.image.BufferedImage` | `scanLocationUsingSampling(java.awt.Robot robot, java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent, java.awt.Dimension samplingResolution, int imageType)` Scans screen location using sampling
`static java.awt.image.BufferedImage` | `scanLocationUsingScreenshot(java.awt.Robot robot, java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent, java.awt.Dimension samplingResolution)` Scans screen location using screenshot
`static java.awt.image.BufferedImage` | `scanLocationUsingScreenshot(java.awt.Robot robot, java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent, java.awt.Dimension samplingResolution, int imageType)` Scans screen location using screenshot

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ImageSampler

    public ImageSampler()

Method Detail

### scanLocationUsingScreenshot

    public static java.awt.image.BufferedImage scanLocationUsingScreenshot(java.awt.Robot robot,
                                                                           java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
                                                                           java.awt.Dimension samplingResolution)

  Scans screen location using screenshot

  Parameters:
    `robot` -
    `rectangleAsDecimalPercent` -
    `samplingResolution` -
  Returns:
    image sample from the specified location

### scanLocationUsingScreenshot

    public static java.awt.image.BufferedImage scanLocationUsingScreenshot(java.awt.Robot robot,
                                                                           java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
                                                                           java.awt.Dimension samplingResolution,
                                                                           int imageType)

  Scans screen location using screenshot

  Parameters:
    `robot` -
    `rectangleAsDecimalPercent` -
    `samplingResolution` -
    `imageType` -
  Returns:
    image sample from the specified location

### downSampleImage

    public static java.awt.image.BufferedImage downSampleImage(java.awt.Dimension samplingResolution,
                                                               java.awt.image.BufferedImage bigImg)

  Scales image to the specified dimension

  Parameters:
    `samplingResolution` - sampling resolution/image size
    `bigImg` - image to scale
  Returns:
    image scaled/downsampled to the specified dimension/resolution

### downSampleImage

    public static java.awt.image.BufferedImage downSampleImage(java.awt.Dimension samplingResolution,
                                                               java.awt.image.BufferedImage bigImg,
                                                               int returnImageType)

  Scales image to the specified dimension

  Parameters:
    `samplingResolution` - sampling resolution/image size
    `bigImg` - image to scale
    `returnImageType` - type of the return image
  Returns:
    image scaled/downsampled to the specified dimension/resolution

### scanLocationUsingSampling

    public static java.awt.image.BufferedImage scanLocationUsingSampling(java.awt.Robot robot,
                                                                         java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
                                                                         java.awt.Dimension samplingResolution)

  Scans screen location using sampling

  Parameters:
    `robot` - an instance of java.awt.Robot for the scaned screen
    `rectangleAsDecimalPercent` -
    `samplingResolution` -
  Returns:
    image sample from the specified location

### scanLocationUsingSampling

    public static java.awt.image.BufferedImage scanLocationUsingSampling(java.awt.Robot robot,
                                                                         java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
                                                                         java.awt.Dimension samplingResolution,
                                                                         int imageType)

  Scans screen location using sampling

  Parameters:
    `robot` - an instance of java.awt.Robot for the scaned screen
    `rectangleAsDecimalPercent` -
    `samplingResolution` -
    `imageType` -
  Returns:
    image sample from the specified location

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD