From 712bdf9dc6ba7b42db38d87ef5a8e2f938e606c6 Mon Sep 17 00:00:00 2001 From: lorenzo Date: Tue, 2 Jul 2019 11:28:56 +0200 Subject: [PATCH] add test for pixel_to_camera --- tests/test_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 9604076..6a4f58d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,6 +1,7 @@ from utils.iou import get_iou_matrix +from utils.camera import pixel_to_camera def test_iou(): @@ -9,3 +10,12 @@ def test_iou(): iou_matrix = get_iou_matrix(boxes_pred, boxes_gt) assert iou_matrix.shape == (len(boxes_pred), len(boxes_gt)) + +def test_pixel_to_camera(): + kk = [[718.3351, 0., 600.3891], [0., 718.3351, 181.5122], [0., 0., 1.]] + zz = 10 + uv_vector = [1000., 400.] + xx_norm = pixel_to_camera(uv_vector, kk, 1)[0] + xx_1 = xx_norm * zz + xx_2 = pixel_to_camera(uv_vector, kk, zz)[0] + assert xx_1 == xx_2