| 114 | } |
| 115 | |
| 116 | async function detectLandmarks(fileName) { |
| 117 | // [START vision_landmark_detection] |
| 118 | const vision = require('@google-cloud/vision'); |
| 119 | |
| 120 | // Creates a client |
| 121 | const client = new vision.ImageAnnotatorClient(); |
| 122 | |
| 123 | /** |
| 124 | * TODO(developer): Uncomment the following line before running the sample. |
| 125 | */ |
| 126 | // const fileName = 'Local image file, e.g. /path/to/image.png'; |
| 127 | |
| 128 | // Performs landmark detection on the local file |
| 129 | const [result] = await client.landmarkDetection(fileName); |
| 130 | const landmarks = result.landmarkAnnotations; |
| 131 | console.log('Landmarks:'); |
| 132 | landmarks.forEach(landmark => console.log(landmark)); |
| 133 | // [END vision_landmark_detection] |
| 134 | } |
| 135 | |
| 136 | async function detectLandmarksGCS(bucketName, fileName) { |
| 137 | // [START vision_landmark_detection_gcs] |