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
Branches
Tags
No related merge requests found
Pipeline #10928 passed
......@@ -143,7 +143,14 @@ static void run(const string &file) {
// Send RGB+Depth images for local rendering
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);
// Wait for both pipelines to complete
......
......@@ -11,19 +11,19 @@ if (Git_FOUND)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
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]+\\.([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_SHA1 "${VERSION}")
set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"")
#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]+\\.([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_SHA1 "${VERSION}")
#set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"")
else()
set(ftl_VERSION_MAJOR "0")
set(ftl_VERSION_MINOR "0")
set(ftl_VERSION_PATCH "0")
set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"")
set(VERSION "unknown")
#set(ftl_VERSION_MAJOR "0")
#set(ftl_VERSION_MINOR "0")
#set(ftl_VERSION_PATCH "0")
#set(FTL_VERSION "\"${ftl_VERSION_MAJOR}.${ftl_VERSION_MINOR}.${ftl_VERSION_PATCH}\"")
message(WARNING "Version could not be obtained from git")
......
#include <ftl/config.h>
const char *FTL_VERSION_LONG = "@VERSION@";
const char *FTL_VERSION = @FTL_VERSION@;
const int FTL_VERSION_MAJOR = @ftl_VERSION_MAJOR@;
const int FTL_VERSION_MINOR = @ftl_VERSION_MINOR@;
const int FTL_VERSION_PATCH = @ftl_VERSION_PATCH@;
const int FTL_VERSION_COMMITS = @ftl_VERSION_COMMITS@;
const char *FTL_VERSION_SHA1 = "@ftl_VERSION_SHA1@";
const char *FTL_VERSION = "";
const int FTL_VERSION_MAJOR = 0;
const int FTL_VERSION_MINOR = 0;
const int FTL_VERSION_PATCH = 0;
const int FTL_VERSION_COMMITS = 0;
const char *FTL_VERSION_SHA1 = "";
......@@ -115,10 +115,15 @@ static bool mergeConfig(const string &path) {
ifstream i;
i.open(path);
if (i.is_open()) {
try {
json t;
i >> t;
config.merge_patch(t);
return true;
} catch (json::parse_error& e) {
LOG(ERROR) << "Parse error in loading config: " << e.what();
return false;
}
} else {
return false;
}
......
......@@ -19,6 +19,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) {
#endif // HAVE_VIZ
#if defined HAVE_PCL
if (config.value("points", false)) {
pclviz_ = pcl::visualization::PCLVisualizer::Ptr(new pcl::visualization::PCLVisualizer ("FTL Cloud: " + name));
pclviz_->setBackgroundColor (255, 255, 255);
pclviz_->addCoordinateSystem (1.0);
......@@ -74,6 +75,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) {
viewer->setCameraParameters(cam);
}, (void*)&pclviz_);
}
#endif // HAVE_PCL
active_ = true;
......@@ -210,7 +212,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const ftl::rgbd::
#if defined HAVE_PCL
bool Display::render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr 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_->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");
......@@ -242,7 +244,7 @@ bool Display::render(const cv::Mat &img, style_t s) {
void Display::wait(int ms) {
if (config_["points"]) {
#if defined HAVE_PCL
pclviz_->spinOnce(20);
if (pclviz_) pclviz_->spinOnce(20);
#elif defined HAVE_VIZ
window_->spinOnce(1, true);
#endif // HAVE_VIZ
......@@ -258,7 +260,7 @@ void Display::wait(int ms) {
bool Display::active() const {
#if defined HAVE_PCL
return active_ && !pclviz_->wasStopped();
return active_ && (!pclviz_ || !pclviz_->wasStopped());
#elif defined HAVE_VIZ
return active_ && !window_->wasStopped();
#else
......
......@@ -12,7 +12,9 @@ using cv::Mat;
FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) {
ssgm_ = nullptr;
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment