Detects text in the file located in Google Cloud Storage or on the Web.
vision_client = vision.Client()
image = vision_client.image(source_uri=uri)
texts = image.detect_text()
print("Texts:")
for text in texts:
print("\n"{}"".format(text.description))
vertices = (["({},{})".format(bound.x_coordinate, bound.y_coordinate)
for bound in text.bounds.vertices])
print("bounds: {}".format(",".join(vertices)))
After Change
Detects text in the file located in Google Cloud Storage or on the Web.
client = vision.ImageAnnotatorClient()
image = types.Image()image.source.image_uri = uri
response = client.text_detection(image=image)
texts = response.text_annotations
print("Texts:")
for text in texts:
print("\n"{}"".format(text.description))
vertices = (["({},{})".format(vertex.x, vertex.y)
for vertex in text.bounding_poly.vertices])
print("bounds: {}".format(",".join(vertices)))
// [END def_detect_text_uri]