【问题标题】:Google vision API label detection谷歌视觉 API 标签检测
【发布时间】:2017-09-09 01:57:06
【问题描述】:

在google vision api label detection中,不知道物体在哪里?任何选择或想法? 我已经在示例中尝试过,然后响应 json 不包含对象位置!

【问题讨论】:

标签: vision google-cloud-vision vision-api


【解决方案1】:
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)

`

【讨论】:

  • 你应该解释你的代码唯一答案。仅代码的答案通常被否决,甚至可能被删除。谢谢。
猜你喜欢
  • 1970-01-01
  • 2019-12-18
  • 2017-02-04
  • 1970-01-01
  • 1970-01-01
  • 2017-06-14
  • 2019-10-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多