Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-184

Homography Apply Point

Problem

Apply a 3x3 homography to a 2D point.

Return [(H00*x + H01*y + H02) / d, (H10*x + H11*y + H12) / d] where d = H20*x + H21*y + H22, rounded to 4 decimal places.

Test cases

case 1
in: [[[1,0,0],[0,1,0],[0,0,1]],[3,4]]
expected: [3,4]
case 2
in: [[[1,0,2],[0,1,3],[0,0,1]],[1,1]]
expected: [3,4]
case 3
in: [[[2,0,0],[0,3,0],[0,0,1]],[2,2]]
expected: [4,6]
case 4
in: [[[1,0,0],[0,1,0],[0.5,0,1]],[2,1]]
expected: [1,0.5]
Starter codePython
def apply_homography(H, point):
    # Your code here
    pass

4 test cases · run your code against them in the editor