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

Function detectHandwritingGCS

vision/detect.v1p3beta1.js:46–73  ·  view source on GitHub ↗
(uri)

Source from the content-addressed store, hash-verified

44}
45
46async function detectHandwritingGCS(uri) {
47 // [START vision_handwritten_ocr_gcs_beta]
48 // Imports the Google Cloud client libraries
49 const vision = require('@google-cloud/vision').v1p3beta1;
50 const fs = require('fs');
51
52 // Creates a client
53 const client = new vision.ImageAnnotatorClient();
54
55 /**
56 * TODO(developer): Uncomment the following line before running the sample.
57 */
58 // const uri = `gs://bucket/bucketImage.png`;
59
60 const request = {
61 image: {
62 content: fs.readFileSync(uri),
63 },
64 feature: {
65 languageHints: ['en-t-i0-handwrit'],
66 },
67 };
68
69 const [result] = await client.documentTextDetection(request);
70 const fullTextAnnotation = result.fullTextAnnotation;
71 console.log(`Full text: ${fullTextAnnotation.text}`);
72 // [END vision_handwritten_ocr_gcs_beta]
73}
74
75require('yargs')
76 .demand(1)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected