2017-06-01 99 views
0

我正在探索谷歌願景和具體功能 '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 } ] } 

回答

1

縱橫比。

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