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

add check

parent 721c6752
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #28311 passed
...@@ -19,9 +19,10 @@ public: ...@@ -19,9 +19,10 @@ public:
void set(unsigned int flag) { flags_ |= flag; } void set(unsigned int flag) { flags_ |= flag; }
void unset(unsigned int flag) { flags_ &= ~flag; } void unset(unsigned int flag) { flags_ &= ~flag; }
void reset() { flags_ = 0; } void reset() { flags_ = 0; }
std::string name(int) const;
int defaultFlags() const; int defaultFlags() const;
std::vector<int> list() const; std::vector<int> list() const;
std::string name(int) const;
std::string explain(int) const; std::string explain(int) const;
operator int() { return flags_; } operator int() { return flags_; }
...@@ -36,8 +37,6 @@ public: ...@@ -36,8 +37,6 @@ public:
std::string explain(int) const; std::string explain(int) const;
}; };
/** /**
* Calibration. Loads Intrinsic and Extrinsic calibration modules and * Calibration. Loads Intrinsic and Extrinsic calibration modules and
* adds buttons to main screen. * adds buttons to main screen.
...@@ -313,6 +312,8 @@ private: ...@@ -313,6 +312,8 @@ private:
std::future<void> future_; std::future<void> future_;
std::mutex mtx_; std::mutex mtx_;
ftl::data::FrameSetPtr fs_current_;
ftl::data::FrameSetPtr fs_update_;
struct State { struct State {
cv::Mat gray_left; cv::Mat gray_left;
...@@ -328,10 +329,9 @@ private: ...@@ -328,10 +329,9 @@ private:
float last = 0.0f; float last = 0.0f;
float frequency = 0.5f; float frequency = 0.5f;
int count = 0; int count = 0;
float reprojection_error = NAN;
OpenCVCalibrateFlagsStereo flags; OpenCVCalibrateFlagsStereo flags;
ftl::data::FrameSetPtr fs_current;
ftl::data::FrameSetPtr fs_updated;
ftl::data::FrameSetPtr fs_previous_points; ftl::data::FrameSetPtr fs_previous_points;
std::vector<std::vector<cv::Point2f>> points_l; std::vector<std::vector<cv::Point2f>> points_l;
std::vector<std::vector<cv::Point2f>> points_r; std::vector<std::vector<cv::Point2f>> points_r;
......
...@@ -135,6 +135,7 @@ bool StereoCalibration::onFrame_(const ftl::data::FrameSetPtr& fs) { ...@@ -135,6 +135,7 @@ bool StereoCalibration::onFrame_(const ftl::data::FrameSetPtr& fs) {
auto& frame = fs->frames[state_->id.source()]; auto& frame = fs->frames[state_->id.source()];
if (!checkFrame(frame)) { return true; } if (!checkFrame(frame)) { return true; }
if (!frame.hasAll({channelLeft_(), channelRight_()})) { return true; }
if (!state_->capture) { return true; } if (!state_->capture) { return true; }
if ((float(glfwGetTime()) - state_->last) < state_->frequency) { return true; } if ((float(glfwGetTime()) - state_->last) < state_->frequency) { return true; }
if (state_->running.exchange(true)) { return true; } if (state_->running.exchange(true)) { return true; }
...@@ -143,8 +144,10 @@ bool StereoCalibration::onFrame_(const ftl::data::FrameSetPtr& fs) { ...@@ -143,8 +144,10 @@ bool StereoCalibration::onFrame_(const ftl::data::FrameSetPtr& fs) {
try { try {
auto& frame = (*fs)[state_->id.source()].cast<ftl::rgbd::Frame>(); auto& frame = (*fs)[state_->id.source()].cast<ftl::rgbd::Frame>();
cv::cvtColor(getMat(frame, channelLeft_()), state_->gray_left, cv::COLOR_BGRA2GRAY); auto l = getMat(frame, channelLeft_());
cv::cvtColor(getMat(frame, channelRight_()), state_->gray_right, cv::COLOR_BGRA2GRAY); auto r = getMat(frame, channelRight_());
cv::cvtColor(l, state_->gray_left, cv::COLOR_BGRA2GRAY);
cv::cvtColor(r, state_->gray_right, cv::COLOR_BGRA2GRAY);
std::vector<cv::Point2d> pointsl; std::vector<cv::Point2d> pointsl;
std::vector<cv::Point2d> pointsr; std::vector<cv::Point2d> pointsr;
...@@ -203,8 +206,10 @@ bool StereoCalibration::isBusy() { ...@@ -203,8 +206,10 @@ bool StereoCalibration::isBusy() {
} }
void StereoCalibration::run() { void StereoCalibration::run() {
if (state_->running) { return; }
state_->running = true; state_->running = true;
future_ = ftl::pool.push([this](int id) { future_ = ftl::pool.push([this](int) {
try { try {
auto& calib_l = state_->calib.get(Channel::Left); auto& calib_l = state_->calib.get(Channel::Left);
auto& calib_r = state_->calib.get(Channel::Right); auto& calib_r = state_->calib.get(Channel::Right);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment