diff --git a/Sources/src/Visnode/CMakeLists.txt b/Sources/src/Visnode/CMakeLists.txt index 6c07026..40d19d0 100644 --- a/Sources/src/Visnode/CMakeLists.txt +++ b/Sources/src/Visnode/CMakeLists.txt @@ -1,7 +1,10 @@ cmake_minimum_required(VERSION 3.22) set(CMAKE_CXX_STANDARD 17) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + +#set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g -Ofast") +set(CMAKE_CXX_FLAGS_RELEASE "-Ofast") project(visnode) diff --git a/Sources/src/Visnode/main.cpp b/Sources/src/Visnode/main.cpp index 162bcfa..186f8a3 100644 --- a/Sources/src/Visnode/main.cpp +++ b/Sources/src/Visnode/main.cpp @@ -2,6 +2,17 @@ #include using namespace psvr; +template < + class result_t = std::chrono::milliseconds, + class clock_t = std::chrono::steady_clock, + class duration_t = std::chrono::milliseconds +> + +auto since(std::chrono::time_point const& start) +{ + return std::chrono::duration_cast(clock_t::now() - start); +} + int main(int argc, char* argv[]) { //psvr::Psvr::open(); @@ -15,11 +26,41 @@ fobj.get(); cameraManager::runCapture(); SerialPortManager::init(); ui::UiController::exitCalled = false; + +int i = 0,count = 1; +_Float64 avgr=0,avgl=0; + while(!ui::UiController::exitCalled){ + #ifdef DBGMODE + auto start = std::chrono::steady_clock::now(); + #endif std::future uiL = std::async (ui::UiDrawer::drawUiL); std::future uiR = std::async (ui::UiDrawer::drawUiR); uiL.get(); + #ifdef DBGMODE + auto end1 = since(start).count(); + #endif uiR.get(); + #ifdef DBGMODE + auto end2 = since(start).count(); + #endif + #ifdef DBGMODE + std::cout << "Elapsed(ms)=" << end1 << "," << end2 << std::endl; + if(avgr == 0){ + avgr = end1; + avgl = end2; + }else{ + avgr = (avgr+end1)/count; + avgl = (avgl+end2)/count; + } + + if(i > 100){ + //std::cout << "\nAVERAGES " << 1000/(avgr*10000) << "," << 1000/(avgl*10000) << std::endl; + i=0; + } + i++; + count++; + #endif } return 0; } diff --git a/Sources/src/Visnode/prog b/Sources/src/Visnode/prog index 1831c0e..1c04364 100755 Binary files a/Sources/src/Visnode/prog and b/Sources/src/Visnode/prog differ diff --git a/Sources/src/Visnode/threadweaver/debugging.hpp b/Sources/src/Visnode/threadweaver/debugging.hpp index 01aa14c..b71bdf9 100644 --- a/Sources/src/Visnode/threadweaver/debugging.hpp +++ b/Sources/src/Visnode/threadweaver/debugging.hpp @@ -3,7 +3,4 @@ #define DBGMODE -#define DBGPRINT(x) do { \ - if (DBGMODE) { std::cerr << x << std::endl; } \ -} while (0) - +//#define DBGPRINT(x) do { if (DBGMODE) { std::cerr << x << std::endl; }} while (0) \ No newline at end of file diff --git a/Sources/src/Visnode/ui/uiDrawer.cpp b/Sources/src/Visnode/ui/uiDrawer.cpp index 9805927..80801ef 100644 --- a/Sources/src/Visnode/ui/uiDrawer.cpp +++ b/Sources/src/Visnode/ui/uiDrawer.cpp @@ -103,6 +103,7 @@ namespace ui{ ///if a non transparent picture is supplied (3 channels), it will be made transparent by using black as a mask Mat UiDrawer::OverlayBlackMask(Mat input, Mat toOverlay, int x, int y){ + //return input; if(input.cols < toOverlay.cols || input.rows < toOverlay.rows) return input; Mat toOverlayGRAY, mask; @@ -122,7 +123,7 @@ namespace ui{ } Mat UiDrawer::OverlayHISHMask(Mat input, Mat toOverlay){ - if(input.cols < toOverlay.cols || input.rows < toOverlay.rows) return input; + if(input.cols < toOverlay.cols || input.rows < toOverlay.rows) return input; Mat toOverlayGRAY, mask; vector Bands;