Since google vision has some restrictions on input image size, I want to first resize input image and then use the detect_labels()
function.
Here's their sample code
def detect_labels(path):
"""Detects labels 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)
labels = image.detect_labels()
print('Labels:')
for label in labels:
print(label.description)
they use io
to open the image file. I wonder in this way, how to resize the image in memory and then call detect_labels()
?