我知道Google Vision API支持多种语言的文本检测。通过以下代码,我可以从图像中检测出英语语言。但是根据Google的说法,我可以使用语言提示参数来检测其他语言。那么我应该在以下代码中的哪里放置此参数呢?
def detect_text(path):
"""Detects text in the file."""
from google.cloud import vision
imageContext = 'bn'
client = vision.ImageAnnotatorClient(imageContext)
with io.open(path, 'rb') as image_file:
content = image_file.read()
image = vision.types.Image(content=content)
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)))
detect_text('Outline-of-the-Bangladesh-license-plates_Q320.jpg')