| 178 | } |
| 179 | |
| 180 | async function detectTextGCS(bucketName, fileName) { |
| 181 | // [START vision_text_detection_gcs] |
| 182 | // Imports the Google Cloud client libraries |
| 183 | const vision = require('@google-cloud/vision'); |
| 184 | |
| 185 | // Creates a client |
| 186 | const client = new vision.ImageAnnotatorClient(); |
| 187 | |
| 188 | /** |
| 189 | * TODO(developer): Uncomment the following lines before running the sample. |
| 190 | */ |
| 191 | // const bucketName = 'Bucket where the file resides, e.g. my-bucket'; |
| 192 | // const fileName = 'Path to file within bucket, e.g. path/to/image.png'; |
| 193 | |
| 194 | // Performs text detection on the gcs file |
| 195 | const [result] = await client.textDetection(`gs://${bucketName}/${fileName}`); |
| 196 | const detections = result.textAnnotations; |
| 197 | console.log('Text:'); |
| 198 | detections.forEach(text => console.log(text)); |
| 199 | // [END vision_text_detection_gcs] |
| 200 | } |
| 201 | |
| 202 | async function detectLogos(fileName) { |
| 203 | // [START vision_logo_detection] |