We discussed about how to retrieve a list of connected devices but we never used this data to select one of those devices; we always used
ANY_DEVICE as the parameter for the
openni::Device::open() method without even asking ourselves what this parameter is.
In this recipe, we will show you how to select your desired device and open it. Then create
openni::VideoStream for the depth sensor of this device.
But first let's talk about the
openni::Device::open() method. Actually this method has a parameter of type string (actually a character array) containing the hardware location (Uri) of the desired device. We always used
ANY_DEVICE as the parameter of this method until now, but actually
ANY_DEVICE is equal to
null and is used only for better reading of code. When passing
null as the parameter of this method, OpenNI automatically selects the first device in the list of loaded and recognized devices. So if we want to select our desired device...