-
Notifications
You must be signed in to change notification settings - Fork 770
Generate depth tables with camera parameters #379
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
Excellent work, could you perhaps add a short comment explaining the functionality of xtable/ztable itself (since you've reverse-engineered it now fully)? |
v2:
Old comments can be found here: https://github.com/xlz/libfreenect2/commit/866fdb2dbab42cd7727db3dd52a8260cd964be21 |
Rebased to master. |
The xtable, ztable, and 11to16 LUT can now be generated with camera parameters at runtime according to analysis in #144. The tables are generated during Freenect2Device::start(), and passed to depth processors. Users can provide custom camera parameters at runtime with new API: setIrCameraParams(), and setColorCameraParams(), and depth processors will use those instead of USB queried parameters. File loading functions in depth processors are removed. Hardcoded table binary files are removed.
Rebased to master. |
Just tested this, works as expected. Purely from visual inspection, I can't tell any difference between the two versions; I think @wiedemeyer had done some measurements? |
To tell a difference, extract two frames from before and after, To absolutely prove the correctness, another set of x/z/lut tables have to be extracted and compared with tables computed here. Or another round of calibration set with |
You might see some patterns obtained in http://designfankhauser.ch/files/fankhauser_2014_kinect_v2.pdf fig 5. This paper uses an older version of libfreenect2. It is possible some of the errors analyzed in the paper come from the discrepancy of the intrinsic parameters used for image warping (external) and depth decoding (hardcoded). |
Ah, this is very interesting - AFAICT, the error distribution means that there wasn't a systematic error before, just a different error distribution? |
The above plots might not be meaningful. Probably most of it is just noise and not showing the bias. I didn't have the best calibration target to test with. Here are another two plots showing the theoretical errors in the final depth values between using the hardcoded parameters, and (1) the embedded intrinsic parameters of my Kinect; (2) iai_kinect2's sample intrinsic parameters: I guess this really depends on the particular calibration parameters. At the edge the error is as much as a few millimeters, but another problem is data at the edge has poor reflection and poor reliability so is probably discarded for reliable computation. In the middle the error should be tiny. |
We should get this tested a little more widely, so I'm merging it now. |
Generate depth tables with camera parameters
The xtable, ztable, and 11to16 LUT can now be generated with camera parameters at runtime according to analysis in #144. The tables are generated during
Freenect2Device::start()
, and passed to depth processors.Users can provide custom camera parameters at runtime with new API:
setIrCameraParams()
, andsetColorCameraParams()
, and depth processors will use those instead of USB queried parameters.File loading functions in depth processors are removed.
Hardcoded table binary files are removed.