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 voidclose()Closes the connection to the instrument.AddressgetAddress()Returns any Address object used to connect to this instrument.java.awt.image.BufferedImagegetBufferedImage()Captures a frame from the camera, returning it as a BufferedImage object.doublegetFrameRate()Returns how many frames the camera is/can capture each second.java.lang.StringgetIDN()Returns an identifying String of the instrument.Camera.ModegetMode()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.StringgetName()Returns the name of the instrument or channel.booleanisOn()Returns whether the camera is switched on or off.voidsetMode(Camera.Mode mode)Sets the resolution mode the camera is to use.voidturnOff()Turns the camera off (stops capturing).voidturnOn()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.IOExceptionDeviceException
-
Webcam
public Webcam(java.lang.String name) throws java.io.IOException, DeviceException- Throws:
java.io.IOExceptionDeviceException
-
Webcam
public Webcam(Address address) throws java.io.IOException, DeviceException
- Throws:
java.io.IOExceptionDeviceException
-
-
Method Detail
-
turnOn
public void turnOn() throws java.io.IOException, DeviceExceptionDescription copied from interface:CameraTurns the camera on (starts capturing).- Specified by:
turnOnin interfaceCamera- Throws:
java.io.IOException- Upon communications errorDeviceException- Upon device incompatibility
-
turnOff
public void turnOff() throws java.io.IOException, DeviceExceptionDescription copied from interface:CameraTurns the camera off (stops capturing).- Specified by:
turnOffin interfaceCamera- Throws:
java.io.IOException- Upon communications errorDeviceException- Upon device incompatibility
-
isOn
public boolean isOn() throws java.io.IOException, DeviceExceptionDescription copied from interface:CameraReturns whether the camera is switched on or off.- Specified by:
isOnin 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:CameraReturns the resolution mode the camera is currently using.- Specified by:
getModein 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:CameraSets the resolution mode the camera is to use.- Specified by:
setModein interfaceCamera- Parameters:
mode- Mode to use- Throws:
java.io.IOException- Upon communications errorDeviceException- Upon device incompatibility
-
getFrameRate
public double getFrameRate()
Description copied from interface:CameraReturns how many frames the camera is/can capture each second.- Specified by:
getFrameRatein interfaceCamera- Returns:
- Current framerate
-
getBufferedImage
public java.awt.image.BufferedImage getBufferedImage()
Description copied from interface:CameraCaptures a frame from the camera, returning it as a BufferedImage object.- Specified by:
getBufferedImagein interfaceCamera- Returns:
- Captured frame
-
getModes
public java.util.List<Camera.Mode> getModes() throws java.io.IOException, DeviceException
Description copied from interface:CameraReturns a list of all available resolution modes for the camera.- Specified by:
getModesin 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, DeviceExceptionDescription copied from interface:InstrumentReturns an identifying String of the instrument.- Specified by:
getIDNin 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:InstrumentReturns the name of the instrument or channel.- Specified by:
getNamein interfaceInstrument- Returns:
- Name
-
close
public void close() throws java.io.IOException, DeviceExceptionDescription copied from interface:InstrumentCloses the connection to the instrument.- Specified by:
closein interfaceInstrument- Throws:
java.io.IOException- Upon communications errorDeviceException- Upon incompatibility with device
-
getAddress
public Address getAddress()
Description copied from interface:InstrumentReturns any Address object used to connect to this instrument.- Specified by:
getAddressin interfaceInstrument- Returns:
- Address object, null if none
-
-