Пример #1
0
float get_depth_scale(rs2::device dev)

{

	// Go over the device's sensors

	for (rs2::sensor& sensor : dev.query_sensors())

	{

		// Check if the sensor if a depth sensor

		if (rs2::depth_sensor dpt = sensor.as<rs2::depth_sensor>())

		{

			return dpt.get_depth_scale();

		}

	}

	throw std::runtime_error("Device does not have a depth sensor");

}
Пример #2
0
bool try_get_depth_scale(rs2::device dev, float& scale)
{
    // Go over the device's sensors
    for (rs2::sensor& sensor : dev.query_sensors())
    {
        // Check if the sensor if a depth sensor
        if (rs2::depth_sensor dpt = sensor.as<rs2::depth_sensor>())
        {
            scale = dpt.get_depth_scale();
            return true;
        }
    }
    return false;
}