#include <OpenNI.h>
Classes | |
class | FrameAllocator |
class | NewFrameListener |
Public Member Functions | |
OniStreamHandle | _getHandle () const |
Status | addNewFrameListener (NewFrameListener *pListener) |
Status | create (const Device &device, SensorType sensorType) |
void | destroy () |
void | filterSpeckles (void *buf, int newVal, int maxSpeckleSize, int maxDiff) |
CameraSettings * | getCameraSettings () |
bool | getCropping (int *pOriginX, int *pOriginY, int *pWidth, int *pHeight) const |
float | getHorizontalFieldOfView () const |
int | getMaxPixelValue () const |
int | getMinPixelValue () const |
bool | getMirroringEnabled () const |
Status | getProperty (int propertyId, void *data, int *dataSize) const |
template<class T > | |
Status | getProperty (int propertyId, T *value) const |
const SensorInfo & | getSensorInfo () const |
ParamsRegistrationMode | getSoftwareRegistratorMode () |
float | getVerticalFieldOfView () const |
VideoMode | getVideoMode () const |
Status | invoke (int commandId, void *data, int dataSize) |
template<class T > | |
Status | invoke (int commandId, T &value) |
bool | isCommandSupported (int commandId) const |
bool | isCroppingSupported () const |
bool | isPropertySupported (int propertyId) const |
bool | isValid () const |
Status | readFrame (VideoFrameRef *pFrame) |
void | removeNewFrameListener (NewFrameListener *pListener) |
Status | resetCropping () |
Status | setCropping (int originX, int originY, int width, int height) |
Status | setFrameBuffersAllocator (FrameAllocator *pAllocator) |
Status | setMirroringEnabled (bool isEnabled) |
Status | setProperty (int propertyId, const void *data, int dataSize) |
template<class T > | |
Status | setProperty (int propertyId, const T &value) |
void | setSoftwareRegistrator (ParamsRegistrationMode mode) |
Status | setVideoMode (const VideoMode &videoMode) |
Status | start () |
void | stop () |
VideoStream () | |
VideoStream (OniStreamHandle handle) | |
~VideoStream () | |
Private Member Functions | |
void | _setHandle (OniStreamHandle stream) |
VideoStream & | operator= (const VideoStream &other) |
VideoStream (const VideoStream &other) | |
Private Attributes | |
bool | m_isOwner |
CameraSettings * | m_pCameraSettings |
SensorInfo | m_sensorInfo |
OniStreamHandle | m_stream |
Friends | |
class | Device |
The VideoStream object encapsulates a single video stream from a device. Once created, it is used to start data flow from the device, and to read individual frames of data. This is the central class used to obtain data in OpenNI. It provides the ability to manually read data in a polling loop, as well as providing events and a Listener class that can be used to implement event-driven data acquisition.
Aside from the video data frames themselves, the class offers a number of functions used for obtaining information about a VideoStream. Field of view, available video modes, and minimum and maximum valid pixel values can all be obtained.
In addition to obtaining data, the VideoStream object is used to set all configuration properties that apply to a specific stream (rather than to an entire device). In particular, it is used to control cropping, mirroring, and video modes.
A pointer to a valid, initialized device that provides the desired stream type is required to create a stream.
Several video streams can be created to stream data from the same sensor. This is useful if several components of an application need to read frames separately.
While some device might allow different streams from the same sensor to have different configurations, most devices will have a single configuration for the sensor, shared by all streams.
|
inline |
Default constructor. Creates a new, non-valid VideoStream object. The object created will be invalid until its create() function is called with a valid Device.
|
inlineexplicit |
Handle constructor. Creates a VideoStream object based on the given initialized handle. This object will not destroy the underlying handle when destroy() or destructor is called
|
inline |
|
private |
|
inline |
|
inlineprivate |
|
inline |
Adds a new Listener to receive this VideoStream onNewFrame event. See VideoStream::NewFrameListener for more information on implementing an event driven frame reading architecture. An instance of a listener can be added to only one source.
[in] | pListener | Pointer to a VideoStream::NewFrameListener object (or a derivative) that will respond to this event. |
|
inline |
Creates a stream of frames from a specific sensor type of a specific device. You must supply a reference to a Device that supplies the sensor type requested. You can use Device::hasSensor() to check whether a given sensor is available on your target device before calling create().
[in] | device | A reference to the Device you want to create the stream on. |
[in] | sensorType | The type of sensor the stream should produce data from. |
|
inline |
Destroy this stream. This function is currently called automatically by the destructor, but it is considered a best practice for applications to manually call this function on any VideoStream that they call create() for.
|
inline |
|
inline |
|
inline |
Obtains the current cropping settings for this stream.
[out] | pOriginX | X coordinate of the upper left corner of the cropping window |
[out] | pOriginY | Y coordinate of the upper left corner of the cropping window |
[out] | pWidth | Horizontal width of the cropping window, in pixels |
[out] | pHeight | Vertical width of the cropping window, in pixels returns true if cropping is currently enabled, false if it is not. |
|
inline |
|
inline |
|
inline |
Provides the smallest possible value for pixels obtains by this VideoStream. This is most useful for getting the minimum possible value that will be reported by a depth stream.
|
inline |
|
inline |
General function for obtaining the value of stream specific properties. There are convenience functions available for all commonly used properties, so it is not expected that applications will make direct use of the getProperty function very often.
[in] | propertyId | The numerical ID of the property to be queried. |
[out] | data | Place to store the value of the property. |
[in,out] | dataSize | IN: Size of the buffer passed in the data argument. OUT: the actual written size. |
|
inline |
Function for getting the value from a property using an arbitrary output type. There are convenience functions available for all commonly used properties, so it is not expected that applications will make direct use of this function very often.
[in] | T Data type of the value to be read. |
[in] | propertyId | The numerical ID of the property to be read. |
[in,out] | value | Pointer to a place to store the value read from the property. |
|
inline |
Provides the SensorInfo object associated with the sensor that is producing this VideoStream. Note that this function will return NULL if the stream has not yet been initialized with the create() function.
SensorInfo is useful primarily as a means of learning which video modes are valid for this VideoStream.
|
inline |
|
inline |
|
inline |
|
inline |
Invokes a command that takes an arbitrary data type as its input. It is not expected that application code will need this function frequently, as all commonly used properties have higher level functions provided.
[in] | commandId | Numerical code of the property to be invoked. |
[in] | data | Data to be passed to the property. |
[in] | dataSize | size of the buffer passed in data . |
|
inline |
Invokes a command that takes an arbitrary data type as its input. It is not expected that application code will need this function frequently, as all commonly used properties have higher level functions provided.
[in] | T Type of data to be passed to the property. |
[in] | commandId | Numerical code of the property to be invoked. |
[in] | value | Data to be passed to the property. |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
inline |
Read the next frame from this video stream, delivered as a VideoFrameRef. This is the primary method for manually obtaining frames of video data. If no new frame is available, the call will block until one is available. To avoid blocking, use VideoStream::Listener to implement an event driven architecture. Another alternative is to use OpenNI::waitForAnyStream() to wait for new frames from several streams.
[out] | pFrame | Pointer to a VideoFrameRef object to hold the reference to the new frame. |
|
inline |
|
inline |
|
inline |
Changes the cropping settings for this stream. You can use the isCroppingSupported() function to make sure cropping is supported before calling this function.
[in] | originX | New X coordinate of the upper left corner of the cropping window. |
[in] | originY | New Y coordinate of the upper left corner of the cropping window. |
[in] | width | New horizontal width for the cropping window, in pixels. |
[in] | height | New vertical height for the cropping window, in pixels. |
|
inline |
Sets the frame buffers allocator for this video stream.
[in] | pAllocator | Pointer to the frame buffers allocator object. Pass NULL to return to default frame allocator. |
|
inline |
|
inline |
General function for setting the value of stream specific properties. There are convenience functions available for all commonly used properties, so it is not expected that applications will make direct use of the setProperty function very often.
[in] | propertyId | The numerical ID of the property to be set. |
[in] | data | Place to store the data to be written to the property. |
[in] | dataSize | Size of the data to be written to the property. |
|
inline |
Function for setting a value of a stream property using an arbitrary input type. There are convenience functions available for all commonly used properties, so it is not expected that applications will make direct use of this function very often.
[in] | T Data type of the value to be passed to the property. |
[in] | propertyId | The numerical ID of the property to be set. |
[in] | value | Data to be sent to the property. |
|
inline |
Changes the current video mode of this stream. Recommended practice is to use Device::getSensorInfo(), and then SensorInfo::getSupportedVideoModes() to obtain a list of valid video mode settings for this stream. Then, pass a valid VideoMode to setVideoMode to ensure correct operation.
[in] | videoMode | Desired new video mode for this stream. returns Status code indicating success or failure of this operation. |
|
inline |
|
inline |
|
private |
|
private |
|
private |