video
Class CameraUtils

java.lang.Object
  extended by video.CameraUtils

public class CameraUtils
extends java.lang.Object

Created by IntelliJ IDEA. User: dlyon Date: Apr 13, 2005 Time: 5:10:33 PM Copyright DocJava, 2005


Field Summary
static java.lang.String CAMERA2
           
static java.lang.String CAMERA3
           
static java.lang.String CAMERA4
           
static java.lang.String DEFAULT_FORMAT_ENCODING
          Used for the default VideoFormat.
static float DEFAULT_FORMAT_FRAME_RATE
          Used for the default VideoFormat.
static int DEFAULT_FORMAT_MAX_LENGTH
          Used for the default VideoFormat.
static byte[] DEFAULT_FORMAT_TYPE
          Used for the default VideoFormat.
static java.awt.Dimension DEFAULT_IMAGE_DIMENSION
          Used for the default VideoFormat.
static javax.media.format.VideoFormat DEFAULT_VIDEO_FORMAT
          Used for the default VideoFormat.
static int DISPLAY_ALL_VIDEO
          Mode simply for debugging where the live video is simply displayed in a window.
static int DISPLAY_NOTHING
          Default mode where the images are not displayable *
static int DISPLAY_ON_EVENT
          Mode where the user may press 'i' to display a frame from the image stream *
 
Constructor Summary
CameraUtils()
           
 
Method Summary
static void close(javax.media.Player player)
           
static void displayCameraSource(CameraSource cameraSource)
           
static void findCamera()
           
static javax.media.Format[] getAllSupportedVideoFormats()
          Returns a Format[] of ALL the supported formats of all camera capture devices.
static java.lang.String getDeviceNameFromCombo()
          Returns a user selected camera from a cambo box that shows a list of camera names.
static java.lang.String[] getDeviceNameList()
          Returns a Vector of names of devices that support the video format requested by this object.
static java.lang.String[] getDeviceNameList(javax.media.format.VideoFormat videoFormat)
          Returns a Vector of names of devices that support the video format requested by this object.
static java.awt.image.BufferedImage getImageFromCamera()
           
static java.awt.image.BufferedImage getImageFromCamera(javax.media.Player player)
           
static javax.media.Player getPlayer()
           
static javax.media.Format[] getSupportedVideoFormats(java.lang.String deviceName)
          Returns a Format[] of the supported formats of the camera name passed as a parameter.
static java.lang.String getWebCameraString()
           
static java.net.URL getWebcameraUrl()
           
static java.net.URL getWebCameraUrl()
           
static java.awt.image.BufferedImage getWebCamImage(java.lang.String cameraUrl)
          Uses the web camera defined in the camera variable in camerautils to get an image.
static void listDeviceFormats(java.io.PrintStream ps, java.lang.String deviceID)
          Prints all available capture formats of the given device to a PrintStream
static void listDeviceFormats(java.lang.String deviceID)
          Prints all available capture formats of the given device to the console
static void listDevices()
          Lists all connected capture devices to the console
static void listDevices(java.io.PrintStream ps, boolean showFormats)
          Writes details of all connected capture devices to the given PrintStream and optionally shows available capture formats too
static void main(java.lang.String[] args)
           
static void webCaptureDialog()
           
static void webMosaicCaptureDialog(Main main)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISPLAY_NOTHING

public static final int DISPLAY_NOTHING
Default mode where the images are not displayable *

See Also:
Constant Field Values

DISPLAY_ON_EVENT

public static final int DISPLAY_ON_EVENT
Mode where the user may press 'i' to display a frame from the image stream *

See Also:
Constant Field Values

DISPLAY_ALL_VIDEO

public static final int DISPLAY_ALL_VIDEO
Mode simply for debugging where the live video is simply displayed in a window. processImage() is not called. *

See Also:
Constant Field Values

DEFAULT_IMAGE_DIMENSION

public static final java.awt.Dimension DEFAULT_IMAGE_DIMENSION
Used for the default VideoFormat. Set to (320, 240). *


DEFAULT_FORMAT_ENCODING

public static final java.lang.String DEFAULT_FORMAT_ENCODING
Used for the default VideoFormat. Set to "rgb". *

See Also:
Constant Field Values

DEFAULT_FORMAT_MAX_LENGTH

public static final int DEFAULT_FORMAT_MAX_LENGTH
Used for the default VideoFormat. Set to 230400. *

See Also:
Constant Field Values

DEFAULT_FORMAT_TYPE

public static final byte[] DEFAULT_FORMAT_TYPE
Used for the default VideoFormat. Set to byte[DEFAULT_FORMAT_MAX_LENGTH]. *


DEFAULT_FORMAT_FRAME_RATE

public static final float DEFAULT_FORMAT_FRAME_RATE
Used for the default VideoFormat. Set to 15f. *

See Also:
Constant Field Values

DEFAULT_VIDEO_FORMAT

public static final javax.media.format.VideoFormat DEFAULT_VIDEO_FORMAT
Used for the default VideoFormat. Set to VideoFormat(DEFAULT_FORMAT_ENCODING, DEFAULT_IMAGE_DIMENSION, DEFAULT_FORMAT_MAX_LENGTH, DEFAULT_FORMAT_TYPE.getClass(), DEFAULT_FORMAT_FRAME_RATE). *


CAMERA2

public static final java.lang.String CAMERA2
See Also:
Constant Field Values

CAMERA3

public static final java.lang.String CAMERA3
See Also:
Constant Field Values

CAMERA4

public static final java.lang.String CAMERA4
See Also:
Constant Field Values
Constructor Detail

CameraUtils

public CameraUtils()
Method Detail

getImageFromCamera

public static java.awt.image.BufferedImage getImageFromCamera()
                                                       throws java.io.IOException,
                                                              javax.media.NoPlayerException,
                                                              javax.media.CannotRealizeException,
                                                              java.lang.InterruptedException
Throws:
java.io.IOException
javax.media.NoPlayerException
javax.media.CannotRealizeException
java.lang.InterruptedException

getPlayer

public static javax.media.Player getPlayer()
                                    throws java.io.IOException,
                                           javax.media.NoPlayerException,
                                           javax.media.CannotRealizeException,
                                           java.lang.InterruptedException
Throws:
java.io.IOException
javax.media.NoPlayerException
javax.media.CannotRealizeException
java.lang.InterruptedException

getImageFromCamera

public static java.awt.image.BufferedImage getImageFromCamera(javax.media.Player player)

close

public static void close(javax.media.Player player)

findCamera

public static void findCamera()
                       throws java.io.IOException,
                              javax.media.NoProcessorException
Throws:
java.io.IOException
javax.media.NoProcessorException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        javax.media.NoPlayerException,
                        javax.media.CannotRealizeException,
                        java.lang.InterruptedException
Throws:
java.io.IOException
javax.media.NoPlayerException
javax.media.CannotRealizeException
java.lang.InterruptedException

getDeviceNameList

public static java.lang.String[] getDeviceNameList(javax.media.format.VideoFormat videoFormat)
Returns a Vector of names of devices that support the video format requested by this object. (This procedure assumes that ALL camera devices will have the prefix "vfw:"!!!)

Parameters:
videoFormat - The video format of the devices you would like to request the names of. (This can be used to get the list of video devices that support the same videoFormat that this camera has been set to have by calling getDeviceNameList(camera.getVideoFormat().)

getDeviceNameFromCombo

public static java.lang.String getDeviceNameFromCombo()
Returns a user selected camera from a cambo box that shows a list of camera names.


getAllSupportedVideoFormats

public static javax.media.Format[] getAllSupportedVideoFormats()
Returns a Format[] of ALL the supported formats of all camera capture devices.


getSupportedVideoFormats

public static javax.media.Format[] getSupportedVideoFormats(java.lang.String deviceName)
Returns a Format[] of the supported formats of the camera name passed as a parameter.

Parameters:
deviceName - Name of the camera who's formats you want.

getDeviceNameList

public static java.lang.String[] getDeviceNameList()
Returns a Vector of names of devices that support the video format requested by this object.


listDevices

public static void listDevices()
Lists all connected capture devices to the console


listDevices

public static void listDevices(java.io.PrintStream ps,
                               boolean showFormats)
Writes details of all connected capture devices to the given PrintStream and optionally shows available capture formats too

Parameters:
ps - a valid PrintStream instance
showFormats - true, if format information is required

listDeviceFormats

public static void listDeviceFormats(java.lang.String deviceID)
Prints all available capture formats of the given device to the console

Parameters:
deviceID - descriptor string of device

listDeviceFormats

public static void listDeviceFormats(java.io.PrintStream ps,
                                     java.lang.String deviceID)
Prints all available capture formats of the given device to a PrintStream

Parameters:
ps - a valid PrintStream instance
deviceID - descriptor string of device

webMosaicCaptureDialog

public static void webMosaicCaptureDialog(Main main)

webCaptureDialog

public static void webCaptureDialog()

getWebCameraString

public static java.lang.String getWebCameraString()

getWebcameraUrl

public static java.net.URL getWebcameraUrl()
                                    throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

getWebCameraUrl

public static java.net.URL getWebCameraUrl()

getWebCamImage

public static java.awt.image.BufferedImage getWebCamImage(java.lang.String cameraUrl)
Uses the web camera defined in the camera variable in camerautils to get an image.

Returns:
a 24 bit bufferedImage

displayCameraSource

public static void displayCameraSource(CameraSource cameraSource)