From 974fa5244cf0e9c33e03e058fba358656a813ef8 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 2 Mar 2020 14:21:07 +0200 Subject: [PATCH] Show camera info on screen --- applications/gui/src/camera.cpp | 1 + applications/gui/src/screen.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/applications/gui/src/camera.cpp b/applications/gui/src/camera.cpp index 61a83e223..f21cacd12 100644 --- a/applications/gui/src/camera.cpp +++ b/applications/gui/src/camera.cpp @@ -437,6 +437,7 @@ void ftl::gui::Camera::update(std::vector<ftl::rgbd::FrameSet*> &fss) { } else { name_ = "No name"; } + state_.getLeft() = frame->getLeftCamera(); return; } } diff --git a/applications/gui/src/screen.cpp b/applications/gui/src/screen.cpp index b5b642d89..71dc9e38a 100644 --- a/applications/gui/src/screen.cpp +++ b/applications/gui/src/screen.cpp @@ -587,7 +587,7 @@ void ftl::gui::Screen::draw(NVGcontext *ctx) { nvgTextAlign(ctx, NVG_ALIGN_RIGHT); - if (root()->value("show_information", false)) { + if (root()->value("show_information", true)) { string msg; // FIXME: Do not do this every frame, or cache the results every N frames... @@ -599,7 +599,15 @@ void ftl::gui::Screen::draw(NVGcontext *ctx) { nvgText(ctx, screenSize[0]-10, 40, msg.c_str(), NULL); msg = string("Bitrate: ") + to_string_with_precision(ftl::stream::Net::getRequiredBitrate(), 2) + string("Mbps"); - nvgText(ctx, screenSize[0]-10, 60, msg.c_str(), NULL); + nvgText(ctx, screenSize[0]-10, 60, msg.c_str(), NULL); + + if (camera_) { + auto intrin = camera_->getIntrinsics(); + msg = string("Resolution: ") + std::to_string(intrin.width) + string("x") + std::to_string(intrin.height); + nvgText(ctx, screenSize[0]-10, 80, msg.c_str(), NULL); + msg = string("Focal: ") + to_string_with_precision(intrin.fx, 2); + nvgText(ctx, screenSize[0]-10, 100, msg.c_str(), NULL); + } } nvgText(ctx, screenSize[0]-10, screenSize[1]-20, status_.c_str(), NULL); -- GitLab