Package org.openpnp.spi
Interface Camera
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,HeadMountable
,Identifiable
,Locatable
,Movable
,MovableMountable
,Named
,PropertySheetHolder
,Solutions.Subject
,WizardConfigurable
- All Known Implementing Classes:
AbstractBroadcastingCamera
,AbstractCamera
,AbstractSettlingCamera
,BufferedImageCamera
,GstreamerCamera
,ImageCamera
,MjpgCaptureCamera
,Neoden4Camera
,Neoden4SwitcherCamera
,OnvifIPCamera
,OpenCvCamera
,OpenPnpCaptureCamera
,ReferenceCamera
,SimulatedUpCamera
,SwitcherCamera
,Webcams
public interface Camera extends HeadMountable, WizardConfigurable, PropertySheetHolder, java.io.Closeable
Represents a Camera attached to the system and allows a caller to retrieve images from it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Camera.Looking
static class
Camera.SettleOption
-
Nested classes/interfaces inherited from interface org.openpnp.spi.Locatable
Locatable.LocationOption
-
Nested classes/interfaces inherited from interface org.openpnp.spi.PropertySheetHolder
PropertySheetHolder.PropertySheet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
actuateLightAfterCapture()
Inform the Camera that the light actuator (if any) may now be actuated to the default off setting.default void
actuateLightBeforeCapture()
Inform the Camera that the light actuator (if any) should now be actuated to the default light setting.void
actuateLightBeforeCapture(java.lang.Object light)
Inform the Camera that the light actuator (if any) should now be actuated to the given light setting.java.awt.image.BufferedImage
capture()
Immediately captures an image from the camera and returns it in it's native format.java.awt.image.BufferedImage
captureRaw()
java.awt.image.BufferedImage
captureTransformed()
void
ensureCameraVisible()
Ensure the related CameraView will eventually be made visible on the user interface.Length
getDefaultZ()
Gets the Z height of the default working plane for this camera.FocusProvider
getFocusProvider()
int
getHeight()
Get the height of images in pixels that will be returned from this Camera.Actuator
getLightActuator()
Location
getLocation(HeadMountable tool)
Get the location of the camera including the calibrated offset for the given tool.Camera.Looking
getLooking()
Get the direction the Camera is looking.Length
getRoamingRadius()
Location
getUnitsPerPixel()
The number of X and Y units per pixel this camera shows when in perfect focus.Location
getUnitsPerPixel(Length z)
Gets the units per pixel for determining the physical size of an object in an image given its Z height is knowndefault Location
getUnitsPerPixelAtZ()
Gets units per pixel for determining the physical size of an object in an image given its Z is at the (virtual) Z axis of the camera location.VisionProvider
getVisionProvider()
Get the VisionProvider that is attached to this Camera, if any.int
getWidth()
Get the width of images in pixels that will be returned from this Camera.boolean
hasNewFrame()
default boolean
isAutoVisible()
boolean
isShownInMultiCameraView()
default boolean
isUnitsPerPixelAtZCalibrated()
java.awt.image.BufferedImage
lightSettleAndCapture()
Same as capture(), but lights and settles the camera before capturing.void
setLooking(Camera.Looking looking)
default java.awt.image.BufferedImage
settleAndCapture()
Same as capture() but settles the camera before capturing.java.awt.image.BufferedImage
settleAndCapture(Camera.SettleOption settleOption)
Same as capture() but settles the camera before capturing.void
setUnitsPerPixel(Location unitsPerPixel)
void
setVisionProvider(VisionProvider visionProvider)
void
startContinuousCapture(CameraListener listener)
Registers a listener to receive continuous images from the camera.void
stopContinuousCapture(CameraListener listener)
Requests that the continuous capture be stopped for the previously registered listener.-
Methods inherited from interface org.openpnp.spi.HeadMountable
getCameraToolCalibratedOffset, getHead, getHeadOffsets, setHead, setHeadOffsets, toHeadLocation, toHeadMountableLocation, waitForCompletion
-
Methods inherited from interface org.openpnp.model.Identifiable
getId
-
Methods inherited from interface org.openpnp.spi.Locatable
getApproximativeLocation, getLocation
-
Methods inherited from interface org.openpnp.spi.Movable
getEffectiveSafeZ, getSafeZ, getSafeZZone, home, isInSafeZZone, isReachable, moveTo, moveTo, moveToSafeZ, moveToSafeZ
-
Methods inherited from interface org.openpnp.spi.MovableMountable
getAxis, getAxisRotation, getAxisX, getAxisY, getAxisZ, getMappedAxes, toRaw, toTransformed
-
Methods inherited from interface org.openpnp.spi.PropertySheetHolder
getChildPropertySheetHolders, getPropertySheetHolderActions, getPropertySheetHolderIcon, getPropertySheetHolderTitle, getPropertySheets
-
Methods inherited from interface org.openpnp.model.Solutions.Subject
findIssues, getSubjectIcon, getSubjectText
-
Methods inherited from interface org.openpnp.spi.WizardConfigurable
getConfigurationWizard
-
-
-
-
Method Detail
-
getLocation
Location getLocation(HeadMountable tool)
Get the location of the camera including the calibrated offset for the given tool. If the bottom camera focal plane is different from the PCB surface plane, the various tools might introduce slight offsets in X, Y as their Z axes are not perfectly parallel. This offset is compensated if the getLocation(tool) method is used instead of the plain getLocation() method. If tool == null it returns the same as plain getLocation().- Parameters:
tool
-- Returns:
-
getLooking
Camera.Looking getLooking()
Get the direction the Camera is looking.- Returns:
-
setLooking
void setLooking(Camera.Looking looking)
-
getUnitsPerPixel
Location getUnitsPerPixel()
The number of X and Y units per pixel this camera shows when in perfect focus. The Z value of this location is the height at which the units per pixel were measured.- Returns:
- a Location whose x and y length represent the units per pixel in those axis respectively
-
setUnitsPerPixel
void setUnitsPerPixel(Location unitsPerPixel)
-
getUnitsPerPixel
Location getUnitsPerPixel(Length z)
Gets the units per pixel for determining the physical size of an object in an image given its Z height is known- Parameters:
z
- - a length with the z coordinate of the imaged object, if null, the height of the default working plane for this camera is used- Returns:
- a Location whose x and y length represent the units per pixel in those axis respectively
-
getUnitsPerPixelAtZ
default Location getUnitsPerPixelAtZ()
Gets units per pixel for determining the physical size of an object in an image given its Z is at the (virtual) Z axis of the camera location. If the camera Z is at or above Safe Z, meaning the Z is actually not set, it will fall back to the standard units per pixel. This is also the default for cameras that do not have a concept of a location or Z axis.- Returns:
-
getDefaultZ
Length getDefaultZ()
Gets the Z height of the default working plane for this camera. This is the height at which objects are assumed to be if no other information is available.- Returns:
- the Z height of the default working plane
-
isUnitsPerPixelAtZCalibrated
default boolean isUnitsPerPixelAtZCalibrated()
- Returns:
- true, if Z-dependent units per pixel are available and configured.
-
capture
java.awt.image.BufferedImage capture() throws java.lang.Exception
Immediately captures an image from the camera and returns it in it's native format. Fires the Camera.BeforeCapture and Camera.AfterCapture scripting events before and after.- Returns:
- Throws:
java.lang.Exception
-
captureTransformed
java.awt.image.BufferedImage captureTransformed()
-
captureRaw
java.awt.image.BufferedImage captureRaw()
-
settleAndCapture
java.awt.image.BufferedImage settleAndCapture(Camera.SettleOption settleOption) throws java.lang.Exception
Same as capture() but settles the camera before capturing.- Parameters:
settleOption
- Determines how thorough the settling is.- Returns:
- Throws:
java.lang.Exception
-
settleAndCapture
default java.awt.image.BufferedImage settleAndCapture() throws java.lang.Exception
Same as capture() but settles the camera before capturing.- Returns:
- Throws:
java.lang.Exception
-
lightSettleAndCapture
java.awt.image.BufferedImage lightSettleAndCapture() throws java.lang.Exception
Same as capture(), but lights and settles the camera before capturing. Uses default lighting.- Returns:
- Throws:
java.lang.Exception
-
hasNewFrame
boolean hasNewFrame()
- Returns:
- True if the Camera device has a new frame available (since the last one was captured).
-
startContinuousCapture
void startContinuousCapture(CameraListener listener)
Registers a listener to receive continuous images from the camera.- Parameters:
listener
-
-
stopContinuousCapture
void stopContinuousCapture(CameraListener listener)
Requests that the continuous capture be stopped for the previously registered listener. If the Camera has other listeners they should still receive updates.- Parameters:
listener
-
-
setVisionProvider
void setVisionProvider(VisionProvider visionProvider)
-
getVisionProvider
VisionProvider getVisionProvider()
Get the VisionProvider that is attached to this Camera, if any.- Returns:
-
getWidth
int getWidth()
Get the width of images in pixels that will be returned from this Camera.- Returns:
-
getHeight
int getHeight()
Get the height of images in pixels that will be returned from this Camera.- Returns:
-
getLightActuator
Actuator getLightActuator()
- Returns:
- the Camera light actuator.
-
actuateLightBeforeCapture
void actuateLightBeforeCapture(java.lang.Object light) throws java.lang.Exception
Inform the Camera that the light actuator (if any) should now be actuated to the given light setting. Effective actuation may be optimized to span longer periods/prevent blinking.- Parameters:
light
- Provides the light actuation value or null for default lighting.- Throws:
java.lang.Exception
-
actuateLightBeforeCapture
default void actuateLightBeforeCapture() throws java.lang.Exception
Inform the Camera that the light actuator (if any) should now be actuated to the default light setting. Effective actuation may be optimized to span longer periods/prevent blinking.- Throws:
java.lang.Exception
-
actuateLightAfterCapture
void actuateLightAfterCapture() throws java.lang.Exception
Inform the Camera that the light actuator (if any) may now be actuated to the default off setting. Effective actuation may be optimized to span longer periods/prevent blinking.- Throws:
java.lang.Exception
-
ensureCameraVisible
void ensureCameraVisible()
Ensure the related CameraView will eventually be made visible on the user interface.
-
isAutoVisible
default boolean isAutoVisible()
- Returns:
- True if
ensureCameraVisible()
should be called on this Camera whenever a targeted user action changes the Camera view.
-
isShownInMultiCameraView
boolean isShownInMultiCameraView()
- Returns:
- True if this Camera should be shown in multi camera view panels.
-
getFocusProvider
FocusProvider getFocusProvider()
-
getRoamingRadius
Length getRoamingRadius()
- Returns:
- The bottom camera roaming radius within which a part is allowed to be positioned at camera Z. It includes moving the nozzle around to take different shots of the parts, and the part extent itself. It does not include pick offsets and other deviations that may occur during practical operation, a physical camera "pit" must allow for some extra wiggle space, on to of this nominal radius.
-
-