com.aspose.ocr

Class AsposeOCR



  • public class AsposeOCR
    extends Object
    Main class for recognize text from images.
    Version:
    20.7
    Author:
    Aspose
    • Constructor Detail

      • AsposeOCR

        public AsposeOCR(String alphabet)
        Public constructor.
        Parameters:
        alphabet - Narrow alphabet for recognition.
        See Also:
        AsposeOCR()
    • Method Detail

      • CalcSkewImage

        public double CalcSkewImage(String fullPath)
                             throws IOException
        Calculates the skew angle of the text in the image.
        Parameters:
        fullPath - Path to image.
        Returns:
        Skew angle in degrees.
        Throws:
        IOException - if file not found.
      • CalcSkewImage

        public double CalcSkewImage(BufferedImage image)
                             throws IOException
        Calculates the skew angle of the text in the image.
        Parameters:
        image - BufferedImage instance.
        Returns:
        Skew angle in degrees.
        Throws:
        IOException - if file not found.
      • getTextAreas

        public ArrayList<Rectangle> getTextAreas()
        Returns:
        ArrayList of rectangles with text areas on the page (in pixels).
      • RecognizePage

        public String RecognizePage(String fullPath)
                             throws IOException
        Recognizing image with automatic detection of text areas and detecting, correct skew of the text. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        fullPath - Path to image.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizePage

        public String RecognizePage(String fullPath,
                                    boolean autoSkew)
                             throws IOException
        Recognizing image with automatic detection of text areas. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        fullPath - Path to image.
        autoSkew - Auto-skew text.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizePage

        public String RecognizePage(BufferedImage image)
                             throws IOException
        Recognizing image with automatic detection of text areas and detecting, correct skew of the text. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        image - Source BufferedImage.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizePage

        public String RecognizePage(BufferedImage image,
                                    boolean autoSkew)
                             throws IOException
        Recognizing image with automatic detection of text areas. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        image - BufferedImage instance.
        autoSkew - Auto-skew text.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizePage

        public String RecognizePage(String fullPath,
                                    ArrayList<Rectangle> boxes_)
                             throws IOException
        Recognizing text in a specified rectangles. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        fullPath - Path to image.
        boxes_ - List of rectangles.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizePage

        public String RecognizePage(BufferedImage image_,
                                    ArrayList<Rectangle> boxes_)
                             throws IOException
        Recognizing text in a specified rectangles. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        image_ - BufferedImage instance.
        boxes_ - List of rectangle.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizePage

        public String RecognizePage(String fullPath,
                                    Rectangle box)
                             throws IOException
        Recognizing text in a specified rectangle. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        fullPath - Path to image.
        box - Rectangle for recognize.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizePage

        public String RecognizePage(BufferedImage image_,
                                    Rectangle box)
                             throws IOException
        Recognizing text in a specified rectangle. Support for GIF, PNG, JPEG, BMP, and WBMP.
        Parameters:
        image_ - BufferedImage instance.
        box - Rectangle for recognize.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizeLine

        public String RecognizeLine(String fullPath)
                             throws IOException
        Recognizing a image that contains only one line of text. Support for GIF, PNG, JPEG, BMP, and WBMP. Skew alignment does not occur.
        Parameters:
        fullPath - Path to image.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.
      • RecognizeLine

        public String RecognizeLine(BufferedImage image_)
                             throws IOException
        Recognizing a image that contains only one line of text. Support for GIF, PNG, JPEG, BMP, and WBMP. Skew alignment does not occur.
        Parameters:
        image_ - BufferedImage instance.
        Returns:
        Recognized text.
        Throws:
        IOException - if file not found.