com.aspose.ocr

Interface IRecognizedTextPartInfo

  • All Superinterfaces:
    IRecognizedPartInfo


    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);
       }
     }
     

    • Method Summary

      Methods 
      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
    • Method Detail

      • getBackgroundColor

        Color getBackgroundColor()
        Gets the color of background this part.
      • getCharactersBox

        Rectangle[] getCharactersBox()
        Gets an array of rectangles. Size of the array is equal to size of Text (how many letters in part). Each rectangle indicates the area of character. Coordinates starts with the upper left corner of the picture.
      • getCharactersQuality

        float[] getCharactersQuality()
        Gets an array of values specified for some recognition of this character. Size of the array is equal to size of Text (how many letters in part). Each array element can be from 0.0 to 1.0 inclusive. Value 0.0 means that the poorly recognized, 1.0 means that perfectly recognized.
      • getChildren

        IRecognizedTextPartInfo[] getChildren()
        Array of lower level text part (e.g. words for text line, or characters for word) IRecognizedTextPartInfo firstBlock = ((IRecognizedTextPartInfo)ocr.getText().getPartsInfo(0)); IRecognizedPartInfo[] linesOfFirstBlock = firstBlock.getChildren();
      • getItalic

        boolean getItalic()
        Gets a value that indicates whether this part is italic.
      • getLanguage

        String getLanguage()
        Gets the language of this part.
      • getLevel

        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
      • getText

        String getText()
        Gets the text of this part.
      • getTextColor

        Color getTextColor()
        Gets a color of text this part.
      • isTrimmed

        boolean isTrimmed()
        Indicates whether recognition result was trimmed due to evaluation restrictions