0

So, I want to open the image using OpenCV not through the image location path. But in this case I have a variable containing python bytes like the following :

png_data = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00d....'

So I want to read png_data using cv2.imread(png_data) without having to save it to disk first (But this is not working, because as far as i know imread only accept path).

Is this possible, or is there some other way to fix this kind of situation. I had this problem and searched all day but couldn't find the right solution.

akez
  • 15
  • 5
  • Please have a look at https://stackoverflow.com/questions/17170752/python-opencv-load-image-from-byte-string – Jeru Luke Apr 30 '22 at 11:13

0 Answers0