Package org.bytedeco.copiedstuff
Class FrameGrabber
java.lang.Object
org.bytedeco.copiedstuff.FrameGrabber
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
FFmpegFrameGrabber
public abstract class FrameGrabber extends Object implements Closeable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FrameGrabber.Array
static class
FrameGrabber.Exception
static class
FrameGrabber.ImageMode
static class
FrameGrabber.PropertyEditor
-
Field Summary
Fields Modifier and Type Field Description protected double
aspectRatio
protected int
audioBitrate
protected int
audioChannels
protected int
audioCodec
protected HashMap<String,String>
audioMetadata
protected HashMap<String,String>
audioOptions
protected int
audioStream
protected int
bpp
protected boolean
deinterlace
protected String
format
protected int
frameNumber
protected double
frameRate
protected double
gamma
protected int
imageHeight
protected FrameGrabber.ImageMode
imageMode
protected int
imageWidth
static ArrayDeque<String>
list
protected HashMap<String,String>
metadata
protected int
numBuffers
protected HashMap<String,String>
options
protected int
pixelFormat
protected int
sampleFormat
protected int
sampleRate
static long
SENSOR_PATTERN_BGGR
static long
SENSOR_PATTERN_GBRG
static long
SENSOR_PATTERN_GRBG
static long
SENSOR_PATTERN_RGGB
protected long
sensorPattern
protected int
timeout
protected long
timestamp
protected boolean
triggerMode
protected int
videoBitrate
protected int
videoCodec
protected HashMap<String,String>
videoMetadata
protected HashMap<String,String>
videoOptions
protected int
videoStream
-
Constructor Summary
Constructors Constructor Description FrameGrabber()
-
Method Summary
Modifier and Type Method Description void
close()
static FrameGrabber
create(Class<? extends FrameGrabber> c, Class p, Object o)
static FrameGrabber
create(String className, int deviceNumber)
static FrameGrabber
create(String className, File deviceFile)
static FrameGrabber
create(String className, String devicePath)
FrameGrabber.Array
createArray(FrameGrabber[] frameGrabbers)
static FrameGrabber
createDefault(int deviceNumber)
static FrameGrabber
createDefault(File deviceFile)
static FrameGrabber
createDefault(String devicePath)
void
delayedGrab(long delayTime)
void
flush()
static Class<? extends FrameGrabber>
get(String className)
double
getAspectRatio()
int
getAudioBitrate()
int
getAudioChannels()
int
getAudioCodec()
String
getAudioMetadata(String key)
String
getAudioOption(String key)
int
getAudioStream()
int
getBitsPerPixel()
static Class<? extends FrameGrabber>
getDefault()
Frame
getDelayedFrame()
long
getDelayedTime()
String
getFormat()
int
getFrameNumber()
double
getFrameRate()
double
getGamma()
int
getImageHeight()
FrameGrabber.ImageMode
getImageMode()
int
getImageWidth()
int
getLengthInFrames()
long
getLengthInTime()
Map<String,String>
getMetadata()
String
getMetadata(String key)
int
getNumBuffers()
String
getOption(String key)
int
getPixelFormat()
int
getSampleFormat()
int
getSampleRate()
long
getSensorPattern()
int
getTimeout()
long
getTimestamp()
int
getVideoBitrate()
int
getVideoCodec()
String
getVideoMetadata(String key)
String
getVideoOption(String key)
int
getVideoStream()
abstract Frame
grab()
Each call to grab stores the new image in the memory address for the previously returned frame.Frame
grabFrame()
static void
init()
boolean
isDeinterlace()
boolean
isTriggerMode()
abstract void
release()
void
restart()
void
setAspectRatio(double aspectRatio)
void
setAudioBitrate(int audioBitrate)
void
setAudioChannels(int audioChannels)
void
setAudioCodec(int audioCodec)
void
setAudioMetadata(String key, String value)
void
setAudioOption(String key, String value)
void
setAudioStream(int audioStream)
void
setBitsPerPixel(int bitsPerPixel)
void
setDeinterlace(boolean deinterlace)
void
setFormat(String format)
void
setFrameNumber(int frameNumber)
void
setFrameRate(double frameRate)
void
setGamma(double gamma)
void
setImageHeight(int imageHeight)
void
setImageMode(FrameGrabber.ImageMode imageMode)
void
setImageWidth(int imageWidth)
void
setMetadata(String key, String value)
void
setNumBuffers(int numBuffers)
void
setOption(String key, String value)
void
setPixelFormat(int pixelFormat)
void
setSampleFormat(int sampleFormat)
void
setSampleRate(int sampleRate)
void
setSensorPattern(long sensorPattern)
void
setTimeout(int timeout)
void
setTimestamp(long timestamp)
void
setTriggerMode(boolean triggerMode)
void
setVideoBitrate(int videoBitrate)
void
setVideoCodec(int videoCodec)
void
setVideoMetadata(String key, String value)
void
setVideoOption(String key, String value)
void
setVideoStream(int videoStream)
abstract void
start()
abstract void
stop()
abstract void
trigger()
-
Field Details
-
list
-
SENSOR_PATTERN_RGGB
public static final long SENSOR_PATTERN_RGGB- See Also:
- Constant Field Values
-
SENSOR_PATTERN_GBRG
public static final long SENSOR_PATTERN_GBRG- See Also:
- Constant Field Values
-
SENSOR_PATTERN_GRBG
public static final long SENSOR_PATTERN_GRBG- See Also:
- Constant Field Values
-
SENSOR_PATTERN_BGGR
public static final long SENSOR_PATTERN_BGGR- See Also:
- Constant Field Values
-
videoStream
protected int videoStream -
audioStream
protected int audioStream -
format
-
imageWidth
protected int imageWidth -
imageHeight
protected int imageHeight -
audioChannels
protected int audioChannels -
imageMode
-
sensorPattern
protected long sensorPattern -
pixelFormat
protected int pixelFormat -
videoCodec
protected int videoCodec -
videoBitrate
protected int videoBitrate -
aspectRatio
protected double aspectRatio -
frameRate
protected double frameRate -
sampleFormat
protected int sampleFormat -
audioCodec
protected int audioCodec -
audioBitrate
protected int audioBitrate -
sampleRate
protected int sampleRate -
triggerMode
protected boolean triggerMode -
bpp
protected int bpp -
timeout
protected int timeout -
numBuffers
protected int numBuffers -
gamma
protected double gamma -
deinterlace
protected boolean deinterlace -
options
-
videoOptions
-
audioOptions
-
metadata
-
videoMetadata
-
audioMetadata
-
frameNumber
protected int frameNumber -
timestamp
protected long timestamp
-
-
Constructor Details
-
FrameGrabber
public FrameGrabber()
-
-
Method Details
-
init
public static void init() -
getDefault
-
get
- Throws:
FrameGrabber.Exception
-
create
public static FrameGrabber create(Class<? extends FrameGrabber> c, Class p, Object o) throws FrameGrabber.Exception- Throws:
FrameGrabber.Exception
-
createDefault
- Throws:
FrameGrabber.Exception
-
createDefault
- Throws:
FrameGrabber.Exception
-
createDefault
- Throws:
FrameGrabber.Exception
-
create
- Throws:
FrameGrabber.Exception
-
create
public static FrameGrabber create(String className, String devicePath) throws FrameGrabber.Exception- Throws:
FrameGrabber.Exception
-
create
public static FrameGrabber create(String className, int deviceNumber) throws FrameGrabber.Exception- Throws:
FrameGrabber.Exception
-
getVideoStream
public int getVideoStream() -
setVideoStream
public void setVideoStream(int videoStream) -
getAudioStream
public int getAudioStream() -
setAudioStream
public void setAudioStream(int audioStream) -
getFormat
-
setFormat
-
getImageWidth
public int getImageWidth() -
setImageWidth
public void setImageWidth(int imageWidth) -
getImageHeight
public int getImageHeight() -
setImageHeight
public void setImageHeight(int imageHeight) -
getAudioChannels
public int getAudioChannels() -
setAudioChannels
public void setAudioChannels(int audioChannels) -
getImageMode
-
setImageMode
-
getSensorPattern
public long getSensorPattern() -
setSensorPattern
public void setSensorPattern(long sensorPattern) -
getPixelFormat
public int getPixelFormat() -
setPixelFormat
public void setPixelFormat(int pixelFormat) -
getVideoCodec
public int getVideoCodec() -
setVideoCodec
public void setVideoCodec(int videoCodec) -
getVideoBitrate
public int getVideoBitrate() -
setVideoBitrate
public void setVideoBitrate(int videoBitrate) -
getAspectRatio
public double getAspectRatio() -
setAspectRatio
public void setAspectRatio(double aspectRatio) -
getFrameRate
public double getFrameRate() -
setFrameRate
public void setFrameRate(double frameRate) -
getAudioCodec
public int getAudioCodec() -
setAudioCodec
public void setAudioCodec(int audioCodec) -
getAudioBitrate
public int getAudioBitrate() -
setAudioBitrate
public void setAudioBitrate(int audioBitrate) -
getSampleFormat
public int getSampleFormat() -
setSampleFormat
public void setSampleFormat(int sampleFormat) -
getSampleRate
public int getSampleRate() -
setSampleRate
public void setSampleRate(int sampleRate) -
isTriggerMode
public boolean isTriggerMode() -
setTriggerMode
public void setTriggerMode(boolean triggerMode) -
getBitsPerPixel
public int getBitsPerPixel() -
setBitsPerPixel
public void setBitsPerPixel(int bitsPerPixel) -
getTimeout
public int getTimeout() -
setTimeout
public void setTimeout(int timeout) -
getNumBuffers
public int getNumBuffers() -
setNumBuffers
public void setNumBuffers(int numBuffers) -
getGamma
public double getGamma() -
setGamma
public void setGamma(double gamma) -
isDeinterlace
public boolean isDeinterlace() -
setDeinterlace
public void setDeinterlace(boolean deinterlace) -
getOption
-
setOption
-
getVideoOption
-
setVideoOption
-
getAudioOption
-
setAudioOption
-
getMetadata
-
getMetadata
-
setMetadata
-
getVideoMetadata
-
setVideoMetadata
-
getAudioMetadata
-
setAudioMetadata
-
getFrameNumber
public int getFrameNumber() -
setFrameNumber
- Throws:
FrameGrabber.Exception
-
getTimestamp
public long getTimestamp() -
setTimestamp
- Throws:
FrameGrabber.Exception
-
getLengthInFrames
public int getLengthInFrames() -
getLengthInTime
public long getLengthInTime() -
start
- Throws:
FrameGrabber.Exception
-
stop
- Throws:
FrameGrabber.Exception
-
trigger
- Throws:
FrameGrabber.Exception
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
FrameGrabber.Exception
-
grab
Each call to grab stores the new image in the memory address for the previously returned frame.
IE.
grabber.grab() == grabber.grab()
This means that if you need to cache images returned from grab you shouldFrame.clone()
the returned frame as the next call to grab will overwrite your existing image's memory.
Why?
Using this method instead of allocating a new buffer every time a frame is grabbed improves performance by reducing the frequency of garbage collections. Almost no additional heap space is typically allocated per frame.- Returns:
- The frame returned from the grabber
- Throws:
FrameGrabber.Exception
- If there is a problem grabbing the frame.
-
grabFrame
- Throws:
FrameGrabber.Exception
-
release
- Throws:
FrameGrabber.Exception
-
restart
- Throws:
FrameGrabber.Exception
-
flush
- Throws:
FrameGrabber.Exception
-
delayedGrab
public void delayedGrab(long delayTime) -
getDelayedTime
-
getDelayedFrame
-
createArray
-