diff --git a/CMakeLists.txt b/CMakeLists.txt index 969acb22dd27331df6075f0247985e6cd3dbdb3b..ac657f10407f1a6ce66f2543cb47418709538dd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,8 @@ enable_testing() set(THREADS_PREFER_PTHREAD_FLAG ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") -#include(Findglog) -find_package( glog REQUIRED ) +include(Findglog) +#find_package( glog REQUIRED ) find_package( OpenCV REQUIRED ) find_package( Threads REQUIRED ) find_package( URIParser REQUIRED ) diff --git a/cmake/Findglog.cmake b/cmake/Findglog.cmake index 9079190dcb3d7aecd54ff029542af64b2f4bf5e1..6b07e3ba4b53997e844ba3a134de15be2236abdf 100644 --- a/cmake/Findglog.cmake +++ b/cmake/Findglog.cmake @@ -9,6 +9,7 @@ set(glog_DIR ${glog_DIR}) find_package(glog QUIET PATHS "${glog_DIR}/lib/cmake" NO_DEFAULT_PATH) if (GLOG_FOUND) +message(STATUS "Found installed glog") return() endif() diff --git a/cv-node/config/config.json b/cv-node/config/config.json index a0bf49e5024c2287fa407c6981de0fa4cfaebae1..1979288d6ae9921c0b25fa14a4de2be2f077cde3 100644 --- a/cv-node/config/config.json +++ b/cv-node/config/config.json @@ -7,7 +7,8 @@ "source": { "flip": false, "nostereo": false, - "scale": 1.0 + "scale": 1.0, + "flip_vert": false }, "calibrate": false, "calibration": { diff --git a/cv-node/include/ftl/local.hpp b/cv-node/include/ftl/local.hpp index f4c98f357f8da25c2cfac8d9058bf99362db2ab3..cf18b9928ac8d0e4e13479cced920ae3038b0df2 100644 --- a/cv-node/include/ftl/local.hpp +++ b/cv-node/include/ftl/local.hpp @@ -31,6 +31,7 @@ class LocalSource { bool stereo_; //float fps_; bool flip_; + bool flip_v_; bool nostereo_; float downsize_; cv::VideoCapture *camera_a_; diff --git a/cv-node/src/display.cpp b/cv-node/src/display.cpp index 4889b8026b83a0dde90eb7e2bb1b06d7d411dbb8..52a8a39fa1d1ac3640ee7f7d5c4332f347a050c6 100644 --- a/cv-node/src/display.cpp +++ b/cv-node/src/display.cpp @@ -54,6 +54,10 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) { #endif // HAVE_VIZ } + if (config_["left"]) { + cv::imshow("RGB", rgb); + } + if (config_["depth"]) { /*Mat depth32F = (focal * (float)l.cols * base_line) / depth; normalize(depth32F, depth32F, 0, 255, NORM_MINMAX, CV_8U); @@ -63,7 +67,13 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) { active_ = false; }*/ } else if (config_["disparity"]) { - depth.convertTo(idepth, CV_8U, 255.0f / 208.0f); // TODO(nick) + if ((bool)config_["flip_vert"]) { + cv::flip(depth, idepth, 0); + } else { + idepth = depth; + } + + idepth.convertTo(idepth, CV_8U, 255.0f / 256.0f); // TODO(nick) applyColorMap(idepth, idepth, cv::COLORMAP_JET); cv::imshow("Disparity", idepth); diff --git a/cv-node/src/local.cpp b/cv-node/src/local.cpp index cb7ee6484148d7c7f5cf917a46db512f4cf1d20a..ea000e1a07c6550fc5085db59ed6106fe80fb181 100644 --- a/cv-node/src/local.cpp +++ b/cv-node/src/local.cpp @@ -21,8 +21,9 @@ using std::chrono::duration; using std::chrono::high_resolution_clock; LocalSource::LocalSource(nlohmann::json &config) - : timestamp_(0.0), + : timestamp_(0.0), flip_(config["flip"]), + flip_v_(config["flip_vert"]), nostereo_(config["nostereo"]), downsize_(config.value("scale", 1.0f)) { // Use cameras @@ -55,6 +56,7 @@ LocalSource::LocalSource(nlohmann::json &config) LocalSource::LocalSource(const string &vid, nlohmann::json &config) : timestamp_(0.0), flip_(config["flip"]), + flip_v_(config["flip_vert"]), nostereo_(config["nostereo"]), downsize_(config.value("scale", 1.0f)) { if (vid == "") { @@ -211,6 +213,14 @@ bool LocalSource::get(cv::Mat &l, cv::Mat &r) { 0, 0, cv::INTER_LINEAR); } + if (flip_v_) { + Mat tl, tr; + cv::flip(l, tl, 0); + cv::flip(r, tr, 0); + l = tl; + r = tr; + } + return true; }