0

I am using the Google Cloud Vision Python API for performing OCR, in order to extract info from a document, like an ID proof. Is there a way to crop the image in such a way that only the part with concentrated text is retained? I tried using cropHint but it simply eliminates the borders.

The function in my code is somewhat like:

def detect_text(path):

    """Detects text in the file."""

    vision_client = vision.Client()

    with io.open(path, 'rb') as image_file:
        content = image_file.read()

    image = vision_client.image(content=content)

    texts = image.detect_text()

1 Answers1

1

You will have to walk through the response and process the bounding boxes' coordinates. See this page for some examples of the API response.

dizcology
  • 170
  • 7