public interface IRecognitionBlock
This interface represents a block.
Block can be a rectangular region, can be some page or rectangular region of some page, etc. Necessary, before recognition user need to set all blocks and then recognize and get the recognition result for each block separately. Engine will recognize whole image, if do not specify the block. Each block has a unique ID. Can get ID after create the block.
OcrEngine ocr = new OcrEngine(); ocr.setImage(ImageStream.fromFile(@"image.tiff")); ocr.getLanguages().addLanguage(Language.Load("english")); IRecognitionBlock rectangleRecognitionBlock = RecognitionBlock.fromRectangle(0, 0, 100, 200); // mark that rectangleRecognitionBlock.BlockId is rectangle (0, 0, 100, 200) ocr.addRecognitionBlock(rectangleRecognitionBlock); IRecognitionBlock pageRecognitionBlock = RecognitionBlock.fromPageBlock(4); // mark that pageRecognitionBlock.BlockId is page (4) ocr.addRecognitionBlock(pageRecognitionBlock); if (ocr.Process()) { } System.out.println(rectangleRecognitionBlock.Text); System.out.println(pageRecognitionBlock.Text);
Modifier and Type | Method and Description |
---|---|
java.util.UUID |
getBlockId()
Returns the block's ID.
|
IRecognizedText |
getText()
Returns the recognized text.
|
java.util.UUID getBlockId()
IRecognizedText getText()