Capturing Video from Youtube or Webcams

Hello all.

So I successfully completed a project for my Masters where I used IP capture and motion tracking to trigger MIDI and turn a city into a soundscape. I've now been asked to exhibit this as part of Brighton Fringe festival and would like to use a Brighton based live feed instead of a city in America.

Does anyone know how to stream from either of these two sources please?

1st choice of webcam: http://www.skylinewebcams.com/webcam/united-kingdom/england/brighton/brighton.html

2nd choice of webcam:

Code inside this thread: https://forum.processing.org/two/discussion/25897/night-code

Thank you all kindly! This forum really helped my project come together :)

Answers

  • edited May 17
    import gab.opencv.*;
    import processing.video.*;
    import ipcapture.*;
    import org.opencv.core.Rect;
    import themidibus.*; //Import the library
    
    
    OpenCV opencv;
    IPCapture cam;
    MidiBus midi; 
    
    int lastMillis;
    
    int [][] timestamps = new int [16][128];
    
    
    void setup() {
      size(800, 450);
      for (int ch = 0; ch < 16; ch++) {
        for (int i = 0; i < 128; i++) {
          timestamps[ch][i] = -1;
        }
      }
    
      cam = new IPCapture(this, "http://" + "65.152.238.150:80/mjpg/video.mjpg?resolution=800x450", "", "");
      cam.start();
      opencv = new OpenCV(this, 800, 450);
    
      opencv.startBackgroundSubtraction(5, 3, 0.5);
      MidiBus.list();
      midi = new MidiBus(this, -1, "Bus 1");
    }
    
    void sendNote(int ch, int n) {
      if (timestamps[ch][n] == -1) {
        midi.sendNoteOn(ch, n, 100);
        timestamps[ch][n] = millis();
      }
    }
    
    void draw() {
    
      //check for overdue notes
      for (int ch = 0; ch < 16; ch++) {
        for (int i = 0; i < 128; i++) {
          if (timestamps[ch][i]  > -1) {
            if (millis()>timestamps[ch][i] +400) {
              midi.sendNoteOff(ch, i, 100);
              timestamps[ch][i] = -1;
            }
          }
        }
      }
    
      if (cam.isAvailable()) {
        cam.read();
        image(cam, 0, 0);  
        opencv.loadImage(cam);
        opencv.updateBackground();
    
        opencv.dilate();
        opencv.erode();
    
    
    
        noFill();
        stroke(0, 0);
    
        strokeWeight(1);
    
        int rx = 580; 
        int ry = 15;
        int rw = 80;
        int rh = 70;
        rect(rx, ry, rw, rh);
    
        int rx2 = 40; 
        int ry2 = 140;
        int rw2 = 70;
        int rh2 = 120;
        rect(rx2, ry2, rw2, rh2);
    
    
        int rx3 = 500; 
        int ry3 = 190;
        int rw3 = 80;
        int rh3 = 40;
        rect(rx3, ry3, rw3, rh3);
    
    
        int rx4 = 200; 
        int ry4 = 50;
        int rw4 = 75;
        int rh4 = 150;
        rect(rx4, ry4, rw4, rh4);
    
        int rx401 = 275; 
        int ry401= 50;
        int rw401 = 75;
        int rh401 = 150;
        rect(rx401, ry401, rw401, rh401);
    
    
        int rx5 = 50; 
        int ry5 = 280;
        int rw5 = 80;
        int rh5 = 80;
        rect(rx5, ry5, rw5, rh5);
    
        int rx501 = 50; 
        int ry501 = 280;
        int rw501 = 80;
        int rh501 = 80;
        rect(rx501, ry501, rw501, rh501);
    
        int rx6 = 490; 
        int ry6 = 300;
        int rw6 = 100;
        int rh6 = 40;
        rect(rx6, ry6, rw6, rh6);
    
        int rx7 = 310; 
        int ry7 = 300;
        int rw7 = 100;
        int rh7 = 140;
        rect(rx7, ry7, rw7, rh7);
    
    
        int rx8 = 50; 
        int ry8 = 380;
        int rw8 = 90;
        int rh8 = 70;
        rect(rx8, ry8, rw8, rh8);
    
    
        int rx9 = 600; 
        int ry9 = 240;
        int rw9 = 25;
        int rh9 = 20;
        rect(rx9, ry9, rw9, rh9);
    
        int rx901 = 600; 
        int ry901 = 240;
        int rw901 = 25;
        int rh901 = 20;
        rect(rx901, ry901, rw901, rh901);
    
    
        int rx10 = 700; 
        int ry10 = 250;
        int rw10 = 35;
        int rh10 = 15;
        rect(rx10, ry10, rw10, rh10);
    
        int rx101 = 700; 
        int ry101 = 250;
        int rw101 = 90;
        int rh101 = 35;
        rect(rx101, ry101, rw101, rh101);
    
    
        int rx11 = 675; 
        int ry11 = 300;
        int rw11 = 55;
        int rh11 = 50;
        rect(rx11, ry11, rw11, rh11);
    
    
        int rx12 = 500; 
        int ry12 = 40;
        int rw12 = 45;
        int rh12 = 80;
        rect(rx12, ry12, rw12, rh12);
    
        int rx13 = 450; 
        int ry13 = 190;
        int rw13 = 45;
        int rh13 = 15;
        rect(rx13, ry13, rw13, rh13);
    
        int rx14 = 390; 
        int ry14 = 85;
        int rw14 = 45;
        int rh14 = 15;
        rect(rx14, ry14, rw14, rh14);
    
    
        int rx141 = 390; 
        int ry141 = 85;
        int rw141 = 45;
        int rh141 = 15;
        rect(rx141, ry141, rw141, rh141);
    
    
        int rx15 = 390; 
        int ry15 = 150;
        int rw15 = 45;
        int rh15 = 45;
        rect(rx15, ry15, rw15, rh15);
    
    
        int rx16 = 700; 
        int ry16 = 100;
        int rw16 = 100;
        int rh16 = 100;
        rect(rx16, ry16, rw16, rh16);
    
    
        int rx17 = 500; 
        int ry17 = 250;
        int rw17 = 100;
        int rh17 = 40;
        rect(rx17, ry17, rw17, rh17);
    
    
        int rx18 = 525; 
        int ry18 = 350;
        int rw18 = 20;
        int rh18 = 20;
        rect(rx18, ry18, rw18, rh18);
    
    
        int rx181 = 545; 
        int ry181 = 370;
        int rw181 = 20;
        int rh181 = 20;
        rect(rx181, ry181, rw181, rh181);
    
        stroke(255, 1, 1);
        strokeWeight(1);
        for (Contour contour : opencv.findContours()) {
    
    
          println(contour.getBoundingBox().x);
          println(contour.getBoundingBox().y);
          int x = contour.getBoundingBox().x;
          int y = contour.getBoundingBox().y;
    
          contour.draw();
    
    
    
          if (( x > rx && x < rx + rw) && (y > ry && y < ry + rh)) {
            sendNote(0, 60);
          }
    
          if (( x > rx2 && x < rx2 + rw2) && (y > ry2 && y < ry2 + rh2)) {
            sendNote(0, 61);
          }
    
          if (( x > rx3 && x < rx3 + rw3) && (y > ry3 && y < ry3 + rh3)) {
            sendNote(0, 62);
          }
    
          if (( x > rx4 && x < rx4 + rw4) && (y > ry4 && y < ry4 + rh4)) {
            sendNote(1, 60);
          }
    
          if (( x > rx401 && x < rx401 + rw401) && (y > ry401 && y < ry401 + rh401)) {
            sendNote(1, 51);
          }
    
    
          if (( x > rx5 && x < rx5 + rw5) && (y > ry5 && y < ry5 + rh5)) {
            sendNote(1, 61);
          }
    
          if (( x > rx501 && x < rx501 + rw501) && (y > ry501 && y < ry501 + rh501)) {
            sendNote(0, 51);
          }
    
          if (( x > rx6 && x < rx6 + rw6) && (y > ry6 && y < ry6 + rh6)) {
            sendNote(1, 62);
          }
    
          if (( x > rx7 && x < rx7 + rw7) && (y > ry7 && y < ry7 + rh7)) {
            sendNote(1, 63);
          }
    
          if (( x > rx8 && x < rx8 + rw8) && (y > ry8 && y < ry8 + rh8)) {
            sendNote(1, 64);
          }
    
          if (( x > rx9 && x < rx9 + rw9) && (y > ry9 && y < ry9 + rh9)) {
            sendNote(1, 52);
          }
    
                if (( x > rx901 && x < rx901 + rw901) && (y > ry901 && y < ry901 + rh901)) {
            sendNote(1, 65);
          }
    
          if (( x > rx10 && x < rx10 + rw10) && (y > ry10 && y < ry10 + rh10)) {
            sendNote(1, 66);
          }
    
          if (( x > rx101 && x < rx101 + rw101) && (y > ry101 && y < ry101 + rh101)) {
            sendNote(1, 53);
          }
    
    
          if (( x > rx11 && x < rx11 + rw11) && (y > ry11 && y < ry11 + rh11)) {
            sendNote(1, 67);
          }
    
          if (( x > rx12 && x < rx12 + rw12) && (y > ry12 && y < ry12 + rh12)) {
            sendNote(1, 68);
          }
    
          if (( x > rx13 && x < rx13 + rw13) && (y > ry13 && y < ry13 + rh13)) {
            sendNote(1, 69);
          }
    
          if (( x > rx14 && x < rx14 + rw14) && (y > ry14 && y < ry14 + rh14)) {
            sendNote(1, 70);
          }
    
          if (( x > rx141 && x < rx141 + rw141) && (y > ry141 && y < ry141 + rh141)) {
            sendNote(1, 54);
          }
    
          if (( x > rx15 && x < rx15 + rw15) && (y > ry15 && y < ry15 + rh15)) {
            sendNote(0, 71);
          }
    
          if (( x > rx16 && x < rx16 + rw16) && (y > ry16 && y < ry16 + rh16)) {
            sendNote(1, 55);
          }
    
          if (( x > rx17 && x < rx17 + rw17) && (y > ry17 && y < ry17 + rh17)) {
            sendNote(0, 72);
          }
    
          if (( x > rx18 && x < rx18 + rw18) && (y > ry18 && y < ry18 + rh18)) {
            sendNote(1, 72);
          }
    
                if (( x > rx181 && x < rx181 + rw181) && (y > ry181 && y < ry181 + rh181)) {
            sendNote(1, 73);
          }
    
        }
      }
    }
    
  • Not answered but says answered for some reason?

  • Answer ✓

    it has been answered. you answered it by posting a reply.

    note that this is different from answered with a tick.

    also note that nobody takes any notice of either of these things.

  • edited May 17

    I think you are asking for the IP address of those specific cameras...? (which are, I believe, secret, or at least kept secret by that company and its interface).

    Or are you asking for IP ranges associated with Brighton that you could use to filter down lists of public IP feeds?

    Alternately, you might consider contacting the YouTube video stream posters through their account or through public pages referencing their project and see if they will provide you with the direct IP.

  • There's an m3u8 URL associated with the first feed and that'll play if you paste it into vlc, but i doubt ipcapture will handle it. The second feed is YouTube and will be rtmp or whatever and again incompatible with ipcapture. You're going to have to rethink your code. Or find a compatible feed, which might be easier.

    (You've also not applied any of the tidying suggested in the previous thread so there's 200 lines of flab in there)

  • Yes, I understand I may have to use something different to ipcapture. Sorry, that's what I meant to ask, if there is an alternative to ipcapture that would work to get either of those two streams working.

    And yes koogs, I do need to tidy up the code. We went straight into a new maxmsp project for my masters and haven't had a chance to sort it out so it's nice and clean

  • And thank you for letting me know the whole deal on the answered biz. Apologies, I'm still quite a noob round these parts!

  • That should work with the Processing Video library - the new beta, anyway. Use the link as the filename in Movie. However, it looks like someone in their "wisdom" has decided to restrict the supported URI protocols to http only, so if it's anything else you might be out of luck! :-S

  • Hmm, I've tried this @neilcsmith_net but keep getting the error The constructor "Movie(sketch320, Strong, Strong, String)" does not exist. I'm probs missing something really basic but cannot see it!

    import processing.video.*;
    Movie myMovie;
    
    
    import gab.opencv.*;
    import processing.video.*;
    import org.opencv.core.Rect;
    import themidibus.*; //Import the library
    
    
    OpenCV opencv;
    MidiBus midi; 
    
    int lastMillis;
    
    int [][] timestamps = new int [16][128];
    
    
    void setup() {
      size(800, 450);
      for (int ch = 0; ch < 16; ch++) {
        for (int i = 0; i < 128; i++) {
          timestamps[ch][i] = -1;
    
      }
      }
    
      myMovie = new Movie(this, "http://www.skylinewebcams.com/webcam/united-kingdom/england/brighton/brighton.html?resolution=800x450", "", "");
      myMovie.start();
      opencv = new OpenCV(this, 800, 450);
    
      opencv.startBackgroundSubtraction(5, 3, 0.5);
      MidiBus.list();
      midi = new MidiBus(this, -1, "Bus 1");
    }
    
    void sendNote(int ch, int n) {
      if (timestamps[ch][n] == -1) {
        midi.sendNoteOn(ch, n, 100);
        timestamps[ch][n] = millis();
      }
    }
    
    void draw() {
    
      //check for overdue notes
      for (int ch = 0; ch < 16; ch++) {
        for (int i = 0; i < 128; i++) {
          if (timestamps[ch][i]  > -1) {
            if (millis()>timestamps[ch][i] +400) {
              midi.sendNoteOff(ch, i, 100);
              timestamps[ch][i] = -1;
            }
          }
        }
      }
    
      if (cam.isAvailable()) {
        cam.read();
        image(cam, 0, 0);  
        opencv.loadImage(cam);
        opencv.updateBackground();
    
        opencv.dilate();
        opencv.erode();
    
    //LINE COLOUR
    
        noFill();
        stroke(0, 0);
    
        strokeWeight(1);
    
        int rx = 580; 
        int ry = 15;
        int rw = 80;
        int rh = 70;
        rect(rx, ry, rw, rh);
    
        int rx2 = 40; 
        int ry2 = 140;
        int rw2 = 70;
        int rh2 = 120;
        rect(rx2, ry2, rw2, rh2);
    
    
        int rx3 = 500; 
        int ry3 = 190;
        int rw3 = 80;
        int rh3 = 40;
        rect(rx3, ry3, rw3, rh3);
    
    
        int rx4 = 200; 
        int ry4 = 50;
        int rw4 = 75;
        int rh4 = 150;
        rect(rx4, ry4, rw4, rh4);
    
        int rx401 = 275; 
        int ry401= 50;
        int rw401 = 75;
        int rh401 = 150;
        rect(rx401, ry401, rw401, rh401);
    
    
        int rx5 = 50; 
        int ry5 = 280;
        int rw5 = 80;
        int rh5 = 80;
        rect(rx5, ry5, rw5, rh5);
    
        int rx501 = 50; 
        int ry501 = 280;
        int rw501 = 80;
        int rh501 = 80;
        rect(rx501, ry501, rw501, rh501);
    
        int rx6 = 490; 
        int ry6 = 300;
        int rw6 = 100;
        int rh6 = 40;
        rect(rx6, ry6, rw6, rh6);
    
        int rx7 = 310; 
        int ry7 = 300;
        int rw7 = 100;
        int rh7 = 140;
        rect(rx7, ry7, rw7, rh7);
    
    
        int rx8 = 50; 
        int ry8 = 380;
        int rw8 = 90;
        int rh8 = 70;
        rect(rx8, ry8, rw8, rh8);
    
    
        int rx9 = 600; 
        int ry9 = 240;
        int rw9 = 25;
        int rh9 = 20;
        rect(rx9, ry9, rw9, rh9);
    
        int rx901 = 600; 
        int ry901 = 240;
        int rw901 = 25;
        int rh901 = 20;
        rect(rx901, ry901, rw901, rh901);
    
    
        int rx10 = 700; 
        int ry10 = 250;
        int rw10 = 35;
        int rh10 = 15;
        rect(rx10, ry10, rw10, rh10);
    
        int rx101 = 700; 
        int ry101 = 250;
        int rw101 = 90;
        int rh101 = 35;
        rect(rx101, ry101, rw101, rh101);
    
    
        int rx11 = 675; 
        int ry11 = 300;
        int rw11 = 55;
        int rh11 = 50;
        rect(rx11, ry11, rw11, rh11);
    
    
        int rx12 = 500; 
        int ry12 = 40;
        int rw12 = 45;
        int rh12 = 80;
        rect(rx12, ry12, rw12, rh12);
    
        int rx13 = 450; 
        int ry13 = 190;
        int rw13 = 45;
        int rh13 = 15;
        rect(rx13, ry13, rw13, rh13);
    
        int rx14 = 390; 
        int ry14 = 85;
        int rw14 = 45;
        int rh14 = 15;
        rect(rx14, ry14, rw14, rh14);
    
    
        int rx141 = 390; 
        int ry141 = 85;
        int rw141 = 45;
        int rh141 = 15;
        rect(rx141, ry141, rw141, rh141);
    
    
        int rx15 = 390; 
        int ry15 = 150;
        int rw15 = 45;
        int rh15 = 45;
        rect(rx15, ry15, rw15, rh15);
    
    
        int rx16 = 700; 
        int ry16 = 100;
        int rw16 = 100;
        int rh16 = 100;
        rect(rx16, ry16, rw16, rh16);
    
    
        int rx17 = 500; 
        int ry17 = 250;
        int rw17 = 100;
        int rh17 = 40;
        rect(rx17, ry17, rw17, rh17);
    
    
        int rx18 = 525; 
        int ry18 = 350;
        int rw18 = 20;
        int rh18 = 20;
        rect(rx18, ry18, rw18, rh18);
    
    
        int rx181 = 545; 
        int ry181 = 370;
        int rw181 = 20;
        int rh181 = 20;
        rect(rx181, ry181, rw181, rh181);
    
        stroke(255, 1, 1);
        strokeWeight(1);
        for (Contour contour : opencv.findContours()) {
    
    
          println(contour.getBoundingBox().x);
          println(contour.getBoundingBox().y);
          int x = contour.getBoundingBox().x;
          int y = contour.getBoundingBox().y;
    
          contour.draw();
    
    
    
          if (( x > rx && x < rx + rw) && (y > ry && y < ry + rh)) {
            sendNote(0, 60);
          }
    
          if (( x > rx2 && x < rx2 + rw2) && (y > ry2 && y < ry2 + rh2)) {
            sendNote(0, 61);
          }
    
          if (( x > rx3 && x < rx3 + rw3) && (y > ry3 && y < ry3 + rh3)) {
            sendNote(0, 62);
          }
    
          if (( x > rx4 && x < rx4 + rw4) && (y > ry4 && y < ry4 + rh4)) {
            sendNote(1, 60);
          }
    
          if (( x > rx401 && x < rx401 + rw401) && (y > ry401 && y < ry401 + rh401)) {
            sendNote(1, 51);
          }
    
    
          if (( x > rx5 && x < rx5 + rw5) && (y > ry5 && y < ry5 + rh5)) {
            sendNote(1, 61);
          }
    
          if (( x > rx501 && x < rx501 + rw501) && (y > ry501 && y < ry501 + rh501)) {
            sendNote(0, 51);
          }
    
          if (( x > rx6 && x < rx6 + rw6) && (y > ry6 && y < ry6 + rh6)) {
            sendNote(1, 62);
          }
    
          if (( x > rx7 && x < rx7 + rw7) && (y > ry7 && y < ry7 + rh7)) {
            sendNote(1, 63);
          }
    
          if (( x > rx8 && x < rx8 + rw8) && (y > ry8 && y < ry8 + rh8)) {
            sendNote(1, 64);
          }
    
          if (( x > rx9 && x < rx9 + rw9) && (y > ry9 && y < ry9 + rh9)) {
            sendNote(1, 52);
          }
    
                if (( x > rx901 && x < rx901 + rw901) && (y > ry901 && y < ry901 + rh901)) {
            sendNote(1, 65);
          }
    
          if (( x > rx10 && x < rx10 + rw10) && (y > ry10 && y < ry10 + rh10)) {
            sendNote(1, 66);
          }
    
          if (( x > rx101 && x < rx101 + rw101) && (y > ry101 && y < ry101 + rh101)) {
            sendNote(1, 53);
          }
    
    
          if (( x > rx11 && x < rx11 + rw11) && (y > ry11 && y < ry11 + rh11)) {
            sendNote(1, 67);
          }
    
          if (( x > rx12 && x < rx12 + rw12) && (y > ry12 && y < ry12 + rh12)) {
            sendNote(1, 68);
          }
    
          if (( x > rx13 && x < rx13 + rw13) && (y > ry13 && y < ry13 + rh13)) {
            sendNote(1, 69);
          }
    
          if (( x > rx14 && x < rx14 + rw14) && (y > ry14 && y < ry14 + rh14)) {
            sendNote(1, 70);
          }
    
          if (( x > rx141 && x < rx141 + rw141) && (y > ry141 && y < ry141 + rh141)) {
            sendNote(1, 54);
          }
    
          if (( x > rx15 && x < rx15 + rw15) && (y > ry15 && y < ry15 + rh15)) {
            sendNote(0, 71);
          }
    
          if (( x > rx16 && x < rx16 + rw16) && (y > ry16 && y < ry16 + rh16)) {
            sendNote(1, 55);
          }
    
          if (( x > rx17 && x < rx17 + rw17) && (y > ry17 && y < ry17 + rh17)) {
            sendNote(0, 72);
          }
    
          if (( x > rx18 && x < rx18 + rw18) && (y > ry18 && y < ry18 + rh18)) {
            sendNote(1, 72);
          }
    
                if (( x > rx181 && x < rx181 + rw181) && (y > ry181 && y < ry181 + rh181)) {
            sendNote(1, 73);
          }
    
        }
      }
    }
    
  • The constructor "Movie(sketch320, Strong, Strong, String)" does not exist.

    If you are really getting that error, it implies that you have declared objects of type "Strong", not String.

    If you aren't, your number and type of arguments are still wrong. What arguments should you use to make a new Movie?

  • Bugger, sorry, not strong, string!

  • edited May 21

    I've edited it some more, now I'm getting The function "isAvailable() does not exist. This is really confused because when it was IPcapture, it worked and now I've swapped it to movie, it's getting all kinds of errors!

    import processing.video.*;
    Movie myMovie;
    
    
    import gab.opencv.*;
    import processing.video.*;
    import org.opencv.core.Rect;
    import themidibus.*; //Import the library
    
    
    OpenCV opencv;
    MidiBus midi; 
    
    
    int lastMillis;
    
    int [][] timestamps = new int [16][128];
    
    
    void setup() {
      size(800, 450);
      for (int ch = 0; ch < 16; ch++) {
        for (int i = 0; i < 128; i++) {
          timestamps[ch][i] = -1;
    
      }
      }
    
      myMovie = new Movie(this, "http://" + "www.skylinewebcams.com/webcam/united-kingdom/england/brighton/brighton.html?resolution=800x450");
      myMovie.read();
      opencv = new OpenCV(this, 800, 450);
    
      opencv.startBackgroundSubtraction(5, 3, 0.5);
      MidiBus.list();
      midi = new MidiBus(this, -1, "Bus 1");
    }
    
    void sendNote(int ch, int n) {
      if (timestamps[ch][n] == -1) {
        midi.sendNoteOn(ch, n, 100);
        timestamps[ch][n] = millis();
      }
    }
    
    void draw() {
    
      //check for overdue notes
      for (int ch = 0; ch < 16; ch++) {
        for (int i = 0; i < 128; i++) {
          if (timestamps[ch][i]  > -1) {
            if (millis()>timestamps[ch][i] +400) {
              midi.sendNoteOff(ch, i, 100);
              timestamps[ch][i] = -1;
            }
          }
        }
      }
    
      if (myMovie.isAvailable()) {
        myMovie.read();
        image(myMovie, 0, 0);  
        opencv.loadImage(myMovie);
        opencv.updateBackground();
    
        opencv.dilate();
        opencv.erode();
    
    //LINE COLOUR
    
        noFill();
        stroke(0, 0);
    
        strokeWeight(1);
    
        int rx = 580; 
        int ry = 15;
        int rw = 80;
        int rh = 70;
        rect(rx, ry, rw, rh);
    
        int rx2 = 40; 
        int ry2 = 140;
        int rw2 = 70;
        int rh2 = 120;
        rect(rx2, ry2, rw2, rh2);
    
    
        int rx3 = 500; 
        int ry3 = 190;
        int rw3 = 80;
        int rh3 = 40;
        rect(rx3, ry3, rw3, rh3);
    
    
        int rx4 = 200; 
        int ry4 = 50;
        int rw4 = 75;
        int rh4 = 150;
        rect(rx4, ry4, rw4, rh4);
    
        int rx401 = 275; 
        int ry401= 50;
        int rw401 = 75;
        int rh401 = 150;
        rect(rx401, ry401, rw401, rh401);
    
    
        int rx5 = 50; 
        int ry5 = 280;
        int rw5 = 80;
        int rh5 = 80;
        rect(rx5, ry5, rw5, rh5);
    
        int rx501 = 50; 
        int ry501 = 280;
        int rw501 = 80;
        int rh501 = 80;
        rect(rx501, ry501, rw501, rh501);
    
        int rx6 = 490; 
        int ry6 = 300;
        int rw6 = 100;
        int rh6 = 40;
        rect(rx6, ry6, rw6, rh6);
    
        int rx7 = 310; 
        int ry7 = 300;
        int rw7 = 100;
        int rh7 = 140;
        rect(rx7, ry7, rw7, rh7);
    
    
        int rx8 = 50; 
        int ry8 = 380;
        int rw8 = 90;
        int rh8 = 70;
        rect(rx8, ry8, rw8, rh8);
    
    
        int rx9 = 600; 
        int ry9 = 240;
        int rw9 = 25;
        int rh9 = 20;
        rect(rx9, ry9, rw9, rh9);
    
        int rx901 = 600; 
        int ry901 = 240;
        int rw901 = 25;
        int rh901 = 20;
        rect(rx901, ry901, rw901, rh901);
    
    
        int rx10 = 700; 
        int ry10 = 250;
        int rw10 = 35;
        int rh10 = 15;
        rect(rx10, ry10, rw10, rh10);
    
        int rx101 = 700; 
        int ry101 = 250;
        int rw101 = 90;
        int rh101 = 35;
        rect(rx101, ry101, rw101, rh101);
    
    
        int rx11 = 675; 
        int ry11 = 300;
        int rw11 = 55;
        int rh11 = 50;
        rect(rx11, ry11, rw11, rh11);
    
    
        int rx12 = 500; 
        int ry12 = 40;
        int rw12 = 45;
        int rh12 = 80;
        rect(rx12, ry12, rw12, rh12);
    
        int rx13 = 450; 
        int ry13 = 190;
        int rw13 = 45;
        int rh13 = 15;
        rect(rx13, ry13, rw13, rh13);
    
        int rx14 = 390; 
        int ry14 = 85;
        int rw14 = 45;
        int rh14 = 15;
        rect(rx14, ry14, rw14, rh14);
    
    
        int rx141 = 390; 
        int ry141 = 85;
        int rw141 = 45;
        int rh141 = 15;
        rect(rx141, ry141, rw141, rh141);
    
    
        int rx15 = 390; 
        int ry15 = 150;
        int rw15 = 45;
        int rh15 = 45;
        rect(rx15, ry15, rw15, rh15);
    
    
        int rx16 = 700; 
        int ry16 = 100;
        int rw16 = 100;
        int rh16 = 100;
        rect(rx16, ry16, rw16, rh16);
    
    
        int rx17 = 500; 
        int ry17 = 250;
        int rw17 = 100;
        int rh17 = 40;
        rect(rx17, ry17, rw17, rh17);
    
    
        int rx18 = 525; 
        int ry18 = 350;
        int rw18 = 20;
        int rh18 = 20;
        rect(rx18, ry18, rw18, rh18);
    
    
        int rx181 = 545; 
        int ry181 = 370;
        int rw181 = 20;
        int rh181 = 20;
        rect(rx181, ry181, rw181, rh181);
    
        stroke(255, 1, 1);
        strokeWeight(1);
        for (Contour contour : opencv.findContours()) {
    
    
          println(contour.getBoundingBox().x);
          println(contour.getBoundingBox().y);
          int x = contour.getBoundingBox().x;
          int y = contour.getBoundingBox().y;
    
          contour.draw();
    
    
    
          if (( x > rx && x < rx + rw) && (y > ry && y < ry + rh)) {
            sendNote(0, 60);
          }
    
          if (( x > rx2 && x < rx2 + rw2) && (y > ry2 && y < ry2 + rh2)) {
            sendNote(0, 61);
          }
    
          if (( x > rx3 && x < rx3 + rw3) && (y > ry3 && y < ry3 + rh3)) {
            sendNote(0, 62);
          }
    
          if (( x > rx4 && x < rx4 + rw4) && (y > ry4 && y < ry4 + rh4)) {
            sendNote(1, 60);
          }
    
          if (( x > rx401 && x < rx401 + rw401) && (y > ry401 && y < ry401 + rh401)) {
            sendNote(1, 51);
          }
    
    
          if (( x > rx5 && x < rx5 + rw5) && (y > ry5 && y < ry5 + rh5)) {
            sendNote(1, 61);
          }
    
          if (( x > rx501 && x < rx501 + rw501) && (y > ry501 && y < ry501 + rh501)) {
            sendNote(0, 51);
          }
    
          if (( x > rx6 && x < rx6 + rw6) && (y > ry6 && y < ry6 + rh6)) {
            sendNote(1, 62);
          }
    
          if (( x > rx7 && x < rx7 + rw7) && (y > ry7 && y < ry7 + rh7)) {
            sendNote(1, 63);
          }
    
          if (( x > rx8 && x < rx8 + rw8) && (y > ry8 && y < ry8 + rh8)) {
            sendNote(1, 64);
          }
    
          if (( x > rx9 && x < rx9 + rw9) && (y > ry9 && y < ry9 + rh9)) {
            sendNote(1, 52);
          }
    
                if (( x > rx901 && x < rx901 + rw901) && (y > ry901 && y < ry901 + rh901)) {
            sendNote(1, 65);
          }
    
          if (( x > rx10 && x < rx10 + rw10) && (y > ry10 && y < ry10 + rh10)) {
            sendNote(1, 66);
          }
    
          if (( x > rx101 && x < rx101 + rw101) && (y > ry101 && y < ry101 + rh101)) {
            sendNote(1, 53);
          }
    
    
          if (( x > rx11 && x < rx11 + rw11) && (y > ry11 && y < ry11 + rh11)) {
            sendNote(1, 67);
          }
    
          if (( x > rx12 && x < rx12 + rw12) && (y > ry12 && y < ry12 + rh12)) {
            sendNote(1, 68);
          }
    
          if (( x > rx13 && x < rx13 + rw13) && (y > ry13 && y < ry13 + rh13)) {
            sendNote(1, 69);
          }
    
          if (( x > rx14 && x < rx14 + rw14) && (y > ry14 && y < ry14 + rh14)) {
            sendNote(1, 70);
          }
    
          if (( x > rx141 && x < rx141 + rw141) && (y > ry141 && y < ry141 + rh141)) {
            sendNote(1, 54);
          }
    
          if (( x > rx15 && x < rx15 + rw15) && (y > ry15 && y < ry15 + rh15)) {
            sendNote(0, 71);
          }
    
          if (( x > rx16 && x < rx16 + rw16) && (y > ry16 && y < ry16 + rh16)) {
            sendNote(1, 55);
          }
    
          if (( x > rx17 && x < rx17 + rw17) && (y > ry17 && y < ry17 + rh17)) {
            sendNote(0, 72);
          }
    
          if (( x > rx18 && x < rx18 + rw18) && (y > ry18 && y < ry18 + rh18)) {
            sendNote(1, 72);
          }
    
                if (( x > rx181 && x < rx181 + rw181) && (y > ry181 && y < ry181 + rh181)) {
            sendNote(1, 73);
          }
    
        }
      }
    }
    
  • Well, IPCapture is a totally different library, with different methods.

    And now you are trying to use the Movie object of the video library, which has other methods:

    You said:

    I've edited it some more, now I'm getting The function "isAvailable() does not exist. This is really confused because when it was IPcapture, it worked and now I've swapped it to movie, it's getting all kinds of errors!

    Here is a metaphor:

    I tried to start the microwave, but it won't let me light a burner. This is really confusing, because when I was using an oven, lighting the burner worked. Now that I swapped it to microwave I am getting all kinds of errors!

    Both for cooking (or playing video), but different ways of working, so different controls. You have to use the controls of the new thing you are using -- not some other thing.

Sign In or Register to comment.