GTA-IM-Dataset icon indicating copy to clipboard operation
GTA-IM-Dataset copied to clipboard

Obraining depth maps from raw data

Open VladimirYugay opened this issue 4 years ago • 0 comments

Hey there,

I currently have some raw depth maps (.raw files) from the GTA game engine and I'm curious, how did you get the depth images that you have in samples?

I was able to convert them to (0, 255) color images with the following function, but still can't get the depth in meters like you have.

def convert_depth(img_path):
    abs_min = 1008334389
    # sky =  964405378
    abs_max = 1067424357
    x = np.fromfile(img_path, dtype='uint32')[4:]
    x = np.clip(x, abs_min, abs_max)
    x = ((x - abs_min) / (abs_max - abs_min))
    x = np.uint8(x * 255)
    x = x.reshape(1080, 1920)
    return x

Thanks!

VladimirYugay avatar May 17 '21 18:05 VladimirYugay