public class WebcamDefaultDevice extends java.lang.Object implements WebcamDevice, WebcamDevice.BufferAccess, java.lang.Runnable, WebcamDevice.FPSSource
WebcamDevice.BufferAccess, WebcamDevice.Configurable, WebcamDevice.FPSSource| Modifier | Constructor and Description |
|---|---|
protected |
WebcamDefaultDevice(Device device) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close device, however it can be open again.
|
void |
dispose()
Dispose device.
|
java.lang.String |
getDeviceId() |
java.lang.String |
getDeviceName() |
Device |
getDeviceRef() |
double |
getFPS()
Get current device FPS.
|
java.awt.image.BufferedImage |
getImage()
Fetch image from underlying camera.
|
java.nio.ByteBuffer |
getImageBytes()
Read the underlying image memory buffer.
|
void |
getImageBytes(java.nio.ByteBuffer target)
Copy the underlying image memory into the target buffer passed as the
argument.The remaining capacity of the target buffer needs to be at
least image width * height * 3 bytes.
|
java.lang.String |
getName()
Get device name.
|
java.awt.Dimension |
getResolution()
Get currently set image size.
|
java.awt.Dimension[] |
getResolutions()
Get the list of all possible image resolutions.
|
int |
getTimeout()
Get timeout for image acquisition.
|
boolean |
isOpen()
Is webcam device open?
|
void |
open()
Open device, it can be closed any time.
|
void |
run() |
void |
setFailOnSizeMismatch(boolean fail)
Determines if device should fail when requested image size is different than actually
received.
|
void |
setResolution(java.awt.Dimension size)
Set new expected image size.
|
void |
setTimeout(int timeout)
Set timeout for image acquisition.
|
protected WebcamDefaultDevice(Device device)
public java.lang.String getName()
WebcamDevicegetName in interface WebcamDevicepublic java.lang.String getDeviceName()
public java.lang.String getDeviceId()
public Device getDeviceRef()
public java.awt.Dimension[] getResolutions()
WebcamDevicegetResolutions in interface WebcamDevicepublic java.awt.Dimension getResolution()
WebcamDevicegetResolution in interface WebcamDevicepublic void setResolution(java.awt.Dimension size)
WebcamDevicesetResolution in interface WebcamDevicesize - the size to be setpublic java.nio.ByteBuffer getImageBytes()
WebcamDevice.BufferAccessgetImageBytes in interface WebcamDevice.BufferAccesspublic void getImageBytes(java.nio.ByteBuffer target)
WebcamDevice.BufferAccessgetImageBytes in interface WebcamDevice.BufferAccesstarget - the buffer to which image data should be copiedpublic java.awt.image.BufferedImage getImage()
WebcamDevicegetImage in interface WebcamDevicepublic void open()
WebcamDeviceopen in interface WebcamDevicepublic void close()
WebcamDeviceclose in interface WebcamDevicepublic void dispose()
WebcamDevicedispose in interface WebcamDevicepublic void setFailOnSizeMismatch(boolean fail)
fail - the fail on size mismatch flag, true or falsepublic boolean isOpen()
WebcamDeviceisOpen in interface WebcamDevicepublic int getTimeout()
public void setTimeout(int timeout)
timeout - the timeout value in millisecondspublic void run()
run in interface java.lang.Runnablepublic double getFPS()
WebcamDevice.FPSSourcegetFPS in interface WebcamDevice.FPSSourceCopyright © 2012-2018 Bartosz Firyn (SarXos). All Rights Reserved.