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()
WebcamDevice
getName
in interface WebcamDevice
public java.lang.String getDeviceName()
public java.lang.String getDeviceId()
public Device getDeviceRef()
public java.awt.Dimension[] getResolutions()
WebcamDevice
getResolutions
in interface WebcamDevice
public java.awt.Dimension getResolution()
WebcamDevice
getResolution
in interface WebcamDevice
public void setResolution(java.awt.Dimension size)
WebcamDevice
setResolution
in interface WebcamDevice
size
- the size to be setpublic java.nio.ByteBuffer getImageBytes()
WebcamDevice.BufferAccess
getImageBytes
in interface WebcamDevice.BufferAccess
public void getImageBytes(java.nio.ByteBuffer target)
WebcamDevice.BufferAccess
getImageBytes
in interface WebcamDevice.BufferAccess
target
- the buffer to which image data should be copiedpublic java.awt.image.BufferedImage getImage()
WebcamDevice
getImage
in interface WebcamDevice
public void open()
WebcamDevice
open
in interface WebcamDevice
public void close()
WebcamDevice
close
in interface WebcamDevice
public void dispose()
WebcamDevice
dispose
in interface WebcamDevice
public void setFailOnSizeMismatch(boolean fail)
fail
- the fail on size mismatch flag, true or falsepublic boolean isOpen()
WebcamDevice
isOpen
in interface WebcamDevice
public int getTimeout()
public void setTimeout(int timeout)
timeout
- the timeout value in millisecondspublic void run()
run
in interface java.lang.Runnable
public double getFPS()
WebcamDevice.FPSSource
getFPS
in interface WebcamDevice.FPSSource
Copyright © 2012-2018 Bartosz Firyn (SarXos). All Rights Reserved.