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

Merge branch 'master' of gitlab.utu.fi:nicolas.pope/ftl

parents 341b4bfd a34448c1
No related branches found
No related tags found
No related merge requests found
Pipeline #10928 passed
...@@ -143,7 +143,14 @@ static void run(const string &file) { ...@@ -143,7 +143,14 @@ static void run(const string &file) {
// Send RGB+Depth images for local rendering // Send RGB+Depth images for local rendering
if (prgb.rows > 0) display.render(prgb, pdepth, source->getParameters()); if (prgb.rows > 0) display.render(prgb, pdepth, source->getParameters());
if (config["display"]["right"]) cv::imshow("Right: ", source->getRight()); if (config["display"]["right"]) {
Mat rgbr = source->getRight().clone();
cv::namedWindow("Right: ", cv::WINDOW_KEEPRATIO);
cv::line(rgbr, cv::Point(0, rgbr.rows/2), cv::Point(rgbr.cols-1, rgbr.rows/2), cv::Scalar(0,0,255), 1);
cv::line(rgbr, cv::Point(rgbr.cols/2, 0), cv::Point(rgbr.cols/2, rgbr.rows-1), cv::Scalar(0,0,255), 1);
cv::imshow("Right: ", rgbr);
}
display.wait(1); display.wait(1);
// Wait for both pipelines to complete // Wait for both pipelines to complete
......
...@@ -11,19 +11,19 @@ if (Git_FOUND) ...@@ -11,19 +11,19 @@ if (Git_FOUND)
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" ftl_VERSION_MAJOR "${VERSION}") #string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" ftl_VERSION_MAJOR "${VERSION}")
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" ftl_VERSION_MINOR "${VERSION}") #string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" ftl_VERSION_MINOR "${VERSION}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" ftl_VERSION_PATCH "${VERSION}") #string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" ftl_VERSION_PATCH "${VERSION}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-([0-9]+).*" "\\1" ftl_VERSION_COMMITS "${VERSION}") #string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-([0-9]+).*" "\\1" ftl_VERSION_COMMITS "${VERSION}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+-(.*)" "\\1" ftl_VERSION_SHA1 "${VERSION}") #string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+-(.*)" "\\1" ftl_VERSION_SHA1 "${VERSION}")
set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"") #set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"")
else() else()
set(VERSION "unknown")
set(ftl_VERSION_MAJOR "0") #set(ftl_VERSION_MAJOR "0")
set(ftl_VERSION_MINOR "0") #set(ftl_VERSION_MINOR "0")
set(ftl_VERSION_PATCH "0") #set(ftl_VERSION_PATCH "0")
set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"") #set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"")
message(WARNING "Version could not be obtained from git") message(WARNING "Version could not be obtained from git")
......
#include <ftl/config.h> #include <ftl/config.h>
const char *FTL_VERSION_LONG = "@VERSION@"; const char *FTL_VERSION_LONG = "@VERSION@";
const char *FTL_VERSION = @FTL_VERSION@; const char *FTL_VERSION = "";
const int FTL_VERSION_MAJOR = @ftl_VERSION_MAJOR@; const int FTL_VERSION_MAJOR = 0;
const int FTL_VERSION_MINOR = @ftl_VERSION_MINOR@; const int FTL_VERSION_MINOR = 0;
const int FTL_VERSION_PATCH = @ftl_VERSION_PATCH@; const int FTL_VERSION_PATCH = 0;
const int FTL_VERSION_COMMITS = @ftl_VERSION_COMMITS@; const int FTL_VERSION_COMMITS = 0;
const char *FTL_VERSION_SHA1 = "@ftl_VERSION_SHA1@"; const char *FTL_VERSION_SHA1 = "";
...@@ -115,10 +115,15 @@ static bool mergeConfig(const string &path) { ...@@ -115,10 +115,15 @@ static bool mergeConfig(const string &path) {
ifstream i; ifstream i;
i.open(path); i.open(path);
if (i.is_open()) { if (i.is_open()) {
try {
json t; json t;
i >> t; i >> t;
config.merge_patch(t); config.merge_patch(t);
return true; return true;
} catch (json::parse_error& e) {
LOG(ERROR) << "Parse error in loading config: " << e.what();
return false;
}
} else { } else {
return false; return false;
} }
......
...@@ -19,6 +19,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) { ...@@ -19,6 +19,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) {
#endif // HAVE_VIZ #endif // HAVE_VIZ
#if defined HAVE_PCL #if defined HAVE_PCL
if (config.value("points", false)) {
pclviz_ = pcl::visualization::PCLVisualizer::Ptr(new pcl::visualization::PCLVisualizer ("FTL Cloud: " + name)); pclviz_ = pcl::visualization::PCLVisualizer::Ptr(new pcl::visualization::PCLVisualizer ("FTL Cloud: " + name));
pclviz_->setBackgroundColor (255, 255, 255); pclviz_->setBackgroundColor (255, 255, 255);
pclviz_->addCoordinateSystem (1.0); pclviz_->addCoordinateSystem (1.0);
...@@ -74,6 +75,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) { ...@@ -74,6 +75,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) {
viewer->setCameraParameters(cam); viewer->setCameraParameters(cam);
}, (void*)&pclviz_); }, (void*)&pclviz_);
}
#endif // HAVE_PCL #endif // HAVE_PCL
active_ = true; active_ = true;
...@@ -210,7 +212,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const ftl::rgbd:: ...@@ -210,7 +212,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const ftl::rgbd::
#if defined HAVE_PCL #if defined HAVE_PCL
bool Display::render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr pc) { bool Display::render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr pc) {
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pc); pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pc);
if (!pclviz_->updatePointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction")) { if (pclviz_ && !pclviz_->updatePointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction")) {
pclviz_->addPointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction"); pclviz_->addPointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction");
pclviz_->setCameraPosition(-878.0, -71.0, -2315.0, -0.1, -0.99, 0.068, 0.0, -1.0, 0.0); pclviz_->setCameraPosition(-878.0, -71.0, -2315.0, -0.1, -0.99, 0.068, 0.0, -1.0, 0.0);
pclviz_->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "reconstruction"); pclviz_->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "reconstruction");
...@@ -242,7 +244,7 @@ bool Display::render(const cv::Mat &img, style_t s) { ...@@ -242,7 +244,7 @@ bool Display::render(const cv::Mat &img, style_t s) {
void Display::wait(int ms) { void Display::wait(int ms) {
if (config_["points"]) { if (config_["points"]) {
#if defined HAVE_PCL #if defined HAVE_PCL
pclviz_->spinOnce(20); if (pclviz_) pclviz_->spinOnce(20);
#elif defined HAVE_VIZ #elif defined HAVE_VIZ
window_->spinOnce(1, true); window_->spinOnce(1, true);
#endif // HAVE_VIZ #endif // HAVE_VIZ
...@@ -258,7 +260,7 @@ void Display::wait(int ms) { ...@@ -258,7 +260,7 @@ void Display::wait(int ms) {
bool Display::active() const { bool Display::active() const {
#if defined HAVE_PCL #if defined HAVE_PCL
return active_ && !pclviz_->wasStopped(); return active_ && (!pclviz_ || !pclviz_->wasStopped());
#elif defined HAVE_VIZ #elif defined HAVE_VIZ
return active_ && !window_->wasStopped(); return active_ && !window_->wasStopped();
#else #else
......
...@@ -12,7 +12,9 @@ using cv::Mat; ...@@ -12,7 +12,9 @@ using cv::Mat;
FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) { FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) {
ssgm_ = nullptr; ssgm_ = nullptr;
use_filter_ = config.value("use_filter", false); use_filter_ = config.value("use_filter", false);
filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_, config.value("filter_radius", 25), config.value("filter_iter", 1)); // note: (max_disp_ << 4) libsgm subpixel accuracy.
// What is the impact in the filter? (possible artifacts)
filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, config.value("filter_radius", 25), config.value("filter_iter", 1));
} }
void FixstarsSGM::compute(const cv::Mat &l, const cv::Mat &r, cv::Mat &disp) { void FixstarsSGM::compute(const cv::Mat &l, const cv::Mat &r, cv::Mat &disp) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment