| 134 | } |
| 135 | |
| 136 | async function detectLandmarksGCS(bucketName, fileName) { |
| 137 | // [START vision_landmark_detection_gcs] |
| 138 | // Imports the Google Cloud client libraries |
| 139 | const vision = require('@google-cloud/vision'); |
| 140 | |
| 141 | // Creates a client |
| 142 | const client = new vision.ImageAnnotatorClient(); |
| 143 | |
| 144 | /** |
| 145 | * TODO(developer): Uncomment the following lines before running the sample. |
| 146 | */ |
| 147 | // const bucketName = 'Bucket where the file resides, e.g. my-bucket'; |
| 148 | // const fileName = 'Path to file within bucket, e.g. path/to/image.png'; |
| 149 | |
| 150 | // Performs landmark detection on the gcs file |
| 151 | const [result] = await client.landmarkDetection( |
| 152 | `gs://${bucketName}/${fileName}` |
| 153 | ); |
| 154 | const landmarks = result.landmarkAnnotations; |
| 155 | console.log('Landmarks:'); |
| 156 | landmarks.forEach(landmark => console.log(landmark)); |
| 157 | // [END vision_landmark_detection_gcs] |
| 158 | } |
| 159 | |
| 160 | async function detectText(fileName) { |
| 161 | // [START vision_text_detection] |