提交 aa454491 编写于 作者: K Kentaro Wada

Add labelme.utils.img_data_to_arr

上级 34c88be4
......@@ -5,6 +5,7 @@ from ._io import lblsave
from .image import apply_exif_orientation
from .image import img_arr_to_b64
from .image import img_b64_to_arr
from .image import img_data_to_arr
from .image import img_data_to_png_data
from .shape import labelme_shapes_to_label
......
......@@ -7,13 +7,19 @@ import PIL.Image
import PIL.ImageOps
def img_b64_to_arr(img_b64):
def img_data_to_arr(img_data):
f = io.BytesIO()
f.write(base64.b64decode(img_b64))
f.write(img_data)
img_arr = np.array(PIL.Image.open(f))
return img_arr
def img_b64_to_arr(img_b64):
img_data = base64.b64decode(img_b64)
img_arr = img_data_to_arr(img_data)
return img_arr
def img_arr_to_b64(img_arr):
img_pil = PIL.Image.fromarray(img_arr)
f = io.BytesIO()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册