Skip to content
Snippets Groups Projects
Commit 63bff2eb authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Again fix cmake for windows. Add disparity flip option and rgb display.

parent 8ca2528e
No related branches found
No related tags found
No related merge requests found
...@@ -13,8 +13,8 @@ enable_testing() ...@@ -13,8 +13,8 @@ enable_testing()
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
#include(Findglog) include(Findglog)
find_package( glog REQUIRED ) #find_package( glog REQUIRED )
find_package( OpenCV REQUIRED ) find_package( OpenCV REQUIRED )
find_package( Threads REQUIRED ) find_package( Threads REQUIRED )
find_package( URIParser REQUIRED ) find_package( URIParser REQUIRED )
......
...@@ -9,6 +9,7 @@ set(glog_DIR ${glog_DIR}) ...@@ -9,6 +9,7 @@ set(glog_DIR ${glog_DIR})
find_package(glog QUIET PATHS "${glog_DIR}/lib/cmake" NO_DEFAULT_PATH) find_package(glog QUIET PATHS "${glog_DIR}/lib/cmake" NO_DEFAULT_PATH)
if (GLOG_FOUND) if (GLOG_FOUND)
message(STATUS "Found installed glog")
return() return()
endif() endif()
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
"source": { "source": {
"flip": false, "flip": false,
"nostereo": false, "nostereo": false,
"scale": 1.0 "scale": 1.0,
"flip_vert": false
}, },
"calibrate": false, "calibrate": false,
"calibration": { "calibration": {
......
...@@ -31,6 +31,7 @@ class LocalSource { ...@@ -31,6 +31,7 @@ class LocalSource {
bool stereo_; bool stereo_;
//float fps_; //float fps_;
bool flip_; bool flip_;
bool flip_v_;
bool nostereo_; bool nostereo_;
float downsize_; float downsize_;
cv::VideoCapture *camera_a_; cv::VideoCapture *camera_a_;
......
...@@ -54,6 +54,10 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) { ...@@ -54,6 +54,10 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) {
#endif // HAVE_VIZ #endif // HAVE_VIZ
} }
if (config_["left"]) {
cv::imshow("RGB", rgb);
}
if (config_["depth"]) { if (config_["depth"]) {
/*Mat depth32F = (focal * (float)l.cols * base_line) / depth; /*Mat depth32F = (focal * (float)l.cols * base_line) / depth;
normalize(depth32F, depth32F, 0, 255, NORM_MINMAX, CV_8U); normalize(depth32F, depth32F, 0, 255, NORM_MINMAX, CV_8U);
...@@ -63,7 +67,13 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) { ...@@ -63,7 +67,13 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) {
active_ = false; active_ = false;
}*/ }*/
} else if (config_["disparity"]) { } 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); applyColorMap(idepth, idepth, cv::COLORMAP_JET);
cv::imshow("Disparity", idepth); cv::imshow("Disparity", idepth);
......
...@@ -21,8 +21,9 @@ using std::chrono::duration; ...@@ -21,8 +21,9 @@ using std::chrono::duration;
using std::chrono::high_resolution_clock; using std::chrono::high_resolution_clock;
LocalSource::LocalSource(nlohmann::json &config) LocalSource::LocalSource(nlohmann::json &config)
: timestamp_(0.0), : timestamp_(0.0),
flip_(config["flip"]), flip_(config["flip"]),
flip_v_(config["flip_vert"]),
nostereo_(config["nostereo"]), nostereo_(config["nostereo"]),
downsize_(config.value("scale", 1.0f)) { downsize_(config.value("scale", 1.0f)) {
// Use cameras // Use cameras
...@@ -55,6 +56,7 @@ LocalSource::LocalSource(nlohmann::json &config) ...@@ -55,6 +56,7 @@ LocalSource::LocalSource(nlohmann::json &config)
LocalSource::LocalSource(const string &vid, nlohmann::json &config) LocalSource::LocalSource(const string &vid, nlohmann::json &config)
: timestamp_(0.0), : timestamp_(0.0),
flip_(config["flip"]), flip_(config["flip"]),
flip_v_(config["flip_vert"]),
nostereo_(config["nostereo"]), nostereo_(config["nostereo"]),
downsize_(config.value("scale", 1.0f)) { downsize_(config.value("scale", 1.0f)) {
if (vid == "") { if (vid == "") {
...@@ -211,6 +213,14 @@ bool LocalSource::get(cv::Mat &l, cv::Mat &r) { ...@@ -211,6 +213,14 @@ bool LocalSource::get(cv::Mat &l, cv::Mat &r) {
0, 0, cv::INTER_LINEAR); 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; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment