All problems
Optical Flow Magnitude
Problem
Compute the magnitude of a dense optical flow field.
Return sqrt(flow_x^2 + flow_y^2) per pixel rounded to 4 decimal places.
Test cases
case 1
in: [[[3,0]],[[4,0]]]
expected: [[5,0]]
case 2
in: [[[1,-1]],[[0,1]]]
expected: [[1,1.4142]]
case 3
in: [[[0,0],[0,0]],[[0,0],[0,0]]]
expected: [[0,0],[0,0]]
Starter codePython
def flow_magnitude(flow_x, flow_y):
# Your code here
pass3 test cases · run your code against them in the editor