So far as I can figure out, opencv isn't able to select the ps3eye as a source device directly. What I was able to get working was this slightly hacky solution based on something I found on the old processing forum:
- import hypermedia.video.*;
- import processing.video.*;
- OpenCV opencv;
- Capture cam;
- int cameraIndex = 2;
- void setup() {
- size( 320, 240 );
- println(Capture.list());
- cam = new Capture(this, width, height, Capture.list()[cameraIndex], 30);
- opencv = new OpenCV( this );
- opencv.allocate(width, height);
- }
- void draw() {
- if (cam.available()) {
- cam.read();
- opencv.copy(cam);
- image( opencv.image(), 0, 0 ); // and display image
- }
- }
It uses Processing's own video library to capture the video frame and then passes that on to opencv. When it launches it'll print a list of cameras and you'll need to change the cameraIndex variable so that it matches the index of the ps3eye on your system.