Jun-24-2018, 02:47 AM
Hi,
I want to get to vertices of the bounding box for the texts Google Cloud Vision outputs.
Specifically
With this code, I'm able to get each line in the image.
Is there a way to get the (x,y) location of the boundary box for each of this lines?
I want to get to vertices of the bounding box for the texts Google Cloud Vision outputs.
Specifically
#import libraries from google.cloud import vision from google.cloud.vision import types from google.oauth2 import service_account # create client, class vision credentials = service_account.Credentials. from_service_account_file("api-key.json") client = vision.ImageAnnotatorClient(credentials=credentials) #Open image to be read path='/path/to/image.jpg/ with io.open(path, 'rb') as image_file: content = image_file.read() #Read image with client image = types.Image(content=content) response = client.document_text_detection(image=image) document = response.full_text_annotation #split text by \n doc=[] for line in document.text.split('\n'): doc.append(line)
With this code, I'm able to get each line in the image.
Is there a way to get the (x,y) location of the boundary box for each of this lines?