PlayStation Eye webcam on the Beagleboard

I decided to try the PlayStation Eye (PS3 Eye) webcam on the Beagleboard after reading an article on Create Digital Motion explaining how useful it is for computer vision and augmented reality applications.

The PlayStation Eye webcam is designed to be connected to a Sony PlayStation 3 (PS3) to provide interactive games, however it has a number of features that make it ideal for hacking into computer vision applications:

  • low cost (US$40)
  • good low-light sensitivity
  • adjustable field of view
  • high frame-rate (up to 120fps)
  • 4-element array microphone for voice recognition
  • 3rd party drivers for Windows, Mac and Linux

On Linux, the gspca_ov534 driver used, and luckily this driver is included as a kernel module with the standard Angstrom distribution used on the Beagleboard. One difficulty that I've found is that this driver only works with the USB host port, not the USB OTG port. Unfortunately this means that a revision C2 or higher Beagleboard is required. Hopefully this will change as USB support on the Beagleboard is stabilized - it appears to be a problem with a number of USB devices.

Once the PS3 Eye is connected (either directly or via a powered hub), the appropriate kernel module should load automatically, displaying some status messages:

gspca: probing 1415:2000
ov534: sensor is ov7721
ov534: frame_rate: 30
gspca: probe ok

A video-4-linux device /dev/video0 provides access, however to get images form the camera requires additional software. Initial testing can be done with the vidcat progam included with w3cam. To use this on the Beagleboard:

opkg install w3cam
vidcat -d /dev/video0 -o test.jpg

If all goes well, this should create a jepg image captured form the camera. This is enough to see if the camera is working, however vidcat seems to have problems with colors, and the image will look broken:

To get a proper image with correct colors, it's possible to write a small program in C using the OpenCV library:

#include "opencv/cvaux.h"
#include "opencv/highgui.h"
#include "opencv/cxcore.h"
#include <stdio.h>
 
int main(int argc, char* argv[])
{    
  CvCapture* camera = cvCreateCameraCapture(-1); // Use the default camera
 
  IplImage*     frame = 0;
  IplImage      img;
 
  frame = cvQueryFrame(camera); //need to capture at least one extra frame
  frame = cvQueryFrame(camera);
  if (frame != NULL) {
    printf("got frame\n\r");
        cvSaveImage("webcam.jpg", frame);
  } else {
      printf("Null frame\n\r");
  }
  cvReleaseCapture(&camera);
  return 0;
}

This produces the following image:

User login