Created
January 10, 2018 10:43
-
-
Save iKrishneel/9997b01b376341ed07f2b160d5221aa3 to your computer and use it in GitHub Desktop.
convert_sensor_msg_to_pil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from PIL import Image as PILImage | |
channel = int(np.ceil(len(img_msg.data)/(img_msg.height * img_msg.width))) | |
im = np.ndarray(shape=(img_msg.height, img_msg.width, channel), | |
dtype=np.uint8, buffer=img_msg.data) | |
pim = PILImage.fromarray(im) | |
pim.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment