|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.sarxos.webcam.Webcam
public class Webcam
Webcam class. It wraps webcam device obtained from webcam driver.
| Constructor Summary | |
|---|---|
protected |
Webcam(WebcamDevice device)
Webcam class. |
| Method Summary | |
|---|---|
static boolean |
addDiscoveryListener(WebcamDiscoveryListener l)
Add new webcam discovery listener. |
boolean |
addWebcamListener(WebcamListener l)
Add webcam listener. |
void |
close()
Close the webcam. |
protected void |
dispose()
Completely dispose capture device. |
Dimension[] |
getCustomViewSizes()
|
static Webcam |
getDefault()
Will discover and return first webcam available in the system. |
static Webcam |
getDefault(long timeout)
Will discover and return first webcam available in the system. |
static Webcam |
getDefault(long timeout,
TimeUnit tunit)
Will discover and return first webcam available in the system. |
WebcamDevice |
getDevice()
Return underlying webcam device. |
static WebcamDiscoveryListener[] |
getDiscoveryListeners()
|
static WebcamDiscoveryService |
getDiscoveryService()
Return discovery service. |
static WebcamDriver |
getDriver()
Return webcam driver. |
BufferedImage |
getImage()
Capture image from webcam and return it. |
String |
getName()
Get webcam name (device name). |
protected WebcamProcessor |
getProcessor()
|
Dimension |
getViewSize()
Get current webcam resolution in pixels. |
Dimension[] |
getViewSizes()
Return list of supported view sizes. |
WebcamListener[] |
getWebcamListeners()
|
static List<Webcam> |
getWebcams()
Get list of webcams to use. |
static List<Webcam> |
getWebcams(long timeout)
Get list of webcams to use. |
static List<Webcam> |
getWebcams(long timeout,
TimeUnit tunit)
Get list of webcams to use. |
static boolean |
isAutoOpenMode()
Is auto open mode enabled. |
static boolean |
isHandleTermSignal()
Is TERM signal handler enabled. |
boolean |
isOpen()
Is webcam open? |
void |
open()
Open the webcam. |
static void |
registerDriver(Class<? extends WebcamDriver> clazz)
Register new webcam video driver. |
static void |
registerDriver(String clazzName)
Register new webcam video driver. |
static boolean |
removeDiscoveryListener(WebcamDiscoveryListener l)
Remove discovery listener |
boolean |
removeWebcamListener(WebcamListener l)
Removes webcam listener. |
static void |
resetDriver()
Reset webcam driver. This method is not thread-safe! |
static void |
setAutoOpenMode(boolean on)
Switch all webcams to auto open mode. |
void |
setCustomViewSizes(Dimension[] sizes)
Set custom resolution. |
static void |
setDriver(Class<? extends WebcamDriver> driverClass)
Set new video driver class to be used by webcam. |
static void |
setDriver(WebcamDriver driver)
Set new video driver to be used by webcam. This method is not thread-safe! |
static void |
setHandleTermSignal(boolean on)
CAUTION!!! This is experimental feature to be used mostly in in development phase. |
void |
setViewSize(Dimension size)
Set new view size. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Webcam(WebcamDevice device)
device - - device to be used as webcam
IllegalArgumentException - when argument is null| Method Detail |
|---|
public void open()
public void close()
public boolean isOpen()
public Dimension getViewSize()
public Dimension[] getViewSizes()
public void setCustomViewSizes(Dimension[] sizes)
sizes - the array of custom resolutions to be supported by webcampublic Dimension[] getCustomViewSizes()
public void setViewSize(Dimension size)
size - the new view size to be setsetCustomViewSizes(Dimension[]),
getViewSizes()public BufferedImage getImage()
public static List<Webcam> getWebcams()
throws WebcamException
WebcamException - when something is wronggetWebcams(long, TimeUnit)
public static List<Webcam> getWebcams(long timeout)
throws TimeoutException,
WebcamException
timeout - the time to wait for webcam devices to be discovered
WebcamException - when something is wrong
TimeoutExceptiongetWebcams(long, TimeUnit)
public static List<Webcam> getWebcams(long timeout,
TimeUnit tunit)
throws TimeoutException,
WebcamException
timeout - the devices discovery timeouttunit - the time unit
TimeoutException - when timeout has been exceeded
WebcamException - when something is wrong
public static Webcam getDefault()
throws WebcamException
WebcamException - if something is really wronggetWebcams()
public static Webcam getDefault(long timeout)
throws TimeoutException,
WebcamException
timeout - the webcam discovery timeout (1 minute by default)
TimeoutException - when discovery timeout has been exceeded
WebcamException - if something is really wronggetWebcams(long)
public static Webcam getDefault(long timeout,
TimeUnit tunit)
throws TimeoutException,
WebcamException
timeout - the webcam discovery timeout (1 minute by default)tunit - the time unit
TimeoutException - when discovery timeout has been exceeded
WebcamException - if something is really wronggetWebcams(long, TimeUnit)public String getName()
public String toString()
toString in class Objectpublic boolean addWebcamListener(WebcamListener l)
l - the listener to be added
IllegalArgumentException - when argument is nullpublic WebcamListener[] getWebcamListeners()
public boolean removeWebcamListener(WebcamListener l)
l - the listener to be removed
public static WebcamDriver getDriver()
public static void setDriver(WebcamDriver driver)
driver - new webcam driver to be used (e.g. LtiCivil, JFM, FMJ, QTJ)
IllegalArgumentException - when argument is nullpublic static void setDriver(Class<? extends WebcamDriver> driverClass)
WebcamDriver interface and should have
public default constructor, so instance can be created by reflection.
driver - new video driver class to use
IllegalArgumentException - when argument is nullpublic static void resetDriver()
public static void registerDriver(Class<? extends WebcamDriver> clazz)
clazz - webcam video driver class
IllegalArgumentException - when argument is nullpublic static void registerDriver(String clazzName)
clazzName - webcam video driver class name
IllegalArgumentException - when argument is nullpublic WebcamDevice getDevice()
WebcamDefaultDevice is returned when no external driver is used.
protected WebcamProcessor getProcessor()
protected void dispose()
public static void setHandleTermSignal(boolean on)
on - signal handling will be enabled if true, disabled otherwisepublic static boolean isHandleTermSignal()
public static void setAutoOpenMode(boolean on)
on - true to enable, false to disablepublic static boolean isAutoOpenMode()
public static boolean addDiscoveryListener(WebcamDiscoveryListener l)
l - the listener to be added
IllegalArgumentException - when argument is nullpublic static WebcamDiscoveryListener[] getDiscoveryListeners()
public static boolean removeDiscoveryListener(WebcamDiscoveryListener l)
l - the listener to be removed
public static WebcamDiscoveryService getDiscoveryService()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||