I\'m trying to load image from string like as PHP function imagecreatefromstring
How can I do that?
I have MySQL blob field image. I\'m using
I've try to use this code to create an opencv from a string containing a raw buffer (plain pixel data) and it doesn't work in that peculiar case.
So here's how to do that for this kind of data:
image = np.fromstring(im_str, np.uint8).reshape( h, w, nb_planes )
(but yes you need to know your image properties)
if your B and G channel is permuted, here's how to fix it:
image = cv2.cvtColor(image, cv2.cv.CV_BGR2RGB)