-1

I would like to know what else I can extract, in addition to text and coordinates, using cloud vision OCR. I looked in the documentation but didn't find anything.I would also like to know how to extract this other information

1 Answers1

0

You can found a list of available google cloud vision features : https://cloud.google.com/vision/docs/features-list?hl=fr

To run multiple feature on the same api run you have to provide the feature list in your request. For example :

⚠ This code is part of a project modified to fit with the explaination, it is not meant to be used in production it's a bit crappy :)


import vision  from '@google-cloud/vision';

let encodedImage= Buffer.from(fs.readFileSync(<YOUR_IMG_PATH>)).toString('base64');

// Create google vision client
const client = new vision.ImageAnnotatorClient({
 keyFilename: googleKeyPath
});

// The list of feature you want to run
let features = ["TEXT_DETECTION","LOGO_DETECTION","LABEL_DETECTION"]
    
let featureList = features.map(feature => ({ type: feature }));
    
const request = {
 "image": {"content": encodedImage},
 "features": featureList,
 "imageContext": {
  "languageHints": ["fr"]
 }
};

let googleVisionApiResult = await client.annotateImage(request);

console.log(googleVisionApiResult)