【问题标题】:Can i give aspect ratio in Google Vision api?我可以在 Google Vision api 中给出纵横比吗?
【发布时间】:2017-06-01 09:58:23
【问题描述】:

我在探索google vision和具体功能 'detectCrops',给我作物提示。这到底是什么意思?

我尝试使用示例图像访问 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 } ] }

【问题讨论】:

    标签: node.js google-vision


    【解决方案1】:

    可以提供纵横比。

    vision.detectCrops('./img.jpg', {imageContext : {cropHintsParams : {aspectRatios : [1.77]}}}, function(err, crops, apiResponse) {
      console.log('crops', crops) 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 1970-01-01
      • 2013-05-01
      相关资源
      最近更新 更多