Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from matplotlib import pyplot as plt
- import matplotlib
- import glob
- import cv2
- import scipy
- from scipy import misc
- for file in glob.glob("*_depth.npy"):
- im = np.load(file)
- #print(type(im))
- #print(im.shape)
- #print(im.size)
- #print(im.ndim)
- #print(np.max(im, axis=0))
- '''for i in range(480):
- for j in range(640):
- if (im[i][j]==32001):
- im[i][j]==0'''
- r = np.ptp(im,axis=1)
- depth_image_filename = file[:-4]+'_modified'+'.png'
- cv2.imwrite(depth_image_filename, (im).astype(np.uint16))
- from PIL import Image
- '''for file in glob.glob("*_depth_modified.png"):
- im = Image.open(file, 'r')
- pixel_val = list(im.getdata())
- for val in pixel_val:
- if (val==32001):
- val=0
- '''
- #from PIL import Image
- #imag = Image.open('000000_depth_modified.png')
- #print(type(imag))
- #cv2.imwrite("moon.png", (im*32).astype(np.uint16))
- from PIL import Image
- im = Image.open("000000_depth.png", 'r')
- pixel_val = list(im.getdata())
- print(pixel_val)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement