Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
0e5bf6d1
Commit
0e5bf6d1
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Back to PNG with some fixes to make quality apparently equal to zlib (should be the same)
parent
ecc53aa0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
reconstruct/src/main.cpp
+5
-5
5 additions, 5 deletions
reconstruct/src/main.cpp
vision/src/streamer.cpp
+18
-6
18 additions, 6 deletions
vision/src/streamer.cpp
with
23 additions
and
11 deletions
reconstruct/src/main.cpp
+
5
−
5
View file @
0e5bf6d1
...
...
@@ -132,9 +132,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_
32F
C1
);
depth
=
Mat
(
rgb
.
size
(),
CV_
16U
C1
);
z_stream
infstream
;
/*
z_stream infstream;
infstream.zalloc = Z_NULL;
infstream.zfree = Z_NULL;
infstream.opaque = Z_NULL;
...
...
@@ -147,12 +147,12 @@ static void run(const string &file) {
// the actual DE-compression work.
inflateInit(&infstream);
inflate(&infstream, Z_NO_FLUSH);
inflateEnd
(
&
infstream
);
inflateEnd(&infstream);
*/
//LZ4_decompress_safe((char*)d.data(), (char*)depth.data, d.size(), depth.step*depth.rows);
//
cv::imdecode(d, cv::IMREAD_
GRAYSCALE
, &depth);
//
depth.convertTo(depth, CV_32FC1); //, 1.0f/16.0f); //, 1.0f/256.0f);
cv
::
imdecode
(
d
,
cv
::
IMREAD_
UNCHANGED
,
&
depth
);
depth
.
convertTo
(
depth
,
CV_32FC1
,
1.0
f
/
256.0
f
);
//, 1.0f/16.0f); //, 1.0f/256.0f);
});
while
(
disp
.
active
())
{
...
...
This diff is collapsed.
Click to expand it.
vision/src/streamer.cpp
+
18
−
6
View file @
0e5bf6d1
...
...
@@ -20,27 +20,39 @@ Streamer::~Streamer() {
}
//static Mat last;
void
Streamer
::
send
(
const
Mat
&
rgb
,
const
Mat
&
depth
)
{
// Compress the rgb as jpeg.
vector
<
unsigned
char
>
rgb_buf
;
cv
::
imencode
(
".jpg"
,
rgb
,
rgb_buf
);
Mat
d2
;
depth
.
convertTo
(
d2
,
CV_16UC1
,
256
);
//if (last.rows == 0) d2.copyTo(last);
//Mat ddepth;
//ddepth = d2 - last;
vector
<
unsigned
char
>
d_buf
;
d_buf
.
resize
(
d
epth
.
step
*
d
epth
.
rows
);
/*
d_buf.resize(d
2
.step*d
2
.rows);
z_stream defstream;
defstream.zalloc = Z_NULL;
defstream.zfree = Z_NULL;
defstream.opaque = Z_NULL;
defstream
.
avail_in
=
d
epth
.
step
*
d
epth
.
rows
;
defstream
.
next_in
=
(
Bytef
*
)
d
epth
.
data
;
// input char array
defstream
.
avail_out
=
(
uInt
)
d
epth
.
step
*
d
epth
.
rows
;
// size of output
defstream.avail_in = d
2
.step*d
2
.rows;
defstream.next_in = (Bytef *)d
2
.data; // input char array
defstream.avail_out = (uInt)d
2
.step*d
2
.rows; // size of output
defstream.next_out = (Bytef *)d_buf.data(); // output char array
deflateInit(&defstream, 4); // Z_DEFAULT_COMPRESSION
deflate(&defstream, Z_FINISH);
deflateEnd(&defstream);
d_buf
.
resize
(
defstream
.
total_out
);
d2.copyTo(last);
d_buf.resize(defstream.total_out);*/
// LZ4 Version
// d_buf.resize(LZ4_compressBound(depth.step*depth.rows));
...
...
@@ -49,7 +61,7 @@ void Streamer::send(const Mat &rgb, const Mat &depth) {
//Mat d2;
//depth.convertTo(d2, CV_16UC1, 256);
//
cv::imencode(".png", d
epth
, d_buf);
cv
::
imencode
(
".png"
,
d
2
,
d_buf
);
LOG
(
INFO
)
<<
"Depth Size = "
<<
((
float
)
d_buf
.
size
()
/
(
1024.0
f
*
1024.0
f
));
net_
.
publish
(
uri_
,
rgb_buf
,
d_buf
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment