use PS3 Eye with Processing?

edited November 2014 in How To...

Hello,

I just purchased a PS3 Eye and would like to use it with Processing. I was able to get the camera working, but cannot for the life of me get it to run in Processing. I have downloaded the Code Laboratories CL Eye Driver and SDK but can't get them to work properly in Windows 7, 64 Bit. I get this error, even when setting a direct path to the DLL:

Getting number of cameras (1) Could not find the CLEyeMulticam.dll (2) Could not find the CLEyeMulticam.dll A library relies on native code that's not available. Or only works properly when the sketch is run as a 32-bit application.

Here's the code:

///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// This file is part of CL-EyeMulticam SDK
//
// Java Processing CLEyeProcessingTest Sketch
//
// It allows the use of multiple CL-Eye cameras in your own Java Processing applications
//
// For updates and file downloads go to: http://codelaboratories.com/about/product/eye
//
// Copyright 2008-2012 (c) Code Laboratories, Inc. All rights reserved.
//
// Dependancies: CLEyeMulticam.dll - CL-Eye Platform Multicam API
//               CLEyeMulticam.jar - For processing.org move this into your libraries folder
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Imports
import cl.eye.*;

// Camera Variables
int numCams;
CLCamera myCameras[] = new CLCamera[2];
PImage myImages[] = new PImage[2];
int cameraWidth = 640;
int cameraHeight = 480;
int cameraRate = 30;

// Animation Variables (not required)
boolean animate = true; 
float zoomVal, zoomDelta;
float rotateVal, rotateDelta;

void setup(){
  // Library loading via native interface (JNI)
  // If you see "UnsatisfiedLinkError" then target the library path otherwise leave it commented out.
 CLCamera.loadLibrary("C:/Users/me/Processing/libraries/cleyemulticam/Bin/CLEyeMulticam.dll"); //this is the path, where the DLL is located

  // Verifies the native library loaded
  if(!setupCameras()) exit();
  // Setups animated variables 
  if(animate) setupAnimation();
}

void draw(){ 
  // Loops through available cameras and updates
  for(int i = 0; i < numCams; i++)
  {
    // ---------------------   (image destination, wait timeout)
    myCameras[i].getCameraFrame(myImages[i].pixels, (i==0) ? 1000 : 0);
    myImages[i].updatePixels();
    image(myImages[i], cameraWidth*i, 0);   
  }
  // Updates the animation
  if(animate)updateAnimation();
}

boolean setupCameras(){
  println("Getting number of cameras");
  // Checks available cameras
  numCams = CLCamera.cameraCount();
  println("Found " + numCams + " cameras");
  if(numCams == 0)  return false;
  // create cameras and start capture
  for(int i = 0; i < numCams; i++)
  {
    // Prints Unique Identifier per camera
    println("Camera " + (i+1) + " UUID " + CLCamera.cameraUUID(i));
    // New camera instance per camera
    myCameras[i] = new CLCamera(this);
    // ----------------------(i, CLEYE_GRAYSCALE/COLOR, CLEYE_QVGA/VGA, Framerate)
    myCameras[i].createCamera(i, CLCamera.CLEYE_COLOR_PROCESSED, CLCamera.CLEYE_VGA, cameraRate);
    // Starts camera captures
    myCameras[i].startCamera();
    myImages[i] = createImage(cameraWidth, cameraHeight, RGB); 
  }
  // resize the output window
  size(cameraWidth*numCams, cameraHeight);
  println("Complete Initializing Cameras");  
  return true;
}

void setupAnimation(){
   // General Animation Variables
   zoomVal = 0;
   zoomDelta = TWO_PI/75.0;
   rotateVal = 0;
   rotateDelta = TWO_PI/125.0;
}

void updateAnimation(){
   myCameras[0].setCameraParam(CLCamera.CLEYE_HKEYSTONE, (int)(150 * sin(rotateVal))); 
   myCameras[0].setCameraParam(CLCamera.CLEYE_VKEYSTONE, (int)(200 * cos(rotateVal)));
   //myCameras[0].setCameraParam(Multicam.CLEYE_LENSCORRECTION1, (int)(75 * sin(rotateVal)));
   if(numCams>1)
   {
     myCameras[1].setCameraParam(CLCamera.CLEYE_ZOOM, (int)(200 * sin(zoomVal)));
   }
   rotateVal += rotateDelta;
   zoomVal += zoomDelta;
}

I have tried downloading the 32 Bit processing IDE but get the same error. Is it because I'm on a 64 bit Windows?

Thanks for any help, I've been looking all over and haven't found a solution.

Edit: I have a thought - I can get my internal webcam to work with processing, can I somehow set the Ps3 eye cam as default webcam and see if it works the same there?

Tagged:
Sign In or Register to comment.