j2d.video
Class Camera

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by jmapps.ui.JMFrame
                      extended by jmapps.ui.PlayerFrame
                          extended by j2d.video.Camera
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ContainerListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.media.ControllerListener

public class Camera
extends jmapps.ui.PlayerFrame

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 boolean showTimes
           
 java.lang.String timeBreakdown
           
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Camera()
          Default constructor.
Camera(java.lang.String deviceName)
          Constructs a camera with the passed camera deviceName.
Camera(java.lang.String deviceName, int displayMode, boolean showTimes, javax.media.format.VideoFormat videoFormat)
          Constructs a camera with the passed camera deviceName.
Camera(java.lang.String deviceName, javax.media.format.VideoFormat videoFormat)
          Constructs a camera with the passed camera deviceName.
Camera(javax.media.format.VideoFormat videoFormat)
          Constructs a camera with the passed camera deviceName.
 
Method Summary
 void controllerUpdate(javax.media.ControllerEvent event)
          DO NOT use this method!!! It is for initializing the camera, and is only public because it is inherited.
 java.lang.String getDeviceName()
          Returns the device name that the object is using.
 java.awt.Image getImage()
          Returns the current image in java.awt.Image format
 java.awt.Dimension getImageDimension()
          Returns the dimesions requested for this watch camera device.
 ObservableImage getObservableImage()
           
 java.lang.String getShortDeviceName()
          Returns the device name without the "vfw:" prefix.
 javax.media.format.VideoFormat getVideoFormat()
          Returns the video format of this camera device.
static void main(java.lang.String[] args)
          Entry point for viewing the camera images without doing any processing on the pixels.
 void open(javax.media.protocol.DataSource dataSource)
          DO NOT use this method!!!! It is for initializing the camera, and is only public because it is inherited
 void startWatching()
          startWatching will initiate image transfer from the camera.
 void stopWatching()
          Stops the camera.
 
Methods inherited from class jmapps.ui.PlayerFrame
actionPerformed, componentAdded, componentRemoved, open, open, setPlaceholder, windowClosed, windowClosing
 
Methods inherited from class jmapps.ui.JMFrame
addNotify, autoPosition, autoPosition, setVisible, windowActivated, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class java.awt.Frame
getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

timeBreakdown

public java.lang.String timeBreakdown

showTimes

public boolean showTimes
Constructor Detail

Camera

public Camera()
Default constructor. Defaults to the first camera device returned by a call to getDeviceNameList(). It also defaults to the pre-defined DEFAULT_VIDEO_FORMAT.


Camera

public Camera(java.lang.String deviceName)
Constructs a camera with the passed camera deviceName. This constructor uses the pre-defined DEFAULT_VIDEO_FORMAT as its video format. (See the constructor details for hints on how to use this more robustly!!!)

Parameters:
deviceName - Name of the camera device to use for this camera object. (The most robust way to get a valid deviceName is to make a call to getDeviceNameList and use one of the returned values when calling this constructor.)

Camera

public Camera(javax.media.format.VideoFormat videoFormat)
Constructs a camera with the passed camera deviceName. This constructor uses the first camera that defines this video format. (See the constructor details for hints on how to use this more robustly!!!)

Parameters:
videoFormat - The video format you want this camera to use. (The most robust way to get a valid videoFormat is to make a call to getAllSupportedVideoFormats() and use one of the returned values when calling this constructor.)

Camera

public Camera(java.lang.String deviceName,
              javax.media.format.VideoFormat videoFormat)
Constructs a camera with the passed camera deviceName. (See the constructor details for hints on how to use this more robustly!!!)

Parameters:
deviceName - Name of the camera device to use for this camera object. (The most robust way to get a valid deviceName is to make a call to getDeviceNameList and use one of the returned values when calling this constructor.)
videoFormat - The video format you want this camera to use. (The most robust way to get a valid videoFormat is to make a call to getAllSupportedVideoFormats() and use one of the returned values when calling this constructor.)

Camera

public Camera(java.lang.String deviceName,
              int displayMode,
              boolean showTimes,
              javax.media.format.VideoFormat videoFormat)
Constructs a camera with the passed camera deviceName. (See the constructor details for hints on how to use this more robustly!!!)

Parameters:
deviceName - Name of the camera device to use for this camera object. (The most robust way to get a valid deviceName is to make a call to getDeviceNameList and use one of the returned values when calling this constructor.)
displayMode - The display mode of the camera. DISPLAY_NOTHING - (the default) does not show DISPLAY_ON_EVENT - (used for debug) used in main of this class to show images when requested DISPLAY_ALL_VIDEO - (used for debug) streams the video to a player frame
showTimes - Used purely for debugging purposes, but shows processing times. (If you override processTimes you can use addTimeString and if this is set to true, after every image is processed the time string debug info is printed to the console.)
videoFormat - The video format you want this camera to use. (The most robust way to get a valid videoFormat is to make a call to getAllSupportedVideoFormats() and use one of the returned values when calling this constructor.)
Method Detail

stopWatching

public void stopWatching()
Stops the camera.


startWatching

public void startWatching()
startWatching will initiate image transfer from the camera. It uses the settings that were set from JMStudio, then starts fetching the images. After each image is fetched, processImage() is called. This method returns immediately after the camera is initialized, unlike WatchCamera.startWatching() which doesn't return until the stopWatching() method is called.


open

public void open(javax.media.protocol.DataSource dataSource)
DO NOT use this method!!!! It is for initializing the camera, and is only public because it is inherited

Overrides:
open in class jmapps.ui.PlayerFrame

controllerUpdate

public void controllerUpdate(javax.media.ControllerEvent event)
DO NOT use this method!!! It is for initializing the camera, and is only public because it is inherited. This is where the actual data transfer handler is set for the camera for obtaining the pixel data.

Specified by:
controllerUpdate in interface javax.media.ControllerListener
Overrides:
controllerUpdate in class jmapps.ui.PlayerFrame

main

public static void main(java.lang.String[] args)
Entry point for viewing the camera images without doing any processing on the pixels. Useful for making sure the camera is working.


getImage

public java.awt.Image getImage()
Returns the current image in java.awt.Image format


getImageDimension

public java.awt.Dimension getImageDimension()
Returns the dimesions requested for this watch camera device.


getVideoFormat

public javax.media.format.VideoFormat getVideoFormat()
Returns the video format of this camera device.


getDeviceName

public java.lang.String getDeviceName()
Returns the device name that the object is using.


getShortDeviceName

public java.lang.String getShortDeviceName()
Returns the device name without the "vfw:" prefix.


getObservableImage

public ObservableImage getObservableImage()