motion detection (or sound detection) question
in
Core Library Questions
•
1 month ago
Hi,
I'm new in Processing.
In this project I would like to make the myMovie2 ("direita.mov") appear only when there is movement (or sound).
I only put if (mousePressed) {
to check if the code was correct.
What should I do?
I also can't find why my movie is really slow...
Thank you very much for any help!
I'm new in Processing.
In this project I would like to make the myMovie2 ("direita.mov") appear only when there is movement (or sound).
I only put if (mousePressed) {
to check if the code was correct.
What should I do?
I also can't find why my movie is really slow...
Thank you very much for any help!
- import processing.video.*;
- Capture cam;
- Movie myMovie, myMovie2;
- void setup() {
- size(1440, 576);
- myMovie = new Movie(this, "normal.mov");
- myMovie2 = new Movie(this, "direita.mov");
- myMovie.speed(100.0);
- myMovie.loop();
- myMovie2.loop();
- String[] cameras = Capture.list();
- if (cameras.length == 0) {
- println("There are no cameras available for capture.");
- exit();
- } else {
- println("Available cameras:");
- for (int i = 0; i < cameras.length; i++) {
- println(cameras[i]);
- }
- cam = new Capture(this, cameras[0]);
- cam.start();
- }
- }
- void draw() {
- if (myMovie.available()) {
- myMovie.read();
- image(myMovie, 0, 0, 720, 576);
- }
- if (mousePressed) { // what should I put here?
- myMovie2.read();
- image(myMovie2, 0, 0, 720, 576);
- }
- if (cam.available() == true)
- cam.read();
- image(cam, width/2, 0, 720, 576);
- }
1