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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doubleprotected intprotected intprotected intprotected intprotected intprotected booleanprotected Stringprotected intprotected doubleprotected doubleprotected intprotected FrameGrabber.ImageModeprotected intstatic final ArrayDeque<String>protected intprotected intprotected intprotected intstatic final longstatic final longstatic final longstatic final longprotected longprotected intprotected longprotected booleanprotected intprotected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static FrameGrabbercreate(Class<? extends FrameGrabber> c, Class p, Object o) static FrameGrabberstatic FrameGrabberstatic FrameGrabbercreateArray(FrameGrabber[] frameGrabbers) static FrameGrabbercreateDefault(int deviceNumber) static FrameGrabbercreateDefault(File deviceFile) static FrameGrabbercreateDefault(String devicePath) voiddelayedGrab(long delayTime) voidflush()static Class<? extends FrameGrabber>doubleintintintgetAudioMetadata(String key) getAudioOption(String key) intintstatic Class<? extends FrameGrabber>longintdoubledoublegetGamma()intintintlonggetMetadata(String key) intintintintlongintlongintintgetVideoMetadata(String key) getVideoOption(String key) intabstract Framegrab()Each call to grab stores the new image in the memory address for the previously returned frame.static voidinit()booleanbooleanabstract voidrelease()voidrestart()voidsetAspectRatio(double aspectRatio) voidsetAudioBitrate(int audioBitrate) voidsetAudioChannels(int audioChannels) voidsetAudioCodec(int audioCodec) voidsetAudioMetadata(String key, String value) voidsetAudioOption(String key, String value) voidsetAudioStream(int audioStream) voidsetBitsPerPixel(int bitsPerPixel) voidsetDeinterlace(boolean deinterlace) voidvoidsetFrameNumber(int frameNumber) voidsetFrameRate(double frameRate) voidsetGamma(double gamma) voidsetImageHeight(int imageHeight) voidsetImageMode(FrameGrabber.ImageMode imageMode) voidsetImageWidth(int imageWidth) voidsetMetadata(String key, String value) voidsetNumBuffers(int numBuffers) voidvoidsetPixelFormat(int pixelFormat) voidsetSampleFormat(int sampleFormat) voidsetSampleRate(int sampleRate) voidsetSensorPattern(long sensorPattern) voidsetTimeout(int timeout) voidsetTimestamp(long timestamp) voidsetTriggerMode(boolean triggerMode) voidsetVideoBitrate(int videoBitrate) voidsetVideoCodec(int videoCodec) voidsetVideoMetadata(String key, String value) voidsetVideoOption(String key, String value) voidsetVideoStream(int videoStream) abstract voidstart()abstract voidstop()abstract voidtrigger()
-
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:
closein interfaceAutoCloseable- Specified by:
closein 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
-