diff --git a/applications/vision/src/main.cpp b/applications/vision/src/main.cpp index 620ebd738f46c493471e0106bf4ed30377cb4e3b..0119a659aa14f0cfc43d25ff97349ba6ad9600e9 100644 --- a/applications/vision/src/main.cpp +++ b/applications/vision/src/main.cpp @@ -95,16 +95,20 @@ static void run(ftl::Configurable *root) { Streamer *stream = ftl::create<Streamer>(root, "stream", net); stream->add(source); - stream->run(); - + net->start(); - LOG(INFO) << "Running..."; - while (ftl::running && display->active()) { - cv::Mat rgb, depth; - source->getFrames(rgb, depth); - if (!rgb.empty()) display->render(rgb, depth, source->parameters()); - display->wait(10); + LOG(INFO) << "Running..."; + if (display->hasDisplays()) { + stream->run(); + while (ftl::running && display->active()) { + cv::Mat rgb, depth; + source->getFrames(rgb, depth); + if (!rgb.empty()) display->render(rgb, depth, source->parameters()); + display->wait(10); + } + } else { + stream->run(true); } LOG(INFO) << "Stopping..."; diff --git a/components/renderers/cpp/include/ftl/display.hpp b/components/renderers/cpp/include/ftl/display.hpp index 2e56c459bac79a8e704d0d331ff8f0a926f6fdaa..05ae0bf11e5ebc3a5b8d54339bc85166effbb4a9 100644 --- a/components/renderers/cpp/include/ftl/display.hpp +++ b/components/renderers/cpp/include/ftl/display.hpp @@ -43,6 +43,8 @@ class Display : public ftl::Configurable { bool render(const cv::Mat &img, style_t s=STYLE_NORMAL); bool active() const; + + bool hasDisplays(); void wait(int ms); diff --git a/components/renderers/cpp/src/display.cpp b/components/renderers/cpp/src/display.cpp index c255a8bcc524e013fbc6ab96f2b672b67f760656..0f838df751d0c0a315f4d0acca9798d2d7741066 100644 --- a/components/renderers/cpp/src/display.cpp +++ b/components/renderers/cpp/src/display.cpp @@ -243,6 +243,10 @@ bool Display::render(const cv::Mat &img, style_t s) { return true; } +bool Display::hasDisplays() { + return value("depth", false) || value("left", false) || value("right", false) || value("points", false); +} + void Display::wait(int ms) { if (value("points", false)) { #if defined HAVE_PCL