Skip to content
Snippets Groups Projects
Commit 1657cb02 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Small fix for stereo video input reading bug

parent c971d703
No related branches found
No related tags found
No related merge requests found
...@@ -191,7 +191,7 @@ Calibrate::Calibrate(ftl::LocalSource *s, const std::string &cal) : local_(s) { ...@@ -191,7 +191,7 @@ Calibrate::Calibrate(ftl::LocalSource *s, const std::string &cal) : local_(s) {
bool Calibrate::recalibrate() { bool Calibrate::recalibrate() {
bool r = _recalibrate(0); bool r = _recalibrate(0);
if (local_->isStereo()) r |= _recalibrate(1); if (local_->isStereo()) r &= _recalibrate(1);
if (r) calibrated_ = true; if (r) calibrated_ = true;
...@@ -335,15 +335,12 @@ bool Calibrate::_recalibrate(size_t cam) { ...@@ -335,15 +335,12 @@ bool Calibrate::_recalibrate(size_t cam) {
//! [output_undistorted] //! [output_undistorted]
//------------------------------ Show image and check for input commands ------------------- //------------------------------ Show image and check for input commands -------------------
//! [await_input] //! [await_input]
/*imshow("Image View", view); imshow("Image View", view);
char key = (char)waitKey(s.inputCapture.isOpened() ? 50 : s.delay); char key = (char)waitKey(settings_.delay);
if( key == ESC_KEY ) if( key == 27 )
break; break;
if( key == 'u' && mode == CALIBRATED )
s.showUndistorsed = !s.showUndistorsed;*/
/*if( s.inputCapture.isOpened() && key == 'g' ) /*if( s.inputCapture.isOpened() && key == 'g' )
{ {
mode = CAPTURING; mode = CAPTURING;
......
...@@ -100,6 +100,10 @@ bool LocalSource::left(cv::Mat &l) { ...@@ -100,6 +100,10 @@ bool LocalSource::left(cv::Mat &l) {
} }
bool LocalSource::right(cv::Mat &r) { bool LocalSource::right(cv::Mat &r) {
if (!camera_a_->grab()) {
LOG(ERROR) << "Unable to grab from camera A";
return false;
}
if (camera_b_ && !camera_b_->grab()) { if (camera_b_ && !camera_b_->grab()) {
LOG(ERROR) << "Unable to grab from camera B"; LOG(ERROR) << "Unable to grab from camera B";
return false; return false;
......
...@@ -79,6 +79,7 @@ int main(int argc, char **argv) { ...@@ -79,6 +79,7 @@ int main(int argc, char **argv) {
Mat l, r; Mat l, r;
calibrate.undistort(l,r); calibrate.undistort(l,r);
//lsrc->get(l,r);
// Feed into sync buffer and network forward // Feed into sync buffer and network forward
sync->feed(LEFT, l,lsrc->getTimestamp()); sync->feed(LEFT, l,lsrc->getTimestamp());
...@@ -96,7 +97,7 @@ int main(int argc, char **argv) { ...@@ -96,7 +97,7 @@ int main(int argc, char **argv) {
cv::imshow("Left",l); cv::imshow("Left",l);
if (lsrc->isStereo()) cv::imshow("Right",r); if (lsrc->isStereo()) cv::imshow("Right",r);
if(cv::waitKey(1) == 27){ if(cv::waitKey(10000) == 27){
//exit if ESC is pressed //exit if ESC is pressed
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment