All problems
Epipolar Line Distance
Problem
Compute the distance from a point to its epipolar line.
The line is l = F * [x1, y1, 1] with coefficients (a, b, c), and the distance from x2 is |a * u + b * v + c| / sqrt(a^2 + b^2). Return the distance rounded to 4 decimal places, or 0.0 when a = b = 0.
Hint
Normalize the line equation by the norm of its first two coefficients.
Test cases
case 1
in: [[[0,0,1],[0,0,-1],[0,1,0]],[0,0],[1,3]]
expected: 1.4142
case 2
in: [[[0,0,0],[0,0,-2],[0,1,1]],[1,0],[1,0]]
expected: 0.5
case 3
in: [[[1,0,0],[0,1,0],[0,0,1]],[0,0],[2,2]]
expected: 0
case 4
in: [[[0,1,0],[-1,0,0],[0,0,1]],[1,1],[0,0]]
expected: 0.7071
Starter codePython
def epipolar_distance(F, x1, x2):
# Your code here
pass4 test cases · run your code against them in the editor