Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion bounding-box/app/bounding_box_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
#include <syslog.h>
#include <unistd.h>

// Select scene or frame normalized coordinates.
//
// Scene coordinate system is normalized to [0,0]-[1,1] and follows the filmed scene,
// i.e. static objects in the world have the same coordinates regardless of global rotation.
//
// Frame coordinate system is normalized and aligned with the camera frame,
// i.e. top-left is [0,0] and bottom-right is [1,1].
static bool scene_normalized = true;

volatile sig_atomic_t running = 1;

static void shutdown(int status) {
Expand Down Expand Up @@ -69,6 +78,11 @@ static void example_single_channel(void) {
if (!bbox)
panic("Failed creating: %s", strerror(errno));

if (scene_normalized)
bbox_coordinates_scene_normalized(bbox);
else
bbox_coordinates_frame_normalized(bbox);

bbox_clear(bbox); // Remove all old bounding-boxes

// Create all needed colors [These operations are slow!]
Expand Down Expand Up @@ -222,9 +236,16 @@ int main(void) {
init_signals();

for (bool once = true; running; once = false) {
scene_normalized = true;
example_single_channel();
example_multiple_channels();

example_clear();

scene_normalized = false;
example_single_channel();

example_multiple_channels();

if (once)
syslog(LOG_INFO, "All examples succeeded.");
}
Expand Down