Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-260

RANSAC Plane Iteration

Problem

Run one seeded RANSAC iteration for plane fitting.

Seed the random module, sample 3 distinct points, fit the exact plane z = a*x + b*y + c through them, and count points whose absolute vertical residual is at most threshold. Return [sorted_sample_indices, inlier_count]; a degenerate (collinear) sample scores 0.

Test cases

case 1
in: [[[0,0,1],[1,0,3],[2,0,5],[0,1,4],[1,1,6],[2,1,8],[1,1,0]],0.1,1]
expected: [[0,1,4],6]
case 2
in: [[[0,0,1],[1,0,3],[2,0,5],[0,1,4],[1,1,6],[2,1,8],[1,1,0]],0.1,2]
expected: [[0,5,6],3]
case 3
in: [[[0,0,1],[1,0,3],[0,1,4]],0.1,0]
expected: [[0,1,2],3]
Starter codePython
def ransac_plane_iteration(points, threshold, seed):
    # Your code here
    pass

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