我正在尝试使用 google vision API 识别图像中的文本
main.js
const vision = require("@google-cloud/vision");
// Creates a client
const client = new vision.ImageAnnotatorClient({
keyFilename: "./ApiKey.json"
});
// Performs label detection on the image file
client
.labelDetection("./maybank2u.png")
.then(results => {
const labels = results[0].labelAnnotations;
console.log("Labels:");
labels.forEach(label => console.log(label));
console.log(results);
})
.catch(err => {
console.error("ERROR:", err);
});
但是当我查看控制台中显示的内容时,这就是我得到的:
未捕获的TypeError:gax.GoogleProtoFilesRoot不是构造函数