Advertisement
lamiastella

save pixel_val

Jun 16th, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import numpy as np
  2. from matplotlib import pyplot as plt
  3. import matplotlib
  4. import glob
  5. import cv2
  6. import scipy
  7. from scipy import misc
  8.  
  9.  
  10. for file in glob.glob("*_depth.npy"):
  11.     im = np.load(file)
  12.     print(np.max(im, axis=0))
  13.     r = np.ptp(im,axis=1)
  14.  
  15.     depth_image_filename = file[:-4]+'_modified'+'.png'
  16.     #cv2.imwrite("moon.png", (im*32).astype(np.uint16))
  17.     cv2.imwrite(depth_image_filename, (im).astype(np.uint16))
  18.  
  19.  
  20.  
  21. from PIL import Image
  22.  
  23. for file in glob.glob("*_depth_modified.png"):
  24.     im = Image.open(file, 'r')
  25.     pixel_val = list(im.getdata())
  26.     for val in pixel_val:
  27.         if (val==32001):
  28.             val=0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement