Class Camera

  • Direct Known Subclasses:
    CameraFirewire

    public class Camera
    extends Sensor
    The Camera class defines a generel interface to a camera.
    A great deal of the interface resembles the DCAM standard since
    DCAM allready defines a very wide interface.

    typical usage:
    Camera c;
    // setup camera features modes and so on
    c.initialize();
    c.start();
    // acquire images
    c.stop();
    • Constructor Summary

      Constructors 
      Constructor Description
      Camera​(long cPtr, boolean cMemoryOwn)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acquire()
      aquires an image from the camera.
      boolean addListener​(CameraListener listener)
      adds a CameraListener to this camera
      void delete()  
      static long getCPtr​(Camera obj)  
      double getFrameRate()
      returns the framerate that this camera is setup with

      double getGain()
      Get actual gain value.
      Note: If gain is not available then a dummy implementation
      returning -1 is used and an error message is produced.

      long getHeight()
      get width of the captured images

      Image getImage()
      returns the last image acquired from the camera.
      java.lang.String getModelInfo()
      returns the camera model information (version, type, size, etc.)

      double getShutter()
      Get actual shutter value.
      Note: If shutter is not available then a dummy implementation
      will throw an error message.

      pairDoubleDouble getShutterBounds()
      gets the shutter bounds.
      Note: If shutter is not available then a dummy implementation
      will throw an error message.
      long getWidth()
      get width of the captured images

      boolean initialize()
      initializes the camera to the current settings
      (CaptureMode,ColorMode,etc.)

      boolean isGainAvailable()
      Check if gain is available.

      boolean isImageReady()
      tests whether a image has been acquired

      boolean isInitialized()
      returns whether this camera is initialized or not.

      boolean isShutterAvailable()
      Check if shutter is available.

      boolean isStarted()
      returns whether this camera is started or not.

      boolean removeListener​(CameraListener listener)
      removes a CameraListener from this cameras listener list.
      void setFrameRate​(double framerate)
      sets the framerate of this camera.
      double setGain​(double Value)
      Set gain value.
      void setShutter​(double Value)
      Set shutter value.
      boolean start()
      starts this camera, if the camera has not been
      initialized the initialize function will be called.

      void stop()
      stops this camera.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Camera

        public Camera​(long cPtr,
                      boolean cMemoryOwn)
    • Method Detail

      • getCPtr

        public static long getCPtr​(Camera obj)
      • delete

        public void delete()
        Overrides:
        delete in class Sensor
      • getModelInfo

        public java.lang.String getModelInfo()
        returns the camera model information (version, type, size, etc.)

        Returns:
        camera model information
      • initialize

        public boolean initialize()
        initializes the camera to the current settings
        (CaptureMode,ColorMode,etc.)

        Returns:
        true if initialization is succesfully, false otherwise.
      • isInitialized

        public boolean isInitialized()
        returns whether this camera is initialized or not.

        Returns:
        true if intialized, false otherwise
      • start

        public boolean start()
        starts this camera, if the camera has not been
        initialized the initialize function will be called.

        Returns:
        true if camera was successfully started, false
        otherwise
      • isStarted

        public boolean isStarted()
        returns whether this camera is started or not.

        Returns:
        true if started, false otherwise
      • stop

        public void stop()
        stops this camera. When the camera is stopped it can be
        reinitialized using initialize()
      • acquire

        public void acquire()
        aquires an image from the camera. This method is not blocking.
        Use isImageReady to poll for completion of acquire.
      • isImageReady

        public boolean isImageReady()
        tests whether a image has been acquired

        Returns:
        true if an image has been acquired, false otherwise.
      • getImage

        public Image getImage()
        returns the last image acquired from the camera. This method
        is not blocking, if no image has been acquired yet an empty image
        is returned. The image returned can for some specific drivers be read
        only.

        Returns:
        last image captured from camera.
      • getFrameRate

        public double getFrameRate()
        returns the framerate that this camera is setup with

        Returns:
        the framerate in frames per second
      • setFrameRate

        public void setFrameRate​(double framerate)
        sets the framerate of this camera. If the framerate is not
        supported the closest supported framerate is choosen.

        Parameters:
        framerate - [in] the framerate
      • getWidth

        public long getWidth()
        get width of the captured images

        Returns:
        width
      • getHeight

        public long getHeight()
        get width of the captured images

        Returns:
        width
      • addListener

        public boolean addListener​(CameraListener listener)
        adds a CameraListener to this camera
        Parameters:
        listener - [in] the CameraListener that is to be added
        Returns:
        true if listener was added succesfully, false otherwise
      • removeListener

        public boolean removeListener​(CameraListener listener)
        removes a CameraListener from this cameras listener list.
        Parameters:
        listener - [in] the listener that is to be removed
        Returns:
        true if listener was removed succesfully, false otherwise.
      • isShutterAvailable

        public boolean isShutterAvailable()
        Check if shutter is available.

        Returns:
        True if shutter is available
      • getShutter

        public double getShutter()
        Get actual shutter value.
        Note: If shutter is not available then a dummy implementation
        will throw an error message.

        Returns:
        shutter value in micro-seconds.
      • setShutter

        public void setShutter​(double Value)
        Set shutter value. If the given value is not possible the nearest
        value are choosen.
        Note: If shutter is not available then a dummy implementation
        will throw an error message.

        Parameters:
        Value - New shutter value.
      • getShutterBounds

        public pairDoubleDouble getShutterBounds()
        gets the shutter bounds.
        Note: If shutter is not available then a dummy implementation
        will throw an error message.
        Returns:
        first value is the min bound and second value is the max bound
      • isGainAvailable

        public boolean isGainAvailable()
        Check if gain is available.

        Returns:
        True if zoom is available
      • getGain

        public double getGain()
        Get actual gain value.
        Note: If gain is not available then a dummy implementation
        returning -1 is used and an error message is produced.

        Returns:
        Gain value.
      • setGain

        public double setGain​(double Value)
        Set gain value. If the given value is not possible the nearest
        value are choosen.
        Note: If gain is not available then a dummy implementation
        returning -1 is used and an error message is produced.

        Parameters:
        Value - New gain value.
        Returns:
        New nearest gain value.