Azure计算机视觉API的问题

时间:2019-03-27 11:41:49

标签: azure azure-cognitive-services

我遇到了Azure计算机视觉API的问题。如果我以contentType = application / json发送请求,并在JSON请求正文中发送图像URL,则一切正常,但是在发送以contentType = application / octet-stream生成的二进制图像(base 64编码)时,它在响应中给了我ImageFormatInvalid

[
    {
        "key": "Ocp-Apim-Subscription-Key", 
        "value": "6f7ff175139e4e1d8b943c6170fe5b8e",
        "description": ""
    },
    {
        "key": "Content-Type",
        "value": "multipart/form-data",
        "description": ""
    }
]

Content-Type:multipart / form-data并要求输入为二进制图像数据

1 个答案:

答案 0 :(得分:1)

API期望图像采用二进制形式,而不是base64编码。在此处查看API定义:https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa