|
Neuroph | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neuroph.contrib.imgrec.ImageSampler
public class ImageSampler
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 |
|---|
public ImageSampler()
| Method Detail |
|---|
public static java.awt.image.BufferedImage scanLocationUsingScreenshot(java.awt.Robot robot,
java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
java.awt.Dimension samplingResolution)
robot - rectangleAsDecimalPercent - samplingResolution -
public static java.awt.image.BufferedImage scanLocationUsingScreenshot(java.awt.Robot robot,
java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
java.awt.Dimension samplingResolution,
int imageType)
robot - rectangleAsDecimalPercent - samplingResolution - imageType -
public static java.awt.image.BufferedImage downSampleImage(java.awt.Dimension samplingResolution,
java.awt.image.BufferedImage bigImg)
samplingResolution - sampling resolution/image sizebigImg - image to scale
public static java.awt.image.BufferedImage downSampleImage(java.awt.Dimension samplingResolution,
java.awt.image.BufferedImage bigImg,
int returnImageType)
samplingResolution - sampling resolution/image sizebigImg - image to scalereturnImageType - type of the return image
public static java.awt.image.BufferedImage scanLocationUsingSampling(java.awt.Robot robot,
java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
java.awt.Dimension samplingResolution)
robot - an instance of java.awt.Robot for the scaned screenrectangleAsDecimalPercent - samplingResolution -
public static java.awt.image.BufferedImage scanLocationUsingSampling(java.awt.Robot robot,
java.awt.geom.Rectangle2D.Double rectangleAsDecimalPercent,
java.awt.Dimension samplingResolution,
int imageType)
robot - an instance of java.awt.Robot for the scaned screenrectangleAsDecimalPercent - samplingResolution - imageType -
|
Neuroph | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||