img = cv2.imread("abc.jpg")
retval, buffer = cv2.imencode('.png', img)
im_b64 = base64.b64encode(buffer)
payload = json.dumps({
"image_data" : "data:image/png;base64,"+im_b64.decode() #.decode() is important
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)