Configuring Video Cameras

The Shared Records application is built to interface with USB-based video cameras. This page lists the current support for video cameras and how they are configured.

Video Camera Java Support

The org.sharedrecords.mediaTokenSensor package provides the Java interface to the the camera. This package uses  jniwrapper to create a Java interface to the COM library of the underlying video camera. This interface is IMediaTokenSensor. It implemented by org.sharedrecords.mediaTokenSensor.mediatokensensorcomponentlib.impl.IMediaTokenSensorImpl.

The org.sharedrecords.demo.utils.CameraDevice class is a wrapper around IMediaTokenSensorImpl that also provides the functionality for initializing the camera. The camera is initialized with a series of configuration properties that are read from the org.sharedrecords.demo.properties file. The following properties are supported (shown with their default values):

  • org.sharedrecords.video.framerate = 4 Frequency with which we sample the camera, in frames per second
  • org.sharedrecords.video.cameraName = Logitech Brand name of camera. The MediaTokenSensor class needs this information. It should be the (case-senstive) first word of the name of the camera as it appears in "My Computer"
  • org.sharedrecords.video.capturewidth = 640
  • org.sharedrecords.video.captureheight = 480
  • org.sharedrecords.video.width = 320
  • org.sharedrecords.video.height = 240
  • org.sharedrecords.video.differenceThreshold = .03 Threshold for comparing the previously captured image to the current image to determine if there is enough of a change to raise a "new image" flag.
  • org.sharedrecords.video.stepX = 40
  • org.sharedrecords.video.stepY = 40

The org.sharedrecords.demo.video.VideoPollingRunner class shows how to poll and use the CameraDevice class.

JNI Dependancies

The interoperability of the java class depends on using JNI and there are seperate libraries that are required by for the MediaTokenSensor class to work correctly, these are all located in the \bin sub-directory when you have checked out the trunk from svn:

(as of the time of this writing, the version numbers are including in paranthesis after the library).

  • \bin\jniwrap.dll (2.8.0.0)
  • \bin\jniwrap.lic (the license file required by jniwrap at runtime)
  • \bin\MediaTokenSensorComponent.dll (1.2.0.0)
  • \bin\MediaTokenSensorFilter.ax (1.1.0.0)

Driver and Hardware Configuration

The following camera and driver combinations are known to work correctly with the Shared Records application:

  • Logitech QuickCam Deluxe for Notebooks Deluxe running the Driver version 8.4.8, or 8.4.7. This version of the drivers is available  here. Other driver versions for this camera, including new ones, may not work.
  • This is currently the only supported configuration. Entries will be added as they are tested.

Troubleshooting the Newest Logitech Drivers

The following tests have been done in trying to get the new drivers to work:

Running the Demo App with default Configuration - this results in a failure as the size of the image returned is 0 x 0.

Running the Demo App with modified camera name - The camera name in the properties file was changed from "Logitech" to "QuickCam?", "Quick", and "Quickcam" with the same result. A debugging step-through was done to ensure that the name in the properties file was being used to initialize the camera. This results in the same (a 0 x 0 image size).

Running the VideoSensorTest with default Configuration - this results in the same failure.

Running the VideoSensorTest with modified camera name - The same names were tried and the standalone test run. Each time the result was the same. (NOTE: When the name is "QuickCam?" the test takes longer to run, leading us to believe that this is what should be used when whatever is causing the initial problem is resolved)

When the standalone test fails it prints out: "StillImage stats (width, height, bytes): (0 0 0)" to the console and the video window that come up does not have any images.

When the Demo App fails it prints out the following exception stack trace, and the camera window doesn't display any images.

Exception in thread "Thread-6" java.lang.IllegalArgumentException: Width (0) and height (0) must be > 0 at java.awt.image.SampleModel.<init>(Unknown Source) at java.awt.image.ComponentSampleModel .<init>(Unknown Source) at java.awt.image.PixelInterleavedSampleModel.<init>(Unknown Source) at org.sharedrecords.demo.utils.VideoUtils.createInterleavedRGBImage(VideoUtils.java:67) at org.sharedrecords.demo.video.VideoPollingRunner.run (VideoPollingRunner.java:108) at java.lang.Thread.run(Unknown Source)