yoloserv/modules/paravision/recognition/tests/test_transform.py

39 lines
1006 B
Python

import numpy as np
from unittest import TestCase
from .._utils import compute_transform
class TestTransform(TestCase):
def test_transform(self):
src_points = [
[146.08132502, 155.9912228],
[218.04209101, 153.17409003],
[176.5086686, 207.03067255],
[153.90101734, 240.53104055],
[214.96274501, 237.63263655],
]
dst_points = [
[38.2946, 51.6963],
[73.5318, 51.5014],
[56.0252, 71.7366],
[41.5493, 92.3655],
[70.7299, 92.2041],
]
trans = compute_transform(src_points, dst_points)
out = np.asarray(
[
[4.79823508e-01, -1.35817363e-02, -2.85523114e01],
[1.35817363e-02, 4.79823508e-01, -2.59931548e01],
]
)
self.assertTrue(
(np.isclose(trans.flatten(), out.flatten()).all()),
msg="The transform wasn't computed sucessfully",
)