niessner/Matterport

how to read .dpt file?

nita-xwj opened this issue · 1 comments

got a .dpt file,which is the ground-truth depth of 360 RGB scene, but when I use Hinterstousser to read dpt file, it goes wrong.Here is the code:

*```
INT_BYTES = 4
USHORT_BYTES = 2
def load_hinter_depth(path):
'''
Loads depth image from the '.dpt' format used by Hinterstoisser.
'''
f = open(path, 'rb')
h = struct.unpack('i', f.read(INT_BYTES))[0] # this output 1212500304
w = struct.unpack('i', f.read(INT_BYTES))[0] # this output 2048
depth_map = []
for i in range(h):
depth_map.append(struct.unpack(w
'H', f.read(w * USHORT_BYTES)))
# return np.array(depth_map, np.uint16)
return np.array(depth_map, np.float32)


My 360 RGB PNG is 1024 height and 2048 width.When I change range(h) to range(1024), it can run, but the result array is obvious wrong.

Hi, have you solved this?