Skip to content

Commit 939f3d2

Browse files
authored
Merge pull request #69 from vaughantnrc/dev-tv-registration-fix
BUG: Incorrect comparison direction in register_corresponding_points
2 parents ac17989 + c05ac1f commit 939f3d2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/pose_solver/util/register_corresponding_points.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def register_corresponding_points(
1919
"""
2020
if len(point_set_from) != len(point_set_to):
2121
raise ValueError("Input point sets must be of identical length.")
22-
if len(point_set_from) > 3:
22+
if len(point_set_from) < 3:
2323
raise ValueError("Input point sets must be of length 3 or higher.")
2424
if collinearity_do_check:
2525
for point_set in (point_set_from, point_set_to):

test/test_register_corresponding_points.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def assertRotationCloseToIdentity(
2222
self.assertAlmostEqual(float(matrix[2, 1]), 0.0, delta=tolerance)
2323
self.assertAlmostEqual(float(matrix[2, 2]), 1.0, delta=tolerance)
2424

25-
def test_identity(self):
25+
def test_identity_3_points(self):
2626
point_set_from = [
2727
[0.0, 0.0, 0.0],
2828
[1.0, 0.0, 0.0],
@@ -38,6 +38,23 @@ def test_identity(self):
3838
self.assertEqual(matrix[3, 1], 0.0)
3939
self.assertEqual(matrix[3, 2], 0.0)
4040

41+
def test_identity_4_points(self):
42+
point_set_from = [
43+
[0.0, 0.0, 0.0],
44+
[1.0, 0.0, 0.0],
45+
[0.0, 1.0, 0.0],
46+
[1.0, 1.0, 0.0]]
47+
point_set_to = point_set_from
48+
matrix = register_corresponding_points(point_set_from, point_set_to)
49+
self.assertRotationCloseToIdentity(matrix)
50+
self.assertAlmostEqual(matrix[0, 3], 0.0)
51+
self.assertAlmostEqual(matrix[1, 3], 0.0)
52+
self.assertAlmostEqual(matrix[2, 3], 0.0)
53+
self.assertEqual(matrix[3, 3], 1.0)
54+
self.assertEqual(matrix[3, 0], 0.0)
55+
self.assertEqual(matrix[3, 1], 0.0)
56+
self.assertEqual(matrix[3, 2], 0.0)
57+
4158
def test_translation(self):
4259
point_set_from = [
4360
[0.0, 0.0, 0.0],

0 commit comments

Comments
 (0)