0

I'm using the tesserocr library to perform OCR on an image. Some of the words in the image are vertical, and some are horizontal. Is there any way to tell the orientation of the words in the image on a per-word basis from this library? I want something like

with PyTessBaseAPI() as api:
    api.SetImage(image)
    api.Recognize()
    ri = api.GetIterator()
    level = RIL.WORD
    word_boxes = api.GetComponentImages(RIL.TEXTLINE, True)
    box_info = api.GetWords()
    for r in iterate_level(ri, level):
        # TODO: somehow get orientation here
        word = r.GetUTF8Text(level)
        print(r.orientation())
rma
  • 1,853
  • 1
  • 22
  • 42
  • Please provide testing image. – user898678 Mar 09 '20 at 08:41
  • Any image with text will work, but here's one https://images-na.ssl-images-amazon.com/images/I/41P2LiT56sL._AC_.jpg – rma Mar 09 '20 at 16:48
  • image you provided does not fit to description you provided (_Some of the words in the image are vertical, and some are horizontal_) – user898678 Mar 10 '20 at 18:47
  • The problem that I am trying to solve is irrelevant to the actual orientation of the words in the image. I'm simply trying to return a floating point number for the orientation of each word. I don't care if that floating point is 0 or 90. Here is one with horizontal and vertical text. https://wwwimages.adobe.com/content/dam/Adobe/en/devnet/flash/articles/page_layouts_tlf/fig02.jpg – rma Mar 10 '20 at 20:11

0 Answers0