I am making a C++ utility that uses OpenNI 2. Ideally I now need to set the minimum and the maximum thresholds for the depth image. I did this in the past with OpenCV or my own image processing functions and before going this way again I am wondering whether there's a feature in OpenNI that supports this natively.
Having a look to the downloadable documentation (comes with the OpenNI package) there's a couple of interesting functions defined in the class VideoStream in OpenNI.h. These are:
int VideoStream::getMinPixelValue()
int VideoStream::getMaxPixelValue()
which return the current limits I need; these seem to be hardware readings though. Nonetheless, the VideoStream class exposes also the setProperty function which allows setting one of the properties in the list of values defined in oniProperties.h.
Since neither the documentation nor the comments in that file specify if one property is read only or not, I tried to write the min and max values by doing
myVideoStream.setProperty<int>(openni::STREAM_PROPERTY_MIN_VALUE, myIntMinValue);
myVideoStream.setProperty<int>(openni::STREAM_PROPERTY_MAX_VALUE, myIntMaxValue);
As a result the values do not change.
My questions are:
- Do you confirm that min and max pixel values in the VideoStream are read only?
- Does OpenNI, in some way, support natively of setting these thresdolds?
Thank you for your attention.