How to decode jpg image from memory?
Assuming that you are storing the image data in your db as a string
, you first need to construct a numpy
array from that string that can later be converted to an image using cv2.imdecode
. For example:
img = cv2.imdecode(np.fromstring(img_data, dtype=np.uint8), cv2.IMREAD_UNCHANGED)