-
Notifications
You must be signed in to change notification settings - Fork 746
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
Adding exposure control for Kinect2 #1031
Comments
Very interesting, thanks for pointing this out. Can you post a link to your wrapper library? IIRC this sounds quite similar to how the raw USB commands for the Kinect are constructed, so maybe it's actually quite straightforward to implement this in libfreenect2. Just to be sure, this only applies to the color camera, correct? |
Yes, this is only about the color camera settings (integration time in milliseconds, analog gain, white balance settings, etc.) and I've uploaded my C++ wrapper (and conversion from C++/CLI) at https://github.com/saulthu/Kinect2Exposure I agree, this looks a lot like the USB commands within libfreenect2. The code within this wrapper boils down to something roughly like this (but this does leave out some initialization):
I expect the full command packet will need some prefix bytes to indicate that this is a "color change camera settings" command, since the RGB commands settable via this library interface are values for use within an RGB context -- the On a side note (not the goal of the discussion here), I suspect this |
Using Visual Studio to step into the assembly of
and the passed value of |
Further, interpreting the
Of note, the
|
It appears that the call made to |
The same packet structure is used to get a value back:
This is a packet with the |
From looking at
and then a struct for the RGB command, something like the following (but I don't know what exactly the reply should be)
|
OK, I'll make a pull-request once I've made a working example. As another aside, the header NuiSensorLib.h contains a lot of information about data structures that clears up many previous unknowns e.g. the calibration data structures can be fully seen in this header e.g. DepthCameraParamsResponse.unknown0 is actually NUISENSOR_CALIBRATION_TABLE_BLOCK.AlphaC which corresponds to the calibration Skew coefficient. |
Thanks a lot, I will definitely have a look at the calibration parameters, that might help to clear up some missing bits and pieces all over libfreenect2. |
Has anyone investigated adding manual exposure control to libfreenect2?
I know it is possible to manually control exposure of the Kinect2 by using a library that Microsoft included in a project they released on GitHub: https://github.com/Microsoft/MixedRealityCompanionKit/tree/master/KinectIPD/NuiSensor
This library, "NuiSensorLib", is a precompiled binary for Windows. I currently use it with a small C++ wrapper to set the frame integration time and the analog gain of the Kinect2 during recording. The relevant library function is NuiSensor_ColorChangeCameraSettings, and the other files beside this library file have examples of usage.
I would like this functionality within libfreenect2 so I can control multiple Kinect2 devices on a single PC.
The code I use constructs a command message with a sequence number of zero, and an RGB setting command integer and a value integer. The problem is that I suspect the NuiSensor_ColorChangeCameraSettings function then wraps this in another command structure before sending over USB, and since it is a pre-compiled library, I don't have the values that it is using.
Has anyone else looked into this library already? Or have any hints on where I could look next?
Thanks 😄
The text was updated successfully, but these errors were encountered: