Skip to content

Obraining depth maps from raw data #14

@VladimirYugay

Description

@VladimirYugay

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions