public interface VideoFrame
DataBuffers. During capture, v4l4j creates VideoFrames
and passes them the registered CaptureCallback object. Check the
FrameGrabber class for more information on how to perform a capture.getBytes(),
note that the size of returned byte array can be longer than the actual image size.
What this means is that you should use getFrameLength() to figure out how
many elements in the byte array are actually used by the image instead of relying
on byte[].length.VideoFrame is returned by a frame grabber, the
VideoFrame object itself as well as any of the objects obtained through
its methods can be used. When the VideoFrame and any of the objects
obtained through it) are dealt with and no longer used, the VideoFrame
must be recycled, which marks it as being available to v4l4j to store an upcoming
image. From the moment a VideoFrame is recycled,
neither the VideoFrame nor objects obtained through it
can be used. Bad things will happen if you violate this rule. It is recommended
that you explicitly set all references to this object, as well as references to objects
obtained through this frame, to null.VideoFrames returned by JPEGFrameGrabbers
cannot return a buffered image, and calling getBufferedImage() will
throw a UnsupportedMethod exception. In the same way, video frames
returned by raw frame grabbers cannot create rasters and an UnsupportedMethod
exception will be thrown if getRaster() is called.| Modifier and Type | Method and Description |
|---|---|
BufferedImage |
getBufferedImage()
This method returns the image data encapsulated in a
BufferedImage object. |
byte[] |
getBytes()
This method returns the image data as a byte array.Please note that
the size of the returned byte array can be greater than the actual frame
size.
|
long |
getCaptureTime()
This method returns the OS time (number of microseconds elapsed since
startup) at which this video frame was captured.
|
DataBuffer |
getDataBuffer()
This method returns the image data encapsulated in a
DataBuffer
object. |
FrameGrabber |
getFrameGrabber()
This method returns the frame grabber object which captured this frame
|
int |
getFrameLength()
This method returns the length of this video frame in bytes.
|
Raster |
getRaster()
This method returns the image data encapsulated in a
Raster object. |
long |
getSequenceNumber()
This method returns this video frame's sequence number (a monotonically
increasing number for each captured frame).
|
void |
recycle()
This method marks this video frame as being no longer used, and ready
to be reused by v4l4j.
|
FrameGrabber getFrameGrabber()
int getFrameLength()
StateException - if this video frame has been recycled already.long getSequenceNumber()
currentSequenceNumber !=
(previousSequenceNumber + 1) then (currentSequenceNumber -
previousSequenceNumber( frames were dropped.StateException - if this video frame has been recycled already.long getCaptureTime()
StateException - if this video frame has been recycled already.byte[] getBytes()
byte[].length) as the length of the image. Instead, use the
value returned from getFrameLength().StateException - if this video frame has been recycled already.DataBuffer getDataBuffer()
DataBuffer
object. The data is stored as bytes in the data buffer.DataBufferStateException - if this video frame has been recycled already.Raster getRaster()
Raster object.
Rasters cannot be created for some image formats (including compressed formats
like JPEG). In this case this method will throw a UnsupportedMethod
exception.Raster object{@link - UnsupportedMethod} exception if the image format this
video frame uses cannot be encapsulated in a Raster.StateException - if this video frame has been recycled already.BufferedImage getBufferedImage()
BufferedImage object.
Buffered images cannot be created for some image formats (including raw image
formats). In this case this method will throw a UnsupportedMethod
exception.BufferedImage object{@link - UnsupportedMethod} exception if the image format this
video frame uses cannot be encapsulated in a BufferedImage.StateException - if this video frame has been recycled already.void recycle()
Copyright © 2013-2015 Bartosz Firyn (sarxos). All Rights Reserved.