【发布时间】:2019-09-09 11:56:57
【问题描述】:
我正在尝试使用 Node.js 在 GC Vision 中获得超过 10 个结果。
由于我无法将自定义请求直接传递给webDetection(),因此我尝试使用annotateImage():
const vision = require('@google-cloud/vision');
const client = new vision.ImageAnnotatorClient();
const webSearchRequest = {
image: {
source: {
imageUri: `gs://${bucket.name}/${filePath}`
}
},
features: [{
maxResults: 50,
type: vision.types.Feature.Type.WEB_DETECTION
}]
};
return client.annotateImage(webSearchRequest).then(webResults => {
console.log(webResults);
}
输出是Cannot read property 'Feature' of undefined
【问题讨论】:
-
在这里尝试工作示例 --> cloud.google.com/vision/docs/…
-
@Christopher 正如我所说,该方法仅返回 10 个结果,并且您无法通过特征来获得更多结果。文档说您可以在这些情况下使用 annotateImage 代替,但这对我也不起作用。
-
我一直在做一些研究并使用this测试工具,我看到
type属性应该如下:type: WEB_DETECTION -
你在学习任何教程吗?如果是这样,您能否在您的问题中分享它?
-
@Miguel 可以,谢谢。我在关注这个 api:googleapis.dev/nodejs/vision/latest/…
标签: node.js google-cloud-platform google-cloud-functions google-vision