in google vision api label detection, can't know where object located ? any options or idea ?? I have tried in sample, and then response json is does not include object position!
Asked
Active
Viewed 924 times
0
-
Possible duplicate of [How to get a position of custom object on image using vision recognition api](http://stackoverflow.com/questions/38634409/how-to-get-a-position-of-custom-object-on-image-using-vision-recognition-api) – Nakilon Apr 16 '17 at 15:55
1 Answers
-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)
`

Khuram Rehman
- 1
- 2
-
You should explain your code only answer. Code only answers are often downvoted and may even be deleted. Thank you. – Bugs Jul 01 '17 at 21:03