|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openni.VideoStream
public class VideoStream
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 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.
Nested Class Summary | |
---|---|
class |
VideoStream.CameraSettings
The VideoStream.CameraSettings object encapsulates camera setting for a single device. |
static interface |
VideoStream.NewFrameListener
The VideoStream::NewFrameListener interface is provided to allow the implementation of event driven frame reading. |
Method Summary | |
---|---|
void |
addNewFrameListener(VideoStream.NewFrameListener streamListener)
Adds a new Listener to receive this VideoStream onNewFrame event. |
static VideoStream |
create(Device device,
SensorType sensorType)
Creates a stream of frames from a specific sensor type of a specific device. |
void |
destroy()
Destroy this stream. |
VideoStream.CameraSettings |
getCameraSettings()
Gets an object through which several camera settings can be configured. |
CropArea |
getCropping()
Obtains the current cropping settings for this stream. |
long |
getHandle()
This function return stream handle. |
float |
getHorizontalFieldOfView()
Gets the horizontal field of view of frames received from this stream. |
int |
getMaxPixelValue()
Provides the maximum possible value for pixels obtained by this stream. |
int |
getMinPixelValue()
Provides the smallest possible value for pixels obtains by this VideoStream. |
boolean |
getMirroringEnabled()
Check whether mirroring is currently turned on for this stream. |
SensorInfo |
getSensorInfo()
Provides the SensorInfo object associated with the sensor that is producing this
VideoStream . |
SensorType |
getSensorType()
Gets the sensor type for this stream. |
float |
getVerticalFieldOfView()
Gets the vertical field of view of frames received from this stream. |
VideoMode |
getVideoMode()
Get the current video mode information for this video stream. |
boolean |
isCroppingSupported()
Checks whether this stream supports cropping. |
VideoFrameRef |
readFrame()
Read the next frame from this video stream, delivered as a VideoFrameRef . |
void |
removeNewFrameListener(VideoStream.NewFrameListener streamListener)
Removes a Listener from this video stream list. |
void |
resetCropping()
Disables cropping. |
void |
setCropping(CropArea cropping)
Changes the cropping settings for this stream. |
void |
setMirroringEnabled(boolean isEnabled)
Enable or disable mirroring for this stream. |
void |
setVideoMode(VideoMode videoMode)
Changes the current video mode of this stream. |
void |
start()
Starts data generation from this video stream. |
void |
stop()
Stops data generation from this video stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static VideoStream create(Device device, SensorType sensorType)
Device.hasSensor(SensorType)
to check whether a given sensor is available on
your target device before calling create().
device
- A reference to the Device
you want to create the stream on.sensorType
- The type of sensor the stream should produce data from.public void destroy()
VideoStream
that they call create() for.
public final SensorInfo getSensorInfo()
SensorInfo
object associated with the sensor that is producing this
VideoStream
.
SensorInfo
is useful primarily as a means of learning which video modes are valid for
this VideoStream.
public void start()
public void stop()
public VideoFrameRef readFrame()
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.NewFrameListener
to implement an event driven architecture. Another
alternative is to use OpenNI.waitForAnyStream(java.util.List, int)
to wait
for new frames from several streams
public void addNewFrameListener(VideoStream.NewFrameListener streamListener)
VideoStream.NewFrameListener
for more information on implementing an event driven
frame reading architecture.
streamListener
- Object which implements VideoStream.NewFrameListener
that will
respond to this event.public void removeNewFrameListener(VideoStream.NewFrameListener streamListener)
streamListener
- Object of the listener to be removed.public long getHandle()
public VideoStream.CameraSettings getCameraSettings()
public final VideoMode getVideoMode()
public void setVideoMode(VideoMode videoMode)
Device.getSensorInfo(SensorType)
, and then
SensorInfo.getSupportedVideoModes()
to obtain a list of valid video mode
settings for this stream. Then, pass a valid VideoMode
to setVideoMode(VideoMode) to
ensure correct operation.
videoMode
- Desired new video mode for this stream. returns Status code indicating success
or failure of this operation.public int getMaxPixelValue()
public int getMinPixelValue()
public boolean isCroppingSupported()
public CropArea getCropping()
public void setCropping(CropArea cropping)
isCroppingSupported()
function to make sure cropping is supported before calling this function.
cropping
- CropArea object which set corresponding cropping information.public void resetCropping()
public boolean getMirroringEnabled()
public void setMirroringEnabled(boolean isEnabled)
isEnabled
- true to enable mirroring, false to disable it.public float getHorizontalFieldOfView()
public float getVerticalFieldOfView()
public SensorType getSensorType()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |