1
votes

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:

  1. Do you confirm that min and max pixel values in the VideoStream are read only?
  2. Does OpenNI, in some way, support natively of setting these thresdolds?

Thank you for your attention.

1
have you found an answer till now?zhangxaochen
No, unfortunately. In OpenNI there seems to be no way to set those thresholds at the source. You have to operate through OpenCV or make your own threshold filter.SteakOverflow

1 Answers

1
votes

I'm facing a similar issue, i.e., setting the maxDepthVlaue of a particular device. The status always return as a failure. However, when you run isPropertySupported(openni::STREAM_PROPERTY_MAX_VALUE), it returns true. So there is an internal means to set the max depth value. Don't quite know what that is though.