我可以在Google Vision API中提供宽高比吗?
问题描述:
我正在探索谷歌愿景和具体功能 'detectCrops',给我的作物提示。这意味着什么?我可以在Google Vision API中提供宽高比吗?
我试着用示例图像打api并得到了一个具有四个坐标的数组的响应。这个坐标是什么意思?长宽比是否固定?我可以指定特定的长宽比吗? 。文件不清楚或我无法理解。可以提供
我的代码
var vision = require('@google-cloud/vision')({
projectId: Credentials.PROJECT_ID,
credentials: Credentials.AUTH_KEY
})
vision.detectCrops('img.jpg', function(err, crops, apiResponse) {
console.log('err', err)
console.log('crops', crops)
console.log('apiResponse', apiResponse)
})
响应
err null
crops [ [ { x: 0, y: 0 },
{ x: 649, y: 0 },
{ x: 649, y: 399 },
{ x: 0, y: 399 } ] ]
apiResponse { responses:
[ { faceAnnotations: [],
landmarkAnnotations: [],
logoAnnotations: [],
labelAnnotations: [],
textAnnotations: [],
fullTextAnnotation: null,
safeSearchAnnotation: null,
imagePropertiesAnnotation: null,
cropHintsAnnotation: [Object],
webDetection: null,
error: null } ] }
答
纵横比。
vision.detectCrops('./img.jpg', {imageContext : {cropHintsParams : {aspectRatios : [1.77]}}}, function(err, crops, apiResponse) {
console.log('crops', crops)
}