Skip to content

Commit

Permalink
Added Support for reading depth maps from disk
Browse files Browse the repository at this point in the history
  • Loading branch information
ErenBalatkan committed Feb 14, 2020
1 parent bcd519e commit 34bf1a4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion DepthVisualizer/DepthVisualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import ctypes
import time
import numpy as np
from PIL import Image

vertex_shader_source = \
"#version 330 core\n" + \
Expand Down Expand Up @@ -167,6 +168,12 @@ def read_kitti_point_cloud(path, calib, color=[255, 255, 255]):
point_cloud[:, 3:] = color
return point_cloud

@staticmethod
def read_depth_map(path):
depth_map = np.asarray(Image.open(path), np.float32)
depth_map = np.expand_dims(depth_map, axis=2) / 256.0
return depth_map

@staticmethod
def convert_objects_from_kitti_format(objects):
'''
Expand Down Expand Up @@ -809,7 +816,6 @@ def convert_points_to_voxel_map(self, points, voxel_map_center, voxel_map_size,
:return: A 3D array in x-y-z format where each element is list of size 3 that represents color
'''

#TODO UPDATE THIS METHOD
voxel_map_size = np.asarray(np.ceil(np.array(voxel_map_size) / voxel_size), np.int32)
center_x, center_y, center_z = voxel_map_center

Expand Down

0 comments on commit 34bf1a4

Please sign in to comment.