I am using Computer Vision API for handwritten analysis using R. I can get the results when passing image URL. But I want to pass binary image data to the API. What is the format for that? When using the online Console for POST using this link.
Selecting 'application/octet-stream' just shows [Binary Image Data] in the request body. I have used base64 image format within []
, and ["body":data]
and many other ways but I get invalid image input error. Is base64 not correct? Do I need to convert to other format?
I read on web that we need to pass image as blob.
R code I am using to post is below. Currently you can see me using a url in body, how can I pass an image there from local PC storage as a blob?
APIresponse = POST(url = cogapi,content_type('application/json'),add_headers(.headers = c('Ocp-Apim-Subscription-Key' = '*************************')),body=list(url = img_url),encode = "json")