-
Notifications
You must be signed in to change notification settings - Fork 769
Add a dump depth processor. Reactivate the RGB dump processor. #551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
#endif // LIBFREENECT2_WITH_OPENCL_SUPPORT | ||
|
||
class DumpDepthPacketProcessor : public DepthPacketProcessor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you want to dump depth packets? The raw depth packets will require P0, X, and Z tables to decode. The tables are pulled from the Kinect at run time. So far my impression is that the raw depth packets are too big to be practical (85MB/s).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd like to do offline processing of the depth files in order to facilitate faster/easier algorithm refining and testing.
When you mention the tables, can I pull them once and keep them around or are they re-calculated whenever the kinect restarts?
And yes, I'm seeing ~3Mb / frame, so yes, I think your size estimate is correct. However I'm not offput by those sizes, and I can successfully capture to disk at those rates w/o frame dropping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see now storage is not a problem for Google. :)
P0 table contains the initial phase shift of the device and can only be obtained at run time. X and Z tables are algorithmic helper and are derived from the intrinsic parameters of the IR camera. The intrinsic parameters are factory built-in and obtained at run time but you can provide your own calibration parameters.
More details about the tables: https://github.com/OpenKinect/libfreenect2/blob/master/src/libfreenect2.cpp#L63
If you don't plan to do your own calibration, you can save the tables in DumpDepthPacketProcessor::load*Table***()
.
or are they re-calculated whenever the kinect restarts?
Yes, but saving the tables at the start would be sufficient for the following continuous session.
Someone on my team suggested that an alternative to this approach would be to extend Let me know if you prefer that approach to the one I've implemented here and I can change the implementation. (and thanks for the fast review! I will try to get the portable timing function in tomorrow) |
That was what I planned. I planned to add a JPEG format which is produced by a dummy JPEG processor doing nothing. Maybe you don't want to save it to disk, instead you want to stream it over network. We have some demand on a data recording tool #438, and specifying a recording format is not really a job of the library proper. I don't want to add a new field if that breaks the ABI. Maybe you can abuse My preference: The dump pipeline is acceptable for debug purposes, because the code is there and code matters. If you don't break the ABI, the suggestion from your teammate is preferred, for further extension of a data recording tool. The actual code for writing the data to disk could be added to |
ok, SGTM. I don't think adding a So how about the following: We will add If that works for you, I will re-arrange this PR to do that. Thanks |
I meant adding The current version of your plan is good for me. |
Just curious: what's Google doing with the Kinect v2? Anything related to Project Tango? (Feel free to silently ignore me if I'm being too nosy ;-) |
17ee696
to
cf9ba02
Compare
virtual void loadLookupTable(const short *lut); | ||
|
||
// Get the P0 Tables | ||
unsigned char* getP0Tables(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const unsigned char*
? I think you would not need to modify the values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
comments addressed, please take another look. Thanks! |
|
||
const unsigned char* getP0Tables(); | ||
|
||
float* getXTable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these float*
-> const float*
too.
short*
-> const short *
My review is complete. |
Thanks for the extensive review. Comments addressed, please re-check. --brendan |
68fa3e3
to
e0fd47c
Compare
{ | ||
} | ||
|
||
DumpRgbPacketProcessor::~DumpRgbPacketProcessor() | ||
{ | ||
delete frame; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double free here. As in DumpDepthPacketProcessor::~DumpDepthPacketProcessor()
, just remove this line.
I see you have frame = NULL;
, but this delete
is useless anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I figured that out ;) I deleted the member variable entirely, its not needed.
//std::ofstream file(name.str().c_str()); | ||
//file.write(reinterpret_cast<char *>(packet->jpeg_buffer), jpeg_buffer_length); | ||
//file.close(); | ||
frame = new Frame(1, 1, 1920*1080*4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need this:
frame->bytes_per_pixel = packet.jpeg_buffer_length;
1920*1080*4
is the size for the allocation, but not for the actual data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
thanks, sorry for all the little errors... --brendan |
Add a dump pipeline.
Build test OK. ABI report looks OK.
|
Add a dump depth processor. Reactivate the RGB dump processor.
Awesome, thanks! On Tue, Feb 2, 2016, 5:10 PM Lingzhu Xiang [email protected] wrote:
|
Add a dump pipeline.