Skip to content

Instantly share code, notes, and snippets.

@jinyu121
Last active March 29, 2017 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinyu121/7f5906e791b0f08edb894adbbe44ff35 to your computer and use it in GitHub Desktop.
Save jinyu121/7f5906e791b0f08edb894adbbe44ff35 to your computer and use it in GitHub Desktop.
深度数据一维png转为三维png
import re
import os
import skimage.io as io
import skimage.color as color
import numpy as np
rootdir_from = "/home/haoyu/depth_png"
rootdir_to = "/home/haoyu/depth_png3"
pattern_ith = re.compile(r"\((\d+)\)")
for parent, dirnames, filenames in os.walk(rootdir_from):
for filename in filenames:
img = io.imread(os.path.join(rootdir_from,filename))
img=(img*1/8192).astype(np.float)
img=np.clip(img,0.0,1.0)
img=color.gray2rgb(img)
io.imsave(os.path.join(rootdir_to,filename),img)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment