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() {
net.subscribe(src, [&in](const vector<unsigned char> &jpg, const vector<unsigned char> &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();
......@@ -172,9 +168,10 @@ static void run() {
auto lk = source.lock();
Mat rgb = source.getRGB();
Mat disparity = source.getDisparity();
Mat q = source.getQ();
lk.unlock();
display.render(rgb, disparity);
display.render(rgb, disparity, q);
display.wait(50);
}
......
......@@ -33,9 +33,7 @@ class Display {
explicit Display(nlohmann::json &config, std::string name);
~Display();
void setCalibration(const cv::Mat &q) { q_ = q; }
bool render(const cv::Mat &rgb, const cv::Mat &depth);
bool render(const cv::Mat &rgb, const cv::Mat &depth, const cv::Mat &q);
#if defined HAVE_PCL
bool render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr);
......@@ -47,7 +45,6 @@ class Display {
void wait(int ms);
private:
cv::Mat q_;
nlohmann::json config_;
#if defined HAVE_VIZ
......
......@@ -77,13 +77,13 @@ Display::~Display() {
#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;
if (config_["points"] && q_.rows != 0) {
if (config_["points"] && q.rows != 0) {
#if defined HAVE_PCL
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);
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pc);
......@@ -96,7 +96,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) {
//cv::Mat Q_32F;
//calibrate_.getQ().convertTo(Q_32F, CV_32F);
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
XYZ.setTo(Vec3f(NAN, NAN, NAN), depth == 0.0f);
......@@ -181,7 +181,7 @@ bool Display::render(const cv::Mat &img, style_t s) {
}
void Display::wait(int ms) {
if (config_["points"] && q_.rows != 0) {
if (config_["points"]) {
#if defined HAVE_PCL
pclviz_->spinOnce(20);
#elif defined HAVE_VIZ
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment