This directory contains samples for Google Cloud Vision API. Google Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.
- See the migration guide for information about migrating to Python client library v0.25.1.
This sample requires you to have authentication setup. Refer to the Authentication Getting Started Guide for instructions on setting up credentials for applications.
- Install pip and virtualenv if you do not already have them. You may want to refer to the Python Development Environment Setup Guide for Google Cloud Platform for instructions.
Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
$ virtualenv env $ source env/bin/activateInstall the dependencies needed to run the samples.
$ pip install -r requirements.txt
To run this sample:
$ python detect.py
usage: detect.py [-h]
{faces,faces-uri,labels,labels-uri,landmarks,landmarks-uri,text,text-uri,logos,logos-uri,safe-search,safe-search-uri,properties,properties-uri,web,web-uri,crophints,crophints-uri,document,document-uri}
...
This application demonstrates how to perform basic operations with the
Google Cloud Vision API.
Example Usage:
python detect.py text ./resources/wakeupcat.jpg
python detect.py labels ./resources/landmark.jpg
python detect.py web ./resources/landmark.jpg
python detect.py web-uri http://wheresgus.com/dog.JPG
python detect.py faces-uri gs://your-bucket/file.jpg
For more information, the documentation at
https://cloud.google.com/vision/docs.
positional arguments:
{faces,faces-uri,labels,labels-uri,landmarks,landmarks-uri,text,text-uri,logos,logos-uri,safe-search,safe-search-uri,properties,properties-uri,web,web-uri,crophints,crophints-uri,document,document-uri}
faces Detects faces in an image.
faces-uri Detects faces in the file located in Google Cloud
Storage or the web.
labels Detects labels in the file.
labels-uri Detects labels in the file located in Google Cloud
Storage or on the Web.
landmarks Detects landmarks in the file.
landmarks-uri Detects landmarks in the file located in Google Cloud
Storage or on the Web.
text Detects text in the file.
text-uri Detects text in the file located in Google Cloud
Storage or on the Web.
logos Detects logos in the file.
logos-uri Detects logos in the file located in Google Cloud
Storage or on the Web.
safe-search Detects unsafe features in the file.
safe-search-uri Detects unsafe features in the file located in Google
Cloud Storage or on the Web.
properties Detects image properties in the file.
properties-uri Detects image properties in the file located in Google
Cloud Storage or on the Web.
web Detects web annotations given an image.
web-uri Detects web annotations in the file located in Google
Cloud Storage.
crophints Detects crop hints in an image.
crophints-uri Detects crop hints in the file located in Google Cloud
Storage.
document Detects document features in an image.
document-uri Detects document features in the file located in
Google Cloud Storage.
optional arguments:
-h, --help show this help message and exitThis sample uses the Google Cloud Client Library for Python. You can read the documentation for more details on API usage and use GitHub to browse the source and report issues.