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.ocr
Class OcrUtils

    java.lang.Object
      org.neuroph.contrib.ocr.OcrUtils

    public class OcrUtils

extends java.lang.Object

Contains various utility methods used for OCR.

Constructor Summary
`OcrUtils()`

Method Summary
`static java.awt.image.BufferedImage` | `blackAndGrayCleaning(java.awt.image.BufferedImage image)` This method cleans input image by replacing all pixels with RGB values from -4473925 (gray) to -1 (white) with white pixels and from -4473925 (gray) to -16777216 (black) with black pixels
`static java.awt.image.BufferedImage` | `blackAndLightGrayCleaning(java.awt.image.BufferedImage image)` This method cleans input image by replacing all pixels with RGB values from -3092272 (light gray) to -1 (white) with white pixels and from -3092272 (light gray) to -16777216 (black) with black pixels
`static java.awt.image.BufferedImage` | `blackAndWhiteCleaning(java.awt.image.BufferedImage image)` This method cleans input image by replacing all non black pixels with white pixels
`static java.awt.image.BufferedImage` | `colorCleaning(java.awt.image.BufferedImage image, int RGBcolor)` This method cleans input image by replacing all pixels with RGB values from RGBcolor input (the input color) to -1 (white) with white pixels and from RGBcolor input (the input color) to -16777216 (black) with black pixels
`static java.awt.image.BufferedImage` | `createImageFromText(java.lang.String text, java.awt.Font font)` Creates and returns image from the given text.
`static java.awt.image.BufferedImage` | `cropImage(java.awt.image.BufferedImage image, int x1, int y1, int x2, int y2)` Crops (returns subimage) of specified input image at specified points.
`static java.util.Map<java.lang.String,FractionRgbData>` | `getFractionRgbDataForImages(java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> imagesData)` Returns RGB data for all input images
`static java.awt.image.BufferedImage` | `loadAndCleanImage(java.io.File f)` This method loads the input Image and returns the cleaned version
`static java.awt.image.BufferedImage` | `loadImage(java.io.File file)` Loads image from the file.
`static java.awt.image.BufferedImage` | `resizeImage(java.awt.image.BufferedImage image, int width, int height)` Resize image to specified dimensions
`static java.awt.image.BufferedImage` | `trimImage(java.awt.image.BufferedImage imageToTrim)` This method trims the input image and returns it as a BufferedImage

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

Constructor Detail

### OcrUtils

    public OcrUtils()

Method Detail

### blackAndWhiteCleaning

    public static java.awt.image.BufferedImage blackAndWhiteCleaning(java.awt.image.BufferedImage image)

  This method cleans input image by replacing all non black pixels with white pixels

  Parameters:
    `image` - - input image that will be cleaned
  Returns:
    - cleaned input image as BufferedImage

### blackAndGrayCleaning

    public static java.awt.image.BufferedImage blackAndGrayCleaning(java.awt.image.BufferedImage image)

  This method cleans input image by replacing all pixels with RGB values from -4473925 (gray) to -1 (white) with white pixels and from -4473925 (gray) to -16777216 (black) with black pixels

  Parameters:
    `image` - - input image that will be cleaned
  Returns:
    - cleaned input image as BufferedImage

### blackAndLightGrayCleaning

    public static java.awt.image.BufferedImage blackAndLightGrayCleaning(java.awt.image.BufferedImage image)

  This method cleans input image by replacing all pixels with RGB values from -3092272 (light gray) to -1 (white) with white pixels and from -3092272 (light gray) to -16777216 (black) with black pixels

  Parameters:
    `image` - - input image that will be cleaned
  Returns:
    - cleaned input image as BufferedImage

### colorCleaning

    public static java.awt.image.BufferedImage colorCleaning(java.awt.image.BufferedImage image,
                                                             int RGBcolor)

  This method cleans input image by replacing all pixels with RGB values from RGBcolor input (the input color) to -1 (white) with white pixels and from RGBcolor input (the input color) to -16777216 (black) with black pixels

  Parameters:
    `image` - - input image that will be cleaned
    `RGBcolor` - - input RGB value of wanted color as reference for celaning
  Returns:
    - cleaned input image as BufferedImage

### loadAndCleanImage

    public static java.awt.image.BufferedImage loadAndCleanImage(java.io.File f)
                                                          throws java.io.IOException

  This method loads the input Image and returns the cleaned version

  Parameters:
    `f` - - input file that will be loaded as image
  Returns:
    - return cleaned loaded image as BufferedImage
  Throws:
    `java.io.IOException` - - if error occurs during loading

### loadImage

    public static java.awt.image.BufferedImage loadImage(java.io.File file)
                                                  throws java.io.IOException

  Loads image from the file.

  Parameters:
    `file` - image file
  Returns:
    loaded image
  Throws:
    `java.io.IOException`

### trimImage

    public static java.awt.image.BufferedImage trimImage(java.awt.image.BufferedImage imageToTrim)

  This method trims the input image and returns it as a BufferedImage

  Parameters:
    `imageToTrim` - input image that will be trimed
  Returns:
    return trimed input image as BufferedImage

### resizeImage

    public static java.awt.image.BufferedImage resizeImage(java.awt.image.BufferedImage image,
                                                           int width,
                                                           int height)

  Resize image to specified dimensions

  Parameters:
    `image` - image to resize
    `width` - new image width
    `height` - new image height
  Returns:
    resized image

### cropImage

    public static java.awt.image.BufferedImage cropImage(java.awt.image.BufferedImage image,
                                                         int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2)

  Crops (returns subimage) of specified input image at specified points.

  Parameters:
    `image` - image to crop
    `x1` - top left x coordinate
    `y1` - top left y coordinate
    `x2` - bottom right x coordinate
    `y2` - bottom right y coordinate
  Returns:
    image croped at specified points

### createImageFromText

    public static java.awt.image.BufferedImage createImageFromText(java.lang.String text,
                                                                   java.awt.Font font)

  Creates and returns image from the given text.

  Parameters:
    `text` - input text
    `font` - text font
  Returns:
    image with input text

### getFractionRgbDataForImages

    public static java.util.Map<java.lang.String,FractionRgbData> getFractionRgbDataForImages(java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> imagesData)

  Returns RGB data for all input images

  Parameters:
    `imagesData` - data map with characters as keys and charcter images as values
  Returns:
    data map with characters as keys and image rgb data as values

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