我可以在 Google Vision api 中给出纵横比吗?
Can i give aspect ratio in Google Vision api?
I was exploring google vision and in the specific function
'detectCrops', gives me the crop hints. what does this means exactly?
我尝试用示例图像点击 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)
}
I was exploring google vision and in the specific function 'detectCrops', gives me the crop hints. what does this means exactly?
我尝试用示例图像点击 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)
}