Package org.bytedeco.copiedstuff
Class FrameGrabber
java.lang.Object
org.bytedeco.copiedstuff.FrameGrabber
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
FFmpegFrameGrabber
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static enum
static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
protected int
protected int
protected int
protected int
protected int
protected boolean
protected String
protected int
protected double
protected double
protected int
protected FrameGrabber.ImageMode
protected int
static final ArrayDeque<String>
protected int
protected int
protected int
protected int
static final long
static final long
static final long
static final long
protected long
protected int
protected long
protected boolean
protected int
protected int
protected int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static FrameGrabber
create
(Class<? extends FrameGrabber> c, Class p, Object o) static FrameGrabber
static FrameGrabber
static FrameGrabber
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>
double
int
int
int
getAudioMetadata
(String key) getAudioOption
(String key) int
int
static Class<? extends FrameGrabber>
long
int
double
double
getGamma()
int
int
int
long
getMetadata
(String key) int
int
int
int
long
int
long
int
int
getVideoMetadata
(String key) getVideoOption
(String key) int
abstract Frame
grab()
Each call to grab stores the new image in the memory address for the previously returned frame.static void
init()
boolean
boolean
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
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
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:
-
SENSOR_PATTERN_GBRG
public static final long SENSOR_PATTERN_GBRG- See Also:
-
SENSOR_PATTERN_GRBG
public static final long SENSOR_PATTERN_GRBG- See Also:
-
SENSOR_PATTERN_BGGR
public static final long SENSOR_PATTERN_BGGR- See Also:
-
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
- 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
-