Bartosz Firyn (SarXos)

com.github.sarxos.webcam.ds.buildin
Class WebcamDefaultDevice

java.lang.Object
  extended by com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice
All Implemented Interfaces:
WebcamDevice, WebcamDevice.BufferAccess

public class WebcamDefaultDevice
extends Object
implements WebcamDevice, WebcamDevice.BufferAccess


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.github.sarxos.webcam.WebcamDevice
WebcamDevice.BufferAccess
 
Method Summary
 void close()
          Close device, however it can be open again.
 void dispose()
          Dispose device.
 BufferedImage getImage()
          Fetch image from underlying camera.
 ByteBuffer getImageBytes()
          Get image in form of raw bytes.
 String getName()
          Get device name.
 Dimension getResolution()
          Get currently set image size.
 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 setFailOnSizeMismatch(boolean fail)
          Determines if device should fail when requested image size is different than actually received.
 void setResolution(Dimension size)
          Set new expected image size.
 void setTimeout(int timeout)
          Set timeout for image acquisition.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public String getName()
Description copied from interface: WebcamDevice
Get device name.

Specified by:
getName in interface WebcamDevice
Returns:
Device name

getResolutions

public Dimension[] getResolutions()
Description copied from interface: WebcamDevice
Get the list of all possible image resolutions.

Specified by:
getResolutions in interface WebcamDevice
Returns:
Possible resolutions

getResolution

public Dimension getResolution()
Description copied from interface: WebcamDevice
Get currently set image size.

Specified by:
getResolution in interface WebcamDevice
Returns:
The size which is currently set

setResolution

public void setResolution(Dimension size)
Description copied from interface: WebcamDevice
Set new expected image size.

Specified by:
setResolution in interface WebcamDevice
Parameters:
size - the size to be set

getImageBytes

public ByteBuffer getImageBytes()
Description copied from interface: WebcamDevice.BufferAccess
Get image in form of raw bytes. Do not use this buffer to set bytes value, it should be used only for read purpose!

Specified by:
getImageBytes in interface WebcamDevice.BufferAccess
Returns:
Bytes buffer

getImage

public BufferedImage getImage()
Description copied from interface: WebcamDevice
Fetch image from underlying camera.

Specified by:
getImage in interface WebcamDevice
Returns:
Image

open

public void open()
Description copied from interface: WebcamDevice
Open device, it can be closed any time.

Specified by:
open in interface WebcamDevice

close

public void close()
Description copied from interface: WebcamDevice
Close device, however it can be open again.

Specified by:
close in interface WebcamDevice

dispose

public void dispose()
Description copied from interface: WebcamDevice
Dispose device. After device is disposed it cannot be open again.

Specified by:
dispose in interface WebcamDevice

setFailOnSizeMismatch

public void setFailOnSizeMismatch(boolean fail)
Determines if device should fail when requested image size is different than actually received.

Parameters:
fail - the fail on size mismatch flag, true or false

isOpen

public boolean isOpen()
Description copied from interface: WebcamDevice
Is webcam device open?

Specified by:
isOpen in interface WebcamDevice
Returns:
True if webcam device is open, false otherwise

getTimeout

public int getTimeout()
Get timeout for image acquisition.

Returns:
Value in milliseconds

setTimeout

public void setTimeout(int timeout)
Set timeout for image acquisition.

Parameters:
timeout - the timeout value in milliseconds

Bartosz Firyn (SarXos)

Copyright © 2012-2013 Bartosz Firyn (SarXos). All Rights Reserved.