Skip to content

Commit 548391e

Browse files
committed
Merge pull request #554 from brendandburns/master
dump: Add accessors for the various depth tables.
2 parents 163b575 + 896108d commit 548391e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

include/libfreenect2/packet_pipeline.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#include <libfreenect2/config.h>
3333

34+
#include <stdlib.h>
35+
3436
namespace libfreenect2
3537
{
3638

@@ -71,6 +73,13 @@ class LIBFREENECT2_API PacketPipeline
7173
public:
7274
DumpPacketPipeline();
7375
virtual ~DumpPacketPipeline();
76+
77+
// These are all required to decode depth data
78+
const unsigned char* getDepthP0Tables(size_t* length);
79+
80+
const float* getDepthXTable(size_t* length);
81+
const float* getDepthZTable(size_t* length);
82+
const short* getDepthLookupTable(size_t* length);
7483
};
7584

7685
/** Pipeline with CPU depth processing. */

src/packet_pipeline.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <libfreenect2/data_callback.h>
3232
#include <libfreenect2/rgb_packet_stream_parser.h>
3333
#include <libfreenect2/depth_packet_stream_parser.h>
34+
#include <libfreenect2/protocol/response.h>
3435

3536
namespace libfreenect2
3637
{
@@ -138,4 +139,24 @@ DumpPacketPipeline::DumpPacketPipeline()
138139

139140
DumpPacketPipeline::~DumpPacketPipeline() {}
140141

142+
const unsigned char* DumpPacketPipeline::getDepthP0Tables(size_t* length) {
143+
*length = sizeof(libfreenect2::protocol::P0TablesResponse);
144+
return static_cast<DumpDepthPacketProcessor*>(getDepthPacketProcessor())->getP0Tables();
145+
}
146+
147+
const float* DumpPacketPipeline::getDepthXTable(size_t* length) {
148+
*length = DepthPacketProcessor::TABLE_SIZE;
149+
return static_cast<DumpDepthPacketProcessor*>(getDepthPacketProcessor())->getXTable();
150+
}
151+
152+
const float* DumpPacketPipeline::getDepthZTable(size_t* length) {
153+
*length = DepthPacketProcessor::TABLE_SIZE;
154+
return static_cast<DumpDepthPacketProcessor*>(getDepthPacketProcessor())->getZTable();
155+
}
156+
157+
const short* DumpPacketPipeline::getDepthLookupTable(size_t* length) {
158+
*length = DepthPacketProcessor::LUT_SIZE;
159+
return static_cast<DumpDepthPacketProcessor*>(getDepthPacketProcessor())->getLookupTable();
160+
}
161+
141162
} /* namespace libfreenect2 */

0 commit comments

Comments
 (0)