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

Function detectFaces

vision/vision-face-detection.js:30–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28 const client = new vision.ImageAnnotatorClient();
29
30 async function detectFaces() {
31 /**
32 * TODO(developer): Uncomment the following line before running the sample.
33 */
34 // const fileName = 'Local image file, e.g. /path/to/image.png';
35
36 const [result] = await client.faceDetection(fileName);
37 const faces = result.faceAnnotations;
38 console.log('Faces:');
39 faces.forEach((face, i) => {
40 console.log(` Face #${i + 1}:`);
41 console.log(` Joy: ${face.joyLikelihood}`);
42 console.log(` Anger: ${face.angerLikelihood}`);
43 console.log(` Sorrow: ${face.sorrowLikelihood}`);
44 console.log(` Surprise: ${face.surpriseLikelihood}`);
45 });
46 }
47 detectFaces();
48 // [END vision_face_detection]
49}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected