diff --git a/reconstruct/src/main.cpp b/reconstruct/src/main.cpp index 1df292d6c71f3b34646530fa1bb418267e31e937..38707af3f2bf682368130856f2556cf384742c39 100644 --- a/reconstruct/src/main.cpp +++ b/reconstruct/src/main.cpp @@ -131,9 +131,9 @@ static void run(const string &file) { cv::imdecode(jpg, cv::IMREAD_COLOR, &rgb); //LOG(INFO) << "Received JPG : " << rgb.cols; - //depth = Mat(rgb.size(), CV_16UC1); + depth = Mat(rgb.size(), CV_32FC1); - /*z_stream infstream; + z_stream infstream; infstream.zalloc = Z_NULL; infstream.zfree = Z_NULL; infstream.opaque = Z_NULL; @@ -146,9 +146,9 @@ static void run(const string &file) { // the actual DE-compression work. inflateInit(&infstream); inflate(&infstream, Z_NO_FLUSH); - inflateEnd(&infstream);*/ - cv::imdecode(d, cv::IMREAD_GRAYSCALE, &depth); - //depth.convertTo(depth, CV_32FC1, 1.0f/(256.0f*16.0f)); + inflateEnd(&infstream); + //cv::imdecode(d, cv::IMREAD_GRAYSCALE, &depth); + //depth.convertTo(depth, CV_32FC1); //, 1.0f/16.0f); //, 1.0f/256.0f); }); while (disp.active()) { diff --git a/vision/src/main.cpp b/vision/src/main.cpp index 2d86556161176bcf6a97cfc4c4031c2e33960434..cc25a334be8d49afa01ab37d179b69791dcc87a3 100644 --- a/vision/src/main.cpp +++ b/vision/src/main.cpp @@ -185,14 +185,13 @@ static void run(const string &file) { calibrate.rectified(l, r); // Feed into sync buffer and network forward - sync->feed(ftl::LEFT, l, lsrc->getTimestamp()); - sync->feed(ftl::RIGHT, r, lsrc->getTimestamp()); + //sync->feed(ftl::LEFT, l, lsrc->getTimestamp()); + //sync->feed(ftl::RIGHT, r, lsrc->getTimestamp()); // Read back from buffer - sync->get(ftl::LEFT, l); - sync->get(ftl::RIGHT, r); + //sync->get(ftl::LEFT, l); + //sync->get(ftl::RIGHT, r); - // TODO(nick) Pipeline this disparity->compute(l, r, disp); unique_lock<mutex> lk(m); @@ -219,13 +218,11 @@ static void run(const string &file) { }); // Send RGB+Depth images for local rendering - display.render(l, disp); + if (pl.rows > 0) display.render(pl, pdisp); display.wait(1); unique_lock<mutex> lk(m); cv.wait(lk, [&jobs]{return jobs == 2;}); - - //sleep_for(milliseconds(40)); l.copyTo(pl); disp.copyTo(pdisp); diff --git a/vision/src/streamer.cpp b/vision/src/streamer.cpp index 43cbb220e3dd2d0f1ec15b533919c9ee7a9dc807..8c359ad594a8f50baf34a092ec99d82a4d1b6fe9 100644 --- a/vision/src/streamer.cpp +++ b/vision/src/streamer.cpp @@ -25,7 +25,7 @@ void Streamer::send(const Mat &rgb, const Mat &depth) { cv::imencode(".jpg", rgb, rgb_buf); vector<unsigned char> d_buf; - /*d_buf.resize(depth.step*depth.rows); + d_buf.resize(depth.step*depth.rows); z_stream defstream; defstream.zalloc = Z_NULL; defstream.zfree = Z_NULL; @@ -35,14 +35,14 @@ void Streamer::send(const Mat &rgb, const Mat &depth) { defstream.avail_out = (uInt)depth.step*depth.rows; // size of output defstream.next_out = (Bytef *)d_buf.data(); // output char array - deflateInit(&defstream, Z_BEST_COMPRESSION); + deflateInit(&defstream, Z_DEFAULT_COMPRESSION); deflate(&defstream, Z_FINISH); deflateEnd(&defstream); - d_buf.resize(defstream.total_out);*/ + d_buf.resize(defstream.total_out); //Mat d2; - //depth.convertTo(d2, CV_16UC1, 256.0f*16.0f); - cv::imencode(".png", depth, d_buf); + //depth.convertTo(d2, CV_16UC1, 256); + //cv::imencode(".png", depth, d_buf); LOG(INFO) << "Depth Size = " << ((float)d_buf.size() / (1024.0f*1024.0f)); net_.publish(uri_, rgb_buf, d_buf);