Documentation of 'org.neuroph.imgrec.ImageUtilities' Java class
ImageUtilities
org.neuroph.imgrec

Class ImageUtilities



  • public class ImageUtilities
    extends java.lang.Object
    Contains various utility methods used for OCR.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ImageUtilities() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      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 TODO: some should be used here
      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 int colorToRGB(int alpha, int red, int green, int blue) 
      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 file)
      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 Image resizeImage(Image image, int width, int height) 
      static void save(java.awt.image.BufferedImage image, java.lang.String filename, java.lang.String type) 
      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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageUtilities

        public ImageUtilities()
    • 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 TODO: some should be used here
        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 file)
        This method loads the input Image and returns the cleaned version
        Parameters:
        file - - input file that will be loaded as image
        Returns:
        - return cleaned loaded image as BufferedImage
      • loadImage

        public static java.awt.image.BufferedImage loadImage(java.io.File file)
        Loads image from the file.
        Parameters:
        file - image file
        Returns:
        loaded image
      • save

        public static void save(java.awt.image.BufferedImage image,
                                java.lang.String filename,
                                java.lang.String type)
      • 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
      • resizeImage

        public static Image resizeImage(Image image,
                                        int width,
                                        int height)
      • 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
      • 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
      • colorToRGB

        public static int colorToRGB(int alpha,
                                     int red,
                                     int green,
                                     int blue)

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.