javascript - How to send image using application/octet-stream in OCR Cognitive -
hello i'm trying use ocr api microsoft , expect content-type application/octet-stream , body post binary. tried send image base64(binary), binary, didn't work. knows how image needs sended?
yes, can send blob
or file
(which same things).
example code using xmlhttprequest api :
var xhr = new xmlhttprequest(); xhr.onload = do_something_with_this_json; xhr.open('post', 'https://westus.api.cognitive.microsoft.com/vision/v1.0/ocr'); xhr.setrequestheader("content-type", "application/octet-stream"); xhr.setrequestheader("ocp-apim-subscription-key", your_key); xhr.send(blob);
now on how blob, depends on image from.
Comments
Post a Comment