Depth Error from Disparity Noise

~10 mincode completion

Implement depth_error(f, B, disparity, delta_d) returning .

Examples

Nearby: d=4, dd=0.1 gives 0.125

Input
depth_error(2, 10, 4, 0.1)
Output
0.125

Same noise four times farther (d=1) gives 2.0, sixteen times larger

Input
depth_error(2, 10, 1, 0.1)
Output
2

A 0.01-pixel error at d=0.05 is already 48 in depth

Input
depth_error(100, 0.12, 0.05, 0.01)
Output
48

Hints

Hint 1

Convert the input with before doing elementwise work.

Hint 2

Do not forget to square the disparity. That step is easy to skip.

Requirements

  • disparity: scalar or array

  • delta_d: disparity error, same shape as disparity or scalar

  • Return approximate |delta Z|

Constraints

  • Allowed library: NumPy only

  • Time limit: 200 ms, Memory: 64 MB

Where this shows up

~10 min

8 employers weight this skill

4 autonomy companies, 1 defense company, 1 health and bio company, 1 enterprise vendor, 1 AI product company. Top match scores 93.

Python
import numpy as np


def depth_error(f, B, disparity, delta_d):
    """
    First-order depth uncertainty from a disparity error.

    Args:
        f, B:       focal length and baseline
        disparity:  scalar or array
        delta_d:    disparity error, same shape as disparity or scalar

    Returns:
        approximate |delta Z|
    """
    # YOUR CODE HERE
    pass
Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.