Unable to open webcam inputs

Welcome Forums Help Unable to open webcam inputs

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  Rebecca 11 months, 1 week ago.

  • Author
  • #666

    Federico Sparapan

    Hi, I’m trying to take a look at Wekinator by using the webcam input installer, but I’m not able to make them work since they crash every time displaying this error:

    *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSArray0 addObjectsFromArray:]: unrecognized selector sent to instance 0x7fff800e3a70’
    abort() called
    terminating with uncaught exception of type NSException

    I’m running them on a Mac, other inputs such as the mouse one, work fine.

    I’ve tried all of the different inputs, also the heavy one with Java on it, but nothing seems to work.

    Any advice would be helpful, thanks!

  • #667


    Hi Federico, are you on Catalina by any chance? There’s been some changes (not good) to the way that Processing applications interface with the webcam on Catalina. If you’re able to run Processing source code directly, please try out the new version below. I’ll try to make an executable of this to put on the website later today.


     * Temp code. Adapted from mirror by dan shiffman.
    import processing.video.*;
    import oscP5.*;
    import netP5.*;
    // Size of each cell in the grid
    int boxWidth = 64;
    int boxHeight = 48;
    int numHoriz = 640/boxWidth;
    int numVert = 480/boxHeight;
    color[] downPix = new color[numHoriz * numVert];
    // Number of columns and rows in our system
    //int cols, rows;
    // Variable for capture device
    Capture video;
    OscP5 oscP5;
    NetAddress dest;
    void setup() {
      size(640, 480);
      //cols = width / cellSize;
      //rows = height / cellSize;
      colorMode(RGB, 255, 255, 255, 100);
      // This the default video input, see the GettingStartedCapture 
      // example if it creates an error
      String[] cameras = Capture.list();
      video = new Capture(this, width, height, cameras[0]);
      // Start capturing the images from the camera
        oscP5 = new OscP5(this,9000);
      dest = new NetAddress("",6448);
    void draw() { 
      if (video.available()) {
        // Begin loop for columns
        int counter=0;
        for (int i = 0; i < numHoriz; i++) {
          // Begin loop for rows
          for (int j = 0; j < numVert; j++) {
            // Where are we, pixel-wise?
            int x = i*boxWidth;
            int y = j*boxHeight;
           // int loc = (video.width - x - 1) + y*video.width; // Reversing x to mirror the image
           int loc = x + y*video.width;
            float r = red(video.pixels[loc]);
            float g = green(video.pixels[loc]);
            float b = blue(video.pixels[loc]);
            // Make a new color with an alpha component
            color c = color(r, g, b);
            //SEcond mode:
            int tot = boxWidth * boxHeight;
            float rtot = 0;
            float gtot = 0;
            float btot = 0;
            for (int k = 0; k < boxHeight; k++) {
               for (int l = 0; l < boxWidth; l++) {
                   int loc2 = loc + k*width + l;
                   rtot += red(video.pixels[loc2]);
                   gtot += green(video.pixels[loc2]);
                   btot += blue(video.pixels[loc2]);
            color c2 = color((int)(rtot/tot), (int)(gtot/tot), (int)(btot/tot));
            // Code for drawing a single rect
            // Using translate in order for rotation to work properly
           // pushMatrix();
           // translate(x+cellSize/2, y+cellSize/2);
            // Rotation formula based on brightness
            //rotate((2 * PI * brightness(c) / 255.0));
            // Rects are larger than the cell for some overlap
            rect(x+boxWidth/2,y+boxHeight/2, boxWidth, boxHeight);
            downPix[counter++] = c2;
          //  popMatrix();
        if(frameCount % 2 == 0) {
    void sendOsc(int[] px) {
      OscMessage msg = new OscMessage("/wek/inputs");
     // msg.add(px);
       for (int i = 0; i < px.length; i++) {
      oscP5.send(msg, dest);
  • #671

    Federico Sparapan

    Hi Rebecca, many thanks for your answer.

    I’m on Big Sur, that I think inherited the problems from Catalina.

    I tried to run the code but it raises an error as it can’t find the main class. Also substituted the .pde file with that, but the executable still crashes.

  • #672


    Hi Federico,
    I’m not surprised that Big Sur is giving problems, then! Unfortunately I don’t have access to a Big Sur machine so I can’t try things out for myself.
    All I can say at this point is this:
    * Perhaps try out the code at https://www.doc.gold.ac.uk/~mas01rf/WekinatorDownloads/wekinator_examples/all_source_zips/SimpleVideoInputWithProcessing_100Inputs_Catalina.zip (running within either the latest stable version of Processing 3, or if that doesn’t work, running in the alpha version of Processing 4)
    * If that doesn’t work, then looking at the Processing forums for information about using webcams on Big Sur is probably the next step. In particular, I’d recommend using Processing 4.
    * Ultimately, because of the problems introduced by Catalina, you’re probably better off using openFrameworks (or another environment, like Max/MSP + Jitter) if you want to build something that uses realtime webcam input.

    I hope this helps, and please do post an update!


You must be logged in to reply to this topic.