Package jisa.devices.camera
Class Webcam
- java.lang.Object
-
- jisa.devices.camera.Webcam
-
- All Implemented Interfaces:
Camera
,Instrument
public class Webcam extends java.lang.Object implements Camera
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jisa.devices.interfaces.Camera
Camera.Frame, Camera.Mode
-
Nested classes/interfaces inherited from interface jisa.devices.interfaces.Instrument
Instrument.AutoQuantity<S>, Instrument.OptionalQuantity<S>, Instrument.Parameter<S>, Instrument.Setter<S>, Instrument.TableQuantity
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the connection to the instrument.Address
getAddress()
Returns any Address object used to connect to this instrument.java.awt.image.BufferedImage
getBufferedImage()
Captures a frame from the camera, returning it as a BufferedImage object.double
getFrameRate()
Returns how many frames the camera is/can capture each second.java.lang.String
getIDN()
Returns an identifying String of the instrument.Camera.Mode
getMode()
Returns the resolution mode the camera is currently using.java.util.List<Camera.Mode>
getModes()
Returns a list of all available resolution modes for the camera.java.lang.String
getName()
Returns the name of the instrument or channel.boolean
isOn()
Returns whether the camera is switched on or off.void
setMode(Camera.Mode mode)
Sets the resolution mode the camera is to use.void
turnOff()
Turns the camera off (stops capturing).void
turnOn()
Turns the camera on (starts capturing).-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jisa.devices.interfaces.Camera
captureFrame, getImage, setOn
-
Methods inherited from interface jisa.devices.interfaces.Instrument
getConfigurationParameters, getConfigurationParameters, getLockObject, setTimeout
-
-
-
-
Constructor Detail
-
Webcam
public Webcam() throws java.io.IOException, DeviceException
- Throws:
java.io.IOException
DeviceException
-
Webcam
public Webcam(java.lang.String name) throws java.io.IOException, DeviceException
- Throws:
java.io.IOException
DeviceException
-
Webcam
public Webcam(Address address) throws java.io.IOException, DeviceException
- Throws:
java.io.IOException
DeviceException
-
-
Method Detail
-
turnOn
public void turnOn() throws java.io.IOException, DeviceException
Description copied from interface:Camera
Turns the camera on (starts capturing).- Specified by:
turnOn
in interfaceCamera
- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon device incompatibility
-
turnOff
public void turnOff() throws java.io.IOException, DeviceException
Description copied from interface:Camera
Turns the camera off (stops capturing).- Specified by:
turnOff
in interfaceCamera
- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon device incompatibility
-
isOn
public boolean isOn() throws java.io.IOException, DeviceException
Description copied from interface:Camera
Returns whether the camera is switched on or off.- Specified by:
isOn
in interfaceCamera
- Returns:
- Is it on?
- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon device incompatibility
-
getMode
public Camera.Mode getMode() throws java.io.IOException, DeviceException
Description copied from interface:Camera
Returns the resolution mode the camera is currently using.- Specified by:
getMode
in interfaceCamera
- Returns:
- Resolution mode
- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon device incompatibility
-
setMode
public void setMode(Camera.Mode mode) throws java.io.IOException, DeviceException
Description copied from interface:Camera
Sets the resolution mode the camera is to use.- Specified by:
setMode
in interfaceCamera
- Parameters:
mode
- Mode to use- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon device incompatibility
-
getFrameRate
public double getFrameRate()
Description copied from interface:Camera
Returns how many frames the camera is/can capture each second.- Specified by:
getFrameRate
in interfaceCamera
- Returns:
- Current framerate
-
getBufferedImage
public java.awt.image.BufferedImage getBufferedImage()
Description copied from interface:Camera
Captures a frame from the camera, returning it as a BufferedImage object.- Specified by:
getBufferedImage
in interfaceCamera
- Returns:
- Captured frame
-
getModes
public java.util.List<Camera.Mode> getModes() throws java.io.IOException, DeviceException
Description copied from interface:Camera
Returns a list of all available resolution modes for the camera.- Specified by:
getModes
in interfaceCamera
- Returns:
- List of modes
- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon device incompatibility
-
getIDN
public java.lang.String getIDN() throws java.io.IOException, DeviceException
Description copied from interface:Instrument
Returns an identifying String of the instrument.- Specified by:
getIDN
in interfaceInstrument
- Returns:
- Identifying String
- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon incompatibility with device
-
getName
public java.lang.String getName()
Description copied from interface:Instrument
Returns the name of the instrument or channel.- Specified by:
getName
in interfaceInstrument
- Returns:
- Name
-
close
public void close() throws java.io.IOException, DeviceException
Description copied from interface:Instrument
Closes the connection to the instrument.- Specified by:
close
in interfaceInstrument
- Throws:
java.io.IOException
- Upon communications errorDeviceException
- Upon incompatibility with device
-
getAddress
public Address getAddress()
Description copied from interface:Instrument
Returns any Address object used to connect to this instrument.- Specified by:
getAddress
in interfaceInstrument
- Returns:
- Address object, null if none
-
-