diff --git a/applications/reconstruct/src/main.cpp b/applications/reconstruct/src/main.cpp index 33db96ae046a1ee5c29898a503d0c483446e7f91..dac32881b73df64b9c02d8803c4b6eba6e763871 100644 --- a/applications/reconstruct/src/main.cpp +++ b/applications/reconstruct/src/main.cpp @@ -82,8 +82,8 @@ static Eigen::Affine3d create_rotation_matrix(float ax, float ay, float az) { return rz * rx * ry; } -// TODO: * Remove this class (requires more general solution). Also does not -// process disconnections/reconnections/types etc. correctly. +// TODO: * Remove this class (requires more general solution). Also does +// not process disconnections/reconnections/types etc. correctly. // * Update when new options become available. class ConfigProxy { @@ -216,6 +216,7 @@ static void run(ftl::Configurable *root) { for (auto &input : sources) { string uri = input->getURI(); + auto T = transformations.find(uri); if (T == transformations.end()) { LOG(WARNING) << "Camera pose for " + uri + " not found in transformations"; diff --git a/components/rgbd-sources/src/source.cpp b/components/rgbd-sources/src/source.cpp index c757ddc84d0e8023dd847cdbf548c17b79637d57..4a7873515a2a77faf44965e94208ec005085caf8 100644 --- a/components/rgbd-sources/src/source.cpp +++ b/components/rgbd-sources/src/source.cpp @@ -303,11 +303,6 @@ void Source::notify(int64_t ts, cv::cuda::GpuMat &c1, cv::cuda::GpuMat &c2) { int max_width = max(impl_->params_.width, max(c1.cols, c2.cols)); int max_height = max(impl_->params_.height, max(c1.rows, c2.rows)); - // Do we need to scale camera parameters - if (impl_->params_.width < max_width || impl_->params_.height < max_height) { - impl_->params_ = impl_->params_.scaled(max_width, max_height); - } - if (callback_) callback_(ts, c1, c2); } diff --git a/components/rgbd-sources/src/sources/stereovideo/calibrate.hpp b/components/rgbd-sources/src/sources/stereovideo/calibrate.hpp index a30abce1fc96b10198d76a09f03da37df26f1bcb..39ec301a98d8419cc19dfb0bb60747e20a6327ff 100644 --- a/components/rgbd-sources/src/sources/stereovideo/calibrate.hpp +++ b/components/rgbd-sources/src/sources/stereovideo/calibrate.hpp @@ -49,20 +49,12 @@ class Calibrate : public ftl::Configurable { void updateCalibration(const ftl::rgbd::Camera &p); - /** - * Get the camera matrix. Used to convert disparity map back to depth and - * a 3D point cloud. - */ + // Get disparity to depth matrix. const cv::Mat &getQ() const { return Q_; } cv::Mat getCameraMatrixLeft(const cv::Size res); cv::Mat getCameraMatrixRight(const cv::Size res); - // TODO: Remove. Always require resolution for correct scaling - const cv::Mat &getCameraMatrixLeft() { return Kl_; } - const cv::Mat &getCameraMatrixRight() { return Kr_; } - const cv::Mat &getCameraMatrix() { return getCameraMatrixLeft(); } - private: void _updateIntrinsics(); bool _loadCalibration(cv::Size img_size, std::pair<cv::Mat, cv::Mat> &map1, std::pair<cv::Mat, cv::Mat> &map2); diff --git a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp index 5b94356c6674df9f0c7936cfd475b221d2bc0b9c..1a90f915c6956033868d5b006382e8affbefe6ff 100644 --- a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp +++ b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp @@ -151,22 +151,22 @@ void StereoVideoSource::init(const string &file) { } ftl::rgbd::Camera StereoVideoSource::parameters(Channel chan) { - cv::Mat q; + cv::Mat K; if (chan == Channel::Right) { - q = calib_->getCameraMatrixRight(depth_size_); + K = calib_->getCameraMatrixRight(depth_size_); } else { - q = calib_->getCameraMatrixLeft(depth_size_); + K = calib_->getCameraMatrixLeft(depth_size_); } // TODO: remove hardcoded values (min/max) ftl::rgbd::Camera params = { - q.at<double>(0,0), // Fx - q.at<double>(1,1), // Fy - -q.at<double>(0,2), // Cx - -q.at<double>(1,2), // Cy - (unsigned int)lsrc_->width(), - (unsigned int)lsrc_->height(), + K.at<double>(0,0), // Fx + K.at<double>(1,1), // Fy + -K.at<double>(0,2), // Cx + -K.at<double>(1,2), // Cy + (unsigned int) depth_size_.width, + (unsigned int) depth_size_.height, 0.0f, // 0m min 15.0f, // 15m max 1.0 / calib_->getQ().at<double>(3,2), // Baseline diff --git a/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp b/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp index 6cd5a09b67bbbf0e4e6e66ccfa8056f293194e40..9532e618889e78da51e1e152673195000e93be7f 100644 --- a/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp +++ b/components/rgbd-sources/src/sources/stereovideo/stereovideo.hpp @@ -17,9 +17,7 @@ class Disparity; /** * RGBD source from either a stereo video file with left + right images, or - * direct from two camera devices. A variety of algorithms are included for - * calculating disparity, before converting to depth. Calibration of the images - * is also performed. + * direct from two camera devices. */ class StereoVideoSource : public detail::Source { public: @@ -32,7 +30,7 @@ class StereoVideoSource : public detail::Source { bool retrieve(); bool compute(int n, int b); bool isReady(); - Camera parameters(ftl::codecs::Channel chan); + Camera parameters(ftl::codecs::Channel chan) override; private: LocalSource *lsrc_;