调用Azure face从NodeJs检测来自Postman客户端的二进制图像数据的api

时间:2018-05-30 07:29:15

标签: node.js azure azure-cognitive-services face-api

我正在尝试在nodejs中构建一个REST中间件,它将调用azure face api,如下图所示。 enter image description here

当我使用所需数据和图像文件调用我的节点js端点进行面部检测时,我成功地在request.body中接收请求和图像的二进制数据。

由于我现在收到了我的中间件中的请求,因此我应该使用来自我的节点js middleware的接收数据调用Azure面部检测终点。 [现在这里是问题]

// ---------------从节点js调用azure face detection api ----

Request.post({
    "headers": {
      "content-type": reqBinaryContentType,     
      "Ocp-Apim-Subscription-Key": azureSubscriptionKey,     
      'Content-Length': req.headers['content-length']
    },  

      "body":req.body,
  }, (error, response, body) => {
    if (error) {     
      return console.dir(error);
    }   
    res.send(JSON.parse(body))
  })

// ---------------

错误: {"error":{"code":"InvalidImageSize","message":"Image size is too small."}}

由于

0 个答案:

没有答案