public class AsposeOCR extends Object
Constructor and Description |
---|
AsposeOCR()
Public constructor.
|
AsposeOCR(String alphabet)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
CalcSkewImage(BufferedImage image)
Calculates the skew angle of an image.
|
double |
CalcSkewImage(String fullPath)
Calculates the skew angle of an image.
|
double |
CalcSkewImageFromUri(String uri)
Calculates the skew angle of an image provided by URI link.
|
String |
CorrectSpelling(String text,
SpellCheckLanguage language)
Corrects text (replaces misspelled words).
|
String |
CorrectSpelling(String text,
SpellCheckLanguage language,
String dictionaryPath)
Corrects text (replaces misspelled words).
|
ArrayList<Rectangle> |
getTextAreas(BufferedImage image_,
AreasType areasType,
boolean isDetectAreas)
Detects text areas on image.
|
ArrayList<Rectangle> |
getTextAreas(String fullPath,
AreasType areasType,
boolean isDetectAreas)
Detects text areas on image.
|
BufferedImage |
PreprocessImage(BufferedImage image,
PreprocessingFilter filters)
Use image preprocessing to improve the accuracy of OCR.
|
BufferedImage |
PreprocessImage(String fullPath,
PreprocessingFilter filters)
Use image preprocessing to improve the accuracy of OCR.
|
String |
RecognizeLine(BufferedImage image_)
Recognizes image that contains single line of text.
|
String |
RecognizeLine(String fullPath)
Recognizes image that contains single line of text.
|
ArrayList<RecognitionResult> |
RecognizeMultiplePages(ArrayList<String> files,
RecognitionSettings settings)
Recognizes multiple images from ArrayList.
|
ArrayList<RecognitionResult> |
RecognizeMultiplePages(String path,
RecognitionSettings settings)
Recognizes multiple images packed in ZIP archive or from folder.
|
String |
RecognizePage(BufferedImage image)
Recognizes text on image.
|
String |
RecognizePage(BufferedImage image_,
ArrayList<Rectangle> boxes_)
Recognizes text on image.
|
String |
RecognizePage(BufferedImage image,
boolean autoSkew)
Recognizing image with automatic detection of text areas and ability to
disable image skew correction.
|
RecognitionResult |
RecognizePage(BufferedImage image_,
RecognitionSettings settings)
Recognizes image with the ability to specify
|
String |
RecognizePage(String fullPath)
Recognizes text on image.
|
String |
RecognizePage(String fullPath,
ArrayList<Rectangle> boxes_)
Recognizes text on image.
|
String |
RecognizePage(String fullPath,
boolean autoSkew)
Recognizing image with automatic detection of text areas and ability to
disable image skew correction.
|
RecognitionResult |
RecognizePage(String fullPath,
RecognitionSettings settings)
Recognizes image with the ability to specify
|
String |
RecognizePageFast(String fullPath)
Recognizes text on good quality image.
|
String |
RecognizePageFromUri(String uri)
Recognizes text on image provided by URI link.
|
RecognitionResult |
RecognizePageFromUri(String uri,
RecognitionSettings settings)
Recognizes text on image provided by URI link.
|
ArrayList<RecognitionResult> |
RecognizeTiff(String fullPath,
DocumentRecognitionSettings settings)
Recognize text on TIFF encoded images
with image skew correction and text areas detection enable in setting by default.
|
static void |
SaveMultipageDocument(String fullFileName,
Format saveFormat,
ArrayList<RecognitionResult> results)
Allows to get multipage document from list of RecognitionResult objects.
|
public AsposeOCR()
AsposeOCR(String)
public AsposeOCR(String alphabet)
alphabet
- Narrow alphabet for recognition.AsposeOCR()
public double CalcSkewImage(String fullPath) throws IOException
fullPath
- Path to image.IOException
- if file not found.public double CalcSkewImage(BufferedImage image) throws IOException
image
- BufferedImage instance.IOException
- if file not found.public double CalcSkewImageFromUri(String uri) throws IOException
uri
- URI link to the image.IOException
- if file not found.public BufferedImage PreprocessImage(String fullPath, PreprocessingFilter filters)
fullPath
- Full path to the image.filters
- Image optimization filters @see PreprocessingFilter
public BufferedImage PreprocessImage(BufferedImage image, PreprocessingFilter filters)
image
- Source BufferedImage.filters
- Image optimization filters @see PreprocessingFilter
public ArrayList<RecognitionResult> RecognizeTiff(String fullPath, DocumentRecognitionSettings settings) throws Exception
fullPath
- fullPath Path to TIFF image.settings
- Recognition settings.Exception
- Exception if file not found or TIFF image compression is not supported.public String RecognizePageFast(String fullPath) throws IOException
fullPath
- Path to image.IOException
- if file not found.public String RecognizePage(String fullPath) throws IOException
fullPath
- Path to image.IOException
- if file not found.public String RecognizePage(String fullPath, boolean autoSkew) throws IOException
fullPath
- Path to the image.autoSkew
- Enable automatic image skew correction.IOException
- if file not found.public String RecognizePage(String fullPath, ArrayList<Rectangle> boxes_) throws IOException
fullPath
- Path to image.boxes_
- List of areas to recognize.IOException
- if file not found.public RecognitionResult RecognizePage(String fullPath, RecognitionSettings settings) throws IOException
fullPath
- Path to image.settings
- Recognition settings.IOException
- if file not found.Support for GIF, PNG, JPEG, BMP
and WBMP.
,
RecognitionResult.RecognitionResult()
public String RecognizeLine(String fullPath) throws IOException
fullPath
- Path to the image.IOException
- if file not found.public String RecognizePage(BufferedImage image) throws IOException
image
- Source BufferedImage.IOException
- if file not found.public String RecognizePage(BufferedImage image, boolean autoSkew) throws IOException
image
- BufferedImage instance.autoSkew
- Enable automatic image skew correction.IOException
- if file not found.public String RecognizePage(BufferedImage image_, ArrayList<Rectangle> boxes_) throws IOException
image_
- BufferedImage instance.boxes_
- List of areas to recognize.IOException
- if file not found.public RecognitionResult RecognizePage(BufferedImage image_, RecognitionSettings settings) throws IOException
image_
- BufferedImage instance.settings
- Recognition settings.IOException
- if file not found.Support for GIF, PNG, JPEG, BMP
and WBMP.
,
RecognitionResult.RecognitionResult()
public String RecognizeLine(BufferedImage image_)
image_
- BufferedImage instance.public ArrayList<RecognitionResult> RecognizeMultiplePages(String path, RecognitionSettings settings) throws IOException
path
- Full path to the zip archive (including .zip extension) or to
the folder with images.settings
- Recognition settings.IOException
- if file not found.RecognitionSettings.RecognitionSettings(com.aspose.ocr.DocumentRecognitionSettings)
public ArrayList<RecognitionResult> RecognizeMultiplePages(ArrayList<String> files, RecognitionSettings settings) throws IOException
files
- Full paths to the images.settings
- Recognition settings.IOException
- if file not found.RecognitionSettings.RecognitionSettings(com.aspose.ocr.DocumentRecognitionSettings)
public String RecognizePageFromUri(String uri) throws IOException
uri
- URI link to the image.IOException
- uri is incorrectpublic RecognitionResult RecognizePageFromUri(String uri, RecognitionSettings settings) throws IOException
uri
- URI link to the image.settings
- RecognizeSettingsIOException
- if file not found.RecognitionSettings.RecognitionSettings(com.aspose.ocr.DocumentRecognitionSettings)
public ArrayList<Rectangle> getTextAreas(String fullPath, AreasType areasType, boolean isDetectAreas) throws IOException
fullPath
- Path to the image.areasType
- Determinate which rectangles to return - line or paragraphs.isDetectAreas
- Enable automatic text areas detection.IOException
- if file not foundpublic ArrayList<Rectangle> getTextAreas(BufferedImage image_, AreasType areasType, boolean isDetectAreas) throws IOException
image_
- BufferedImage instance.areasType
- Determinate which rectangles to return - line or paragraphs.isDetectAreas
- Enable automatic text areas detection.IOException
- if file not foundpublic static void SaveMultipageDocument(String fullFileName, Format saveFormat, ArrayList<RecognitionResult> results)
fullFileName
- Filename with a path for saving recognition result in the selected format.saveFormat
- Document format (Docx, Txt, Pdf).results
- List of RecognitionResult
. objects.public String CorrectSpelling(String text, SpellCheckLanguage language)
text
- Text for correction.language
- Dictionary to use
SpellCheckLanguage
.public String CorrectSpelling(String text, SpellCheckLanguage language, String dictionaryPath)
text
- Text for correction.language
- Dictionary to use
SpellCheckLanguage
.dictionaryPath
- Full path to the user dictionary (frequency dictionary).
Dictionary file format:
Plain text file in UTF-8 encoding.
Word and Word Frequency are separated by comma, the word is expected in the first column and the frequency in the second column.
Every word-frequency-pair in a separate line.A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r"),
or a carriage return immediately followed by a line feed("\r\n").
Every word is expected to be in lower case.