在google vision api标签检测中,不能知道对象位于何处?有什么选择或想法吗?我在示例中尝试过,然后响应json是不包含对象位置的!
发布于 2017-07-02 04:40:21
try this
import io
from google.cloud import vision
import argparse
import base64
import picamera
import json
import os
import picamera
import sys
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "provide here the json key path"
camera = picamera.PiCamera()
camera.capture('pic1.jpg')
credentials = GoogleCredentials.get_application_default()
service = discovery.build('vision', 'v1', credentials=credentials)
vision_client=vision.Client()
file_name='pic1.jpg'
with io.open(file_name,'rb') as image_file:
content=image_file.read()
image=vision_client.image(content=content)
labels = image.detect_labels()
for label in labels:
print(label.description)
`https://stackoverflow.com/questions/43383886
复制相似问题