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()
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 )
......
......@@ -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()
......
......@@ -7,7 +7,8 @@
"source": {
"flip": false,
"nostereo": false,
"scale": 1.0
"scale": 1.0,
"flip_vert": false
},
"calibrate": false,
"calibration": {
......
......@@ -31,6 +31,7 @@ class LocalSource {
bool stereo_;
//float fps_;
bool flip_;
bool flip_v_;
bool nostereo_;
float downsize_;
cv::VideoCapture *camera_a_;
......
......@@ -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);
......
......@@ -23,6 +23,7 @@ using std::chrono::high_resolution_clock;
LocalSource::LocalSource(nlohmann::json &config)
: 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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment