I have the following jpeg as a bytecode string:
jpg = 'b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00`\x00`\x00\x00\xff\xfe\x00>CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), default quality\n\xff\xdb\x00C\x00\x08\x06\x06\x07
I want to load this into OpenCV.
I tried:
import numpy as np
# CV2
nparr = np.fromstring(jpg , np.uint8)
img_np = cv2.imdecode(nparr, cv2.CV_LOAD_IMAGE_COLOR ) # cv2.IMREAD_COLOR in OpenCV 3.1
I'm getting:
AttributeError: module 'cv2.cv2' has no attribute 'CV_LOAD_IMAGE_COLOR'
How can I get this working?
You may try cv2.IMREAD_COLOR
if using OpenCv 3.1. It worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With