Skip to content
Snippets Groups Projects
Commit 4559b1fa authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

Remove Q from Display

parent b9e55e75
No related branches found
No related tags found
No related merge requests found
Pipeline #10616 failed
...@@ -149,10 +149,6 @@ static void run() { ...@@ -149,10 +149,6 @@ static void run() {
net.subscribe(src, [&in](const vector<unsigned char> &jpg, const vector<unsigned char> &d) { net.subscribe(src, [&in](const vector<unsigned char> &jpg, const vector<unsigned char> &d) {
in.recv(jpg, d); in.recv(jpg, d);
}); });
// todo: Display should only need processed input, depth calculation etc.
// should happen somewhere else.
display.setCalibration(in.getQ());
} }
int active = displays.size(); int active = displays.size();
...@@ -172,9 +168,10 @@ static void run() { ...@@ -172,9 +168,10 @@ static void run() {
auto lk = source.lock(); auto lk = source.lock();
Mat rgb = source.getRGB(); Mat rgb = source.getRGB();
Mat disparity = source.getDisparity(); Mat disparity = source.getDisparity();
Mat q = source.getQ();
lk.unlock(); lk.unlock();
display.render(rgb, disparity); display.render(rgb, disparity, q);
display.wait(50); display.wait(50);
} }
......
...@@ -33,9 +33,7 @@ class Display { ...@@ -33,9 +33,7 @@ class Display {
explicit Display(nlohmann::json &config, std::string name); explicit Display(nlohmann::json &config, std::string name);
~Display(); ~Display();
void setCalibration(const cv::Mat &q) { q_ = q; } bool render(const cv::Mat &rgb, const cv::Mat &depth, const cv::Mat &q);
bool render(const cv::Mat &rgb, const cv::Mat &depth);
#if defined HAVE_PCL #if defined HAVE_PCL
bool render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr); bool render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr);
...@@ -47,7 +45,6 @@ class Display { ...@@ -47,7 +45,6 @@ class Display {
void wait(int ms); void wait(int ms);
private: private:
cv::Mat q_;
nlohmann::json config_; nlohmann::json config_;
#if defined HAVE_VIZ #if defined HAVE_VIZ
......
...@@ -77,13 +77,13 @@ Display::~Display() { ...@@ -77,13 +77,13 @@ Display::~Display() {
#endif // HAVE_VIZ #endif // HAVE_VIZ
} }
bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) { bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const cv::Mat &q) {
Mat idepth; Mat idepth;
if (config_["points"] && q_.rows != 0) { if (config_["points"] && q.rows != 0) {
#if defined HAVE_PCL #if defined HAVE_PCL
cv::Mat_<cv::Vec3f> XYZ(depth.rows, depth.cols); // Output point cloud cv::Mat_<cv::Vec3f> XYZ(depth.rows, depth.cols); // Output point cloud
reprojectImageTo3D(depth, XYZ, q_, false); reprojectImageTo3D(depth, XYZ, q, false);
auto pc = ftl::utility::matToPointXYZ(XYZ, rgb); auto pc = ftl::utility::matToPointXYZ(XYZ, rgb);
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pc); pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pc);
...@@ -96,7 +96,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) { ...@@ -96,7 +96,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) {
//cv::Mat Q_32F; //cv::Mat Q_32F;
//calibrate_.getQ().convertTo(Q_32F, CV_32F); //calibrate_.getQ().convertTo(Q_32F, CV_32F);
cv::Mat_<cv::Vec3f> XYZ(depth.rows, depth.cols); // Output point cloud cv::Mat_<cv::Vec3f> XYZ(depth.rows, depth.cols); // Output point cloud
reprojectImageTo3D(depth+20.0f, XYZ, q_, true); reprojectImageTo3D(depth+20.0f, XYZ, q, true);
// Remove all invalid pixels from point cloud // Remove all invalid pixels from point cloud
XYZ.setTo(Vec3f(NAN, NAN, NAN), depth == 0.0f); XYZ.setTo(Vec3f(NAN, NAN, NAN), depth == 0.0f);
...@@ -181,7 +181,7 @@ bool Display::render(const cv::Mat &img, style_t s) { ...@@ -181,7 +181,7 @@ bool Display::render(const cv::Mat &img, style_t s) {
} }
void Display::wait(int ms) { void Display::wait(int ms) {
if (config_["points"] && q_.rows != 0) { if (config_["points"]) {
#if defined HAVE_PCL #if defined HAVE_PCL
pclviz_->spinOnce(20); pclviz_->spinOnce(20);
#elif defined HAVE_VIZ #elif defined HAVE_VIZ
......
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