Skip to content

Latest commit

 

History

History
 
 

vision

Google Cloud Platform logo

Google Cloud Vision API Node.js Samples

The 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.

Table of Contents

Setup

  1. Read Prerequisites and How to run a sample first.

  2. Install dependencies:

     npm install
    

Samples

Face detection

View the documentation or the source code.

This sample uses node-canvas to draw an output image. node-canvas depends on Cairo, which may require separate installation. See the node-canvas installation section for details.

Run the sample:

Usage: node faceDetection <path-to-image-file>

Example:

node faceDetection "./resources/face.png"

Label detection

View the documentation or the source code.

Run the sample:

Usage: node labelDetection <path-to-image-file>

Example:

node labelDetection "./resources/wakeupcat.jpg"

Landmark detection

View the documentation or the source code.

Run the sample:

Usage: node landmarkDetection <image-uri>

Example:

node landmarkDetection "https://cloud-samples-tests.storage.googleapis.com/vision/water.jpg"

Text detection sample

View the source code.

Run the sample:

Usage: node textDetection <command> [args]...

Analyze images:

node textDetection analyze "./resources/"

Look up words:

node textDetection lookup the sunbeams in