|
27 | 27 | #include <syslog.h> |
28 | 28 | #include <unistd.h> |
29 | 29 |
|
| 30 | +// Select scene or frame normalized coordinates. |
| 31 | +// |
| 32 | +// Scene coordinate system is normalized to [0,0]-[1,1] and follows the filmed scene, |
| 33 | +// i.e. static objects in the world have the same coordinates regardless of global rotation. |
| 34 | +// |
| 35 | +// Frame coordinate system is normalized and aligned with the camera frame, |
| 36 | +// i.e. top-left is [0,0] and bottom-right is [1,1]. |
| 37 | +static bool scene_normalized = true; |
| 38 | + |
30 | 39 | volatile sig_atomic_t running = 1; |
31 | 40 |
|
32 | 41 | static void shutdown(int status) { |
@@ -69,6 +78,11 @@ static void example_single_channel(void) { |
69 | 78 | if (!bbox) |
70 | 79 | panic("Failed creating: %s", strerror(errno)); |
71 | 80 |
|
| 81 | + if (scene_normalized) |
| 82 | + bbox_coordinates_scene_normalized(bbox); |
| 83 | + else |
| 84 | + bbox_coordinates_frame_normalized(bbox); |
| 85 | + |
72 | 86 | bbox_clear(bbox); // Remove all old bounding-boxes |
73 | 87 |
|
74 | 88 | // Create all needed colors [These operations are slow!] |
@@ -222,9 +236,16 @@ int main(void) { |
222 | 236 | init_signals(); |
223 | 237 |
|
224 | 238 | for (bool once = true; running; once = false) { |
| 239 | + scene_normalized = true; |
225 | 240 | example_single_channel(); |
226 | | - example_multiple_channels(); |
| 241 | + |
227 | 242 | example_clear(); |
| 243 | + |
| 244 | + scene_normalized = false; |
| 245 | + example_single_channel(); |
| 246 | + |
| 247 | + example_multiple_channels(); |
| 248 | + |
228 | 249 | if (once) |
229 | 250 | syslog(LOG_INFO, "All examples succeeded."); |
230 | 251 | } |
|
0 commit comments