public interface IRecognizedTextPartInfo extends IRecognizedPartInfo
This interface presents information about each part of the recognized text.
Part of text seems one part, that has all the same characteristics (style, color, etc.). It is divided by the words into parts, if have large text that has the same style.
OcrEngine ocr = new OcrEngine(); ocr.setImage(ImageStream.fromFile("image.tiff")); for(IRecognizedPartInfo recognizedPartInfo : ocr.getText().getPartssInfo()) { if (recognizedPartInfo instanceof IRecognizedTextPartInfo) { IRecognizedTextPartInfo recognizedBlockInfo = (IRecognizedTextPartInfo)recognizedPartInfo; String text = recognizedBlockInfo.getText(); if (recognizedBlockInfo.getBold()) text = text; if (recognizedBlockInfo.getItalic()) text = text; System.out.println(text); } }
Modifier and Type | Method and Description |
---|---|
Color |
getBackgroundColor()
Gets the color of background this part.
|
Rectangle[] |
getCharactersBox()
Gets an array of rectangles.
|
float[] |
getCharactersQuality()
Gets an array of values specified for some recognition of this character.
|
IRecognizedTextPartInfo[] |
getChildren()
Array of lower level text part
(e.g.
|
boolean |
getItalic()
Gets a value that indicates whether this part is italic.
|
String |
getLanguage()
Gets the language of this part.
|
int |
getLevel()
Shows hierarchical level of text part
IRecognizedPartInfo recognizedPartInfo = ocr.getText().getPartsInfo()[0];
IRecognizedTextPartInfo firstLine = ((IRecognizedTextPartInfo)recognizedPartInfo).getChildren()[0];
System.out.println(firstLine.getLevel()); // will be TextPartLevel.Line
|
String |
getText()
Gets the text of this part.
|
Color |
getTextColor()
Gets a color of text this part.
|
boolean |
isTrimmed()
Indicates whether recognition result was trimmed due to evaluation restrictions
|
getBox
Color getBackgroundColor()
Rectangle[] getCharactersBox()
float[] getCharactersQuality()
IRecognizedTextPartInfo[] getChildren()
IRecognizedTextPartInfo firstBlock = ((IRecognizedTextPartInfo)ocr.getText().getPartsInfo(0));
IRecognizedPartInfo[] linesOfFirstBlock = firstBlock.getChildren();
boolean getItalic()
String getLanguage()
int getLevel()
String getText()
Color getTextColor()
boolean isTrimmed()
Copyright © 2017. All Rights Reserved.