Unit of captured depth image value by python

Hello there,

What is the unit of captured depth image value by Python? As stated in SyntheticDataHelper(), I used to get the data, however it turns incorrect.

sd = omni.syntheticdata._syntheticdata
sdi = sd.acquire_syntheticdata_interface()

def _get_sensor_data(sensor, dtype):
    width = sdi.get_sensor_width(sensor)
    height = sdi.get_sensor_height(sensor)
    row_size = sdi.get_sensor_ros_size(sensor)
    get_sensor = {
            "uint32": sdi.get_sensor_host_uint32_texture_array,
            "float": sdi.get_sensor_host_float_texture_array,
    }
    return get_sensor[dtype](sensor, width, height, row_size)

depth = _get_sensor_data(sd.SensorType.Depth, "float")

Say, the received value is [0.0094961, 0.00948272, …] while the real value(unit:meter) in the simulation would be [7.4304, 7.4352, …]. Any other transformation steps needed?

Can anyone help? Thanks~!

Hi @rosy.luo

depth = _get_sensor_data(sd.SensorType.Depth, "float") refers to the inverse depth value. To get the real depth value in meter, please use depth = _get_sensor_data(sd.SensorType.DepthLinear, "float")

It works! Thanks~!

Best regards,
Rosy

1 Like

So just to be clear here, 1/depth is the same as depth_linear?
Or am I missing something here? The unit remains the same as stage unit, and is not necessarily meters. Thanks for your help!

Hi, can you please confirm whether _get_sensor_data(sd.SensorType.DepthLinear) returns units in stage units or is there some unit property for the scene which its taking into account?

Actually I think it takes the Meters Per Unit property into account when calculating depth. You can find this in the Layer window → Root Layer. Once Root Layer is selected, the property window will sow Meters Per Unit in the Layer Metadata section