0
イメージ内の顔を検出するためにMicrosoft Face APIを呼び出す。ローカルから画像をロードしている間、私はいつもローカルストレージからアップロードするときに画像サイズが小さすぎる、Microsoft Face API
{ code: 'InvalidImageSize',
message: 'Image size is too small.' }
しかし、URL、その作業罰金を経由して、同じ画像を使用して以下のようにエラーが発生します 。
const fs = require("fs");
const axios = require("axios");
axios({
method : "post",
url : " https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true",
headers : {
'Content-Type': 'application/octet-stream',
"Ocp-Apim-Subscription-Key" : "2da8e41a647c4079b2f9a6XXXXXXXXX"
},
body : fs.readFileSync("./photos/shiva3.jpeg").toString("base64")
}).then((res)=>{
console.log("Response");
console.log(res.data);
}).catch((err)=>{
console.log(err.response.data.error);
})
'.toString(" base64 ")は必要ですか? –