Ghilas BELHADJ
Ghilas BELHADJ

Reputation: 14096

Load OpenCV image from binary string

What I mean by binary string, is the raw content of image file (That's what wand.image.make_blob() returns)

Is there a way to load it in OpenCV ?

Edit:

cv2.imdecode() doesn't work

img = cv2.imdecode( buf=wand_img.make_blob(), flags=cv2.IMREAD_UNCHANGED)

TypeError: buf is not a numpy array, neither a scalar

Upvotes: 1

Views: 3391

Answers (1)

Cedric
Cedric

Reputation: 899

Have you tried cv2.imdecode which takes an image buffer and turns it into a CvMat object? Though I am not sure about this one.

See : http://docs.opencv.org/3.0-beta/modules/imgcodecs/doc/reading_and_writing_images.html

Upvotes: 1

Related Questions