MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / localizeObjectsGCS

Function localizeObjectsGCS

vision/detect.js:769–791  ·  view source on GitHub ↗
(gcsUri)

Source from the content-addressed store, hash-verified

767}
768
769async function localizeObjectsGCS(gcsUri) {
770 // [START vision_localize_objects_gcs]
771 // Imports the Google Cloud client libraries
772 const vision = require('@google-cloud/vision');
773
774 // Creates a client
775 const client = new vision.ImageAnnotatorClient();
776
777 /**
778 * TODO(developer): Uncomment the following line before running the sample.
779 */
780 // const gcsUri = `gs://bucket/bucketImage.png`;
781
782 const [result] = await client.objectLocalization(gcsUri);
783 const objects = result.localizedObjectAnnotations;
784 objects.forEach(object => {
785 console.log(`Name: ${object.name}`);
786 console.log(`Confidence: ${object.score}`);
787 const veritices = object.boundingPoly.normalizedVertices;
788 veritices.forEach(v => console.log(`x: ${v.x}, y:${v.y}`));
789 });
790 // [END vision_localize_objects_gcs]
791}
792
793require(`yargs`) // eslint-disable-line
794 .demand(1)

Callers 1

detect.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected