How to extract texts from customized blocks in a image using Google Vision API(OCR)?

654 views Asked by At
  • when we use Google vision's DOCUMENT_TEXT_DETECTION for a image, it decides what are the blocks in the image and what texts are in each block
  • Here I want to get the text for the blocks which are defined by me(already have a model to identify different blocks in a image).
  • Simply I want the texts within blocks defined by me but the defined by Google vision.
  • How I can achieve this?
2

There are 2 answers

3
Vidu VDS On

For now, I decided to filter symbols for given block's vertices. It is better, if there is a way to simply find intersected symbols. For, now I'm going to loop through every symbol.

0
Vidu VDS On

I found a better way to do this. First I merge each block vertically and between every block it is possible to include textual separator. It mean after every block there is a line of text. So then we can provide this image with merged blocks as the input for Google vision API. Is the response we can get full text for our input and we also have the text that we previously set between the blocks. So we can split the whole text using that. Then we can have block-wise text