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

Revert to default compression zlib due to depth artifacts using png or jpeg2000

parent be9fd540
No related branches found
No related tags found
No related merge requests found
Pipeline #9845 passed
...@@ -131,9 +131,9 @@ static void run(const string &file) { ...@@ -131,9 +131,9 @@ static void run(const string &file) {
cv::imdecode(jpg, cv::IMREAD_COLOR, &rgb); cv::imdecode(jpg, cv::IMREAD_COLOR, &rgb);
//LOG(INFO) << "Received JPG : " << rgb.cols; //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.zalloc = Z_NULL;
infstream.zfree = Z_NULL; infstream.zfree = Z_NULL;
infstream.opaque = Z_NULL; infstream.opaque = Z_NULL;
...@@ -146,9 +146,9 @@ static void run(const string &file) { ...@@ -146,9 +146,9 @@ static void run(const string &file) {
// the actual DE-compression work. // the actual DE-compression work.
inflateInit(&infstream); inflateInit(&infstream);
inflate(&infstream, Z_NO_FLUSH); inflate(&infstream, Z_NO_FLUSH);
inflateEnd(&infstream);*/ inflateEnd(&infstream);
cv::imdecode(d, cv::IMREAD_GRAYSCALE, &depth); //cv::imdecode(d, cv::IMREAD_GRAYSCALE, &depth);
//depth.convertTo(depth, CV_32FC1, 1.0f/(256.0f*16.0f)); //depth.convertTo(depth, CV_32FC1); //, 1.0f/16.0f); //, 1.0f/256.0f);
}); });
while (disp.active()) { while (disp.active()) {
......
...@@ -185,14 +185,13 @@ static void run(const string &file) { ...@@ -185,14 +185,13 @@ static void run(const string &file) {
calibrate.rectified(l, r); calibrate.rectified(l, r);
// Feed into sync buffer and network forward // Feed into sync buffer and network forward
sync->feed(ftl::LEFT, l, lsrc->getTimestamp()); //sync->feed(ftl::LEFT, l, lsrc->getTimestamp());
sync->feed(ftl::RIGHT, r, lsrc->getTimestamp()); //sync->feed(ftl::RIGHT, r, lsrc->getTimestamp());
// Read back from buffer // Read back from buffer
sync->get(ftl::LEFT, l); //sync->get(ftl::LEFT, l);
sync->get(ftl::RIGHT, r); //sync->get(ftl::RIGHT, r);
// TODO(nick) Pipeline this
disparity->compute(l, r, disp); disparity->compute(l, r, disp);
unique_lock<mutex> lk(m); unique_lock<mutex> lk(m);
...@@ -219,13 +218,11 @@ static void run(const string &file) { ...@@ -219,13 +218,11 @@ static void run(const string &file) {
}); });
// Send RGB+Depth images for local rendering // Send RGB+Depth images for local rendering
display.render(l, disp); if (pl.rows > 0) display.render(pl, pdisp);
display.wait(1); display.wait(1);
unique_lock<mutex> lk(m); unique_lock<mutex> lk(m);
cv.wait(lk, [&jobs]{return jobs == 2;}); cv.wait(lk, [&jobs]{return jobs == 2;});
//sleep_for(milliseconds(40));
l.copyTo(pl); l.copyTo(pl);
disp.copyTo(pdisp); disp.copyTo(pdisp);
......
...@@ -25,7 +25,7 @@ void Streamer::send(const Mat &rgb, const Mat &depth) { ...@@ -25,7 +25,7 @@ void Streamer::send(const Mat &rgb, const Mat &depth) {
cv::imencode(".jpg", rgb, rgb_buf); cv::imencode(".jpg", rgb, rgb_buf);
vector<unsigned char> d_buf; vector<unsigned char> d_buf;
/*d_buf.resize(depth.step*depth.rows); d_buf.resize(depth.step*depth.rows);
z_stream defstream; z_stream defstream;
defstream.zalloc = Z_NULL; defstream.zalloc = Z_NULL;
defstream.zfree = Z_NULL; defstream.zfree = Z_NULL;
...@@ -35,14 +35,14 @@ void Streamer::send(const Mat &rgb, const Mat &depth) { ...@@ -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.avail_out = (uInt)depth.step*depth.rows; // size of output
defstream.next_out = (Bytef *)d_buf.data(); // output char array defstream.next_out = (Bytef *)d_buf.data(); // output char array
deflateInit(&defstream, Z_BEST_COMPRESSION); deflateInit(&defstream, Z_DEFAULT_COMPRESSION);
deflate(&defstream, Z_FINISH); deflate(&defstream, Z_FINISH);
deflateEnd(&defstream); deflateEnd(&defstream);
d_buf.resize(defstream.total_out);*/ d_buf.resize(defstream.total_out);
//Mat d2; //Mat d2;
//depth.convertTo(d2, CV_16UC1, 256.0f*16.0f); //depth.convertTo(d2, CV_16UC1, 256);
cv::imencode(".png", depth, d_buf); //cv::imencode(".png", depth, d_buf);
LOG(INFO) << "Depth Size = " << ((float)d_buf.size() / (1024.0f*1024.0f)); LOG(INFO) << "Depth Size = " << ((float)d_buf.size() / (1024.0f*1024.0f));
net_.publish(uri_, rgb_buf, d_buf); net_.publish(uri_, rgb_buf, d_buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment