Recognition
Contents
[
Hide
]
Reading text from any content in Aspose.OCR for Java is as easy as calling a universal Recognize
method.
This method takes OcrInput
object and optional recognition settings.
Recognition results are returned as a list of RecognitionResult
objects, that allow you to perform advanced manipulations with recognition results: automatically correct spelling, get image regions and save results in various formats.
Example
The following code example shows how to extract text from multiple images:
AsposeOCR api = new AsposeOCR();
// Add images to the recognition batch
OcrInput images = new OcrInput(InputType.SingleImage);
images.add("image1.png");
images.add("image2.png");
// Recognition settings
RecognitionSettings recognitionSettings = new RecognitionSettings();
recognitionSettings.setLanguage(Language.Ukr);
// Recognize images
ArrayList<RecognitionResult> results = api.Recognize(images, recognitionSettings);
results.forEach((result) -> {
System.out.println(result.recognition_text);
});