This repository has been archived by the owner on Dec 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_visualizer.py
85 lines (72 loc) · 2.47 KB
/
test_visualizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
Pedestrian Tracking
2018
POVa - Computer Vision
FIT - Faculty of Information Technology
BUT - Brno University of Technology
"""
import time
import unittest
from unittest import TestCase
from camera import Camera
from config import FOCAL_LENGTH_CAMERA_M, FOCAL_LENGTH_CAMERA_F
from person import Person, PersonTimeFrame
from visualizer import Plotter3D
class TestPlotter3D(TestCase):
def setUp(self) -> None:
super().setUp()
self.camera_m = Camera(
name='m (front camera)',
focal_length=FOCAL_LENGTH_CAMERA_M,
position=(0, 0, 147),
orientation=(0, 1, 0)
)
self.camera_f = Camera(
name='f (side camera)',
focal_length=FOCAL_LENGTH_CAMERA_F,
position=(-200, 0, 147),
orientation=(1, 1, 0)
)
@unittest.skip("This is not an automated test. Visual check would be required.")
def test_render(self):
people = []
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (0, 300, 147)
alice = Person(time_frame, name='Alice')
people.append(alice)
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (0, 600, 147)
bob = Person(time_frame, name='Bob')
people.append(bob)
visualizer = Plotter3D(people, [self.camera_m, self.camera_f])
visualizer.render()
print('render')
time.sleep(0.5)
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (50, 300, 147)
alice.time_frames.append(time_frame)
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (0, 400, 147)
bob.time_frames.append(time_frame)
visualizer.render()
print('render')
time.sleep(0.5)
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (50, 350, 147)
alice.time_frames.append(time_frame)
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (0, 200, 147)
bob.time_frames.append(time_frame)
visualizer.render()
print('render')
time.sleep(0.5)
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (-50, 350, 147)
alice.time_frames.append(time_frame)
time_frame = PersonTimeFrame([])
time_frame.coordinates_3d = (-200, 200, 147)
bob.time_frames.append(time_frame)
visualizer.render()
print('render')
print('closing in 2 s')
time.sleep(2)