Supply multiple whitelists for single OCR operation with Aspose.OCR for Java 16.10

Aspose.OCR for Java logo We are pleased to announce that Aspose.OCR for Java 16.10 is now available for public use. The major development in this release is support for supplying multiple white lists for single OCR operation.

Supply Multiple White Lists

Aspose.OCR for Java provides the functionality to perform the OCR operation with more than one white list for a single OCR operation. Aspose.OCR for Java API has introduced a new property setWhitelist in RecognitionBlock class. With the help of this property developer can set white list for each RecognitionBlock introduced in a single OCR process. Below provided code snippet demonstrates how to process multiple RecognitionBlock with their own white list in a single OCR operation.



// Input file.
String sInputFile = "sample.jpg";

// Create an initialize an instance of OcrEngine
com.aspose.ocr.OcrEngine engine = new com.aspose.ocr.OcrEngine();

// Set the OcrEngine.Image property by loading an image from disk, memory or URL
engine.setImage(com.aspose.ocr.ImageStream.fromFile(sInputFile));

// Create text recognition block by supplying X,Y coordinates and Width,Height values
com.aspose.ocr.IRecognitionBlock block = com.aspose.ocr.RecognitionBlock.createTextBlock(6, 9, 120, 129);

// Set the Whitelist property by specifying a new block whitelist
block.setWhitelist(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });

// YOU CAN ADD MORE TEXT BLOCK AND SET WHITE LISTS.

// Set different configurations and add recognition block(s)
engine.getConfig().clearRecognitionBlocks();
engine.getConfig().addRecognitionBlock(block);
engine.getConfig().setDetectTextRegions(false);

// Call OcrEngine.Process method to perform OCR operation
if (engine.process())
{
    // Display the recognized text from each Page
    System.out.println(engine.getText());
}

Please review the release notes of Aspose.OCR for Java 16.10 for a complete view of new enhancements.

Aspose.OCR for Java Resources

The resources, you may need to accomplish your tasks:

As always, we appreciate your feedback so if you ever have anything to tell us about this release or anything else, please head to the Aspose.OCR forum for a chat.