FindIt
Class VideoStreamController

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by FindIt.VideoStreamController
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class VideoStreamController
extends javax.swing.JPanel

The VideoStreamController Panel class that is called from the ColoredShapesTracker.start() function. this class creates the connection with the specified video capture device, and repeatedly grabs the curent frame from the capptured video, converting it to BufferedImage. Then if at least one color for process is selected, calls the ImageProcessor class, sending to it the BufferedImage to make the particular calculattions. After this, shows the results at the screen. Particularly, when the myTimer() function has been called, calls the function step() that in the begging calls the function getFrame(), that grabs the current frame, converts it to buffered image and returns it at the step(), Then the step(), if at least one color is selected, calls the ImageProcessor with paramert the buffered image. When the calculations in ImageProcessor has finished returns back a new buffered image with the results "printed" on it. And from the begging again.

Author:
Konstantinos Stathopoulos
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static SinkData blackSinkData
          The SinkData class decleration, as blackSinkData for the Black's color data sink.
static SinkData blueSinkData
          The SinkData class decleration, as blueSinkData for the Blue's color data sink.
static SinkData brownSinkData
          The SinkData class decleration, as brownSinkData for the Brown's color data sink.
static java.awt.image.BufferedImage bufferedImage
          A BufferedImage variable decleration, the bufferedImage, that is used to take each grabed frame, that has been converted to Buffered Image and to send this Buffered Image to the ImageProcessor class for the particular calculations.
static javax.media.CaptureDeviceInfo captureVideoDevice
           
static javax.media.format.VideoFormat captureVideoFormat
           
static SinkData cyanSinkData
          The SinkData class decleration, as cyanSinkData for the Cyan's color data sink.
static boolean debugDeviceList
           
static javax.media.CaptureDeviceInfo deviceInfo
           
static javax.media.protocol.DataSource ds1
           
static java.awt.Image frameImage
           
static javax.swing.Timer grabTimer
          A Timer variable decleration, the grabTimer, who at each clock fires a particular chain of calculations, functions and procedures who are needed for the calculations.
static SinkData graySinkData
          The SinkData class decleration, as graySinkData for the Gray's color data sink.
static SinkData greenSinkData
          The SinkData class decleration, as greenSinkData for the Green's color data sink.
static SinkData magentaSinkData
          The SinkData class decleration, as magenteSinkData for the Magenta's color data sink.
static SinkData orangeSinkData
          The SinkData class decleration, as orangeSinkData for the Orange's color data sink.
static SinkData pinkSinkData
          The SinkData class decleration, as pinkSinkData for the Pink's color data sink.
static javax.media.Player player
          A Player variable decleration, the player, that takes as input the processor's data output and used to grab the frames and convert them to BufferedImages.
static javax.media.Processor processor
          A Processor variable decleration, the processor, that takes the source from the Data Source that has been connected with the video captured device.
static SinkData redSinkData
          The SinkData class decleration, as redSinkData for the Red's color data sink.
static SinkColorValues sinkColorValues
          The SinkColorValues class decleration, as sinkColorValues.
static javax.media.protocol.DataSource videoDataSource
           
static SinkData whiteSinkData
          The SinkData class decleration, as whiteSinkData for the White's color data sink.
static SinkData yellowSinkData
          The SinkData class decleration, as yellowSinkData for the Yellow's color data sink.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
VideoStreamController()
          Creates a new empty instance of the VideoStreamController.
VideoStreamController(java.lang.String name, java.lang.String videoFormat)
          Creates a new instance of the VideoStreamController, that takes as parameters the video capture's device name and the selected video format to create the connection with the camera, sets the format and calls the myTimer() function to start the chain for the particular processes.
 
Method Summary
 java.awt.Image getFrame()
          The function getFrame, that grabs the current frame, converts it to buffered image and returns it at the step().
 void myTimer()
          The function myTimer that starts and repeats the particular processing chain.
 void paint(java.awt.Graphics g)
          the Paint function for optical represantation of calculation.
 void step()
          The step function that is called from the myTimer() function, that in the begging calls the function getFrame(), that grabs the current frame, converts it to buffered image and returns it at the step, then, if at least one color is selected, calls the ImageProcessor with paramert the buffered image.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

player

public static javax.media.Player player
A Player variable decleration, the player, that takes as input the processor's data output and used to grab the frames and convert them to BufferedImages.


bufferedImage

public static java.awt.image.BufferedImage bufferedImage
A BufferedImage variable decleration, the bufferedImage, that is used to take each grabed frame, that has been converted to Buffered Image and to send this Buffered Image to the ImageProcessor class for the particular calculations.


grabTimer

public static javax.swing.Timer grabTimer
A Timer variable decleration, the grabTimer, who at each clock fires a particular chain of calculations, functions and procedures who are needed for the calculations. Particularly, calls the function step() that in the begging calls the function getFrame(), that grabs the current frame, converts it to buffered image and returns it at the step(), Then the step(), if at least one color is selected, calls the ImageProcessor with paramert the buffered image. When the calculations in ImageProcessor has finished returns back a new buffered image with the results "printed" on it. And from the begging again.


processor

public static javax.media.Processor processor
A Processor variable decleration, the processor, that takes the source from the Data Source that has been connected with the video captured device.


frameImage

public static java.awt.Image frameImage

debugDeviceList

public static boolean debugDeviceList

captureVideoDevice

public static javax.media.CaptureDeviceInfo captureVideoDevice

captureVideoFormat

public static javax.media.format.VideoFormat captureVideoFormat

deviceInfo

public static javax.media.CaptureDeviceInfo deviceInfo

videoDataSource

public static javax.media.protocol.DataSource videoDataSource

ds1

public static javax.media.protocol.DataSource ds1

sinkColorValues

public static SinkColorValues sinkColorValues
The SinkColorValues class decleration, as sinkColorValues.


redSinkData

public static SinkData redSinkData
The SinkData class decleration, as redSinkData for the Red's color data sink.


orangeSinkData

public static SinkData orangeSinkData
The SinkData class decleration, as orangeSinkData for the Orange's color data sink.


brownSinkData

public static SinkData brownSinkData
The SinkData class decleration, as brownSinkData for the Brown's color data sink.


yellowSinkData

public static SinkData yellowSinkData
The SinkData class decleration, as yellowSinkData for the Yellow's color data sink.


greenSinkData

public static SinkData greenSinkData
The SinkData class decleration, as greenSinkData for the Green's color data sink.


cyanSinkData

public static SinkData cyanSinkData
The SinkData class decleration, as cyanSinkData for the Cyan's color data sink.


blueSinkData

public static SinkData blueSinkData
The SinkData class decleration, as blueSinkData for the Blue's color data sink.


magentaSinkData

public static SinkData magentaSinkData
The SinkData class decleration, as magenteSinkData for the Magenta's color data sink.


pinkSinkData

public static SinkData pinkSinkData
The SinkData class decleration, as pinkSinkData for the Pink's color data sink.


whiteSinkData

public static SinkData whiteSinkData
The SinkData class decleration, as whiteSinkData for the White's color data sink.


blackSinkData

public static SinkData blackSinkData
The SinkData class decleration, as blackSinkData for the Black's color data sink.


graySinkData

public static SinkData graySinkData
The SinkData class decleration, as graySinkData for the Gray's color data sink.

Constructor Detail

VideoStreamController

public VideoStreamController()
Creates a new empty instance of the VideoStreamController.

See Also:
ColoredShapesTracker

VideoStreamController

public VideoStreamController(java.lang.String name,
                             java.lang.String videoFormat)
Creates a new instance of the VideoStreamController, that takes as parameters the video capture's device name and the selected video format to create the connection with the camera, sets the format and calls the myTimer() function to start the chain for the particular processes.

Parameters:
name - the Captute device's name
videoFormat - the selected video format
See Also:
DeviceFormat.formatToString(javax.media.Format), DeviceFormat.setFormat(javax.media.protocol.DataSource, javax.media.Format), myTimer()
Method Detail

getFrame

public java.awt.Image getFrame()
The function getFrame, that grabs the current frame, converts it to buffered image and returns it at the step().

See Also:
step()

step

public void step()
The step function that is called from the myTimer() function, that in the begging calls the function getFrame(), that grabs the current frame, converts it to buffered image and returns it at the step, then, if at least one color is selected, calls the ImageProcessor with paramert the buffered image. When the calculations in ImageProcessor has finished gets back a new buffered image with the results "printed" on it. And from the begging again. For protection checks if one color is at the procedure of recording but has been disabled, to stop the recording.

See Also:
myTimer(), getFrame()

myTimer

public void myTimer()
The function myTimer that starts and repeats the particular processing chain.

See Also:
VideoStreamController, step()

paint

public void paint(java.awt.Graphics g)
the Paint function for optical represantation of calculation.

Overrides:
paint in class javax.swing.JComponent