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

Function detectProperties

vision/detect.js:295–312  ·  view source on GitHub ↗
(fileName)

Source from the content-addressed store, hash-verified

293}
294
295async function detectProperties(fileName) {
296 // [START vision_image_property_detection]
297 const vision = require('@google-cloud/vision');
298
299 // Creates a client
300 const client = new vision.ImageAnnotatorClient();
301
302 /**
303 * TODO(developer): Uncomment the following line before running the sample.
304 */
305 // const fileName = 'Local image file, e.g. /path/to/image.png';
306
307 // Performs property detection on the local file
308 const [result] = await client.imageProperties(fileName);
309 const colors = result.imagePropertiesAnnotation.dominantColors.colors;
310 colors.forEach(color => console.log(color));
311 // [END vision_image_property_detection]
312}
313
314async function detectPropertiesGCS(bucketName, fileName) {
315 // [START vision_image_property_detection_gcs]

Callers 1

detect.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected