depth_downsample.py 460 Bytes
Newer Older
Nianchen Deng's avatar
sync    
Nianchen Deng committed
1
2
3
4
import sys
import os
import torch

5
6
os.chdir('../')
sys.path.append(os.getcwd())
Nianchen Deng's avatar
sync    
Nianchen Deng committed
7
8
9
10

from utils import img
from utils import misc

11
data_dir = 'data/__7_challenge/classroom_r360x80_t0.3'
Nianchen Deng's avatar
sync    
Nianchen Deng committed
12
13
14
15
16
17
18
19
20
21
22
23
in_set = f'{data_dir}/train_depth'
out_set = f'{data_dir}/train_depth_low'

img_names = os.listdir(in_set)

os.chdir(in_set)
depthmaps = img.load(img_names)
depthmaps = torch.floor((depthmaps * 16)) / 16

misc.create_dir(out_set)
os.chdir(out_set)
img.save(depthmaps, img_names)