I keep getting the error "Could not load movie file Rune.mov" whenever I try to play my sketch. Does anyone have any idea what might be causing this? The file, Rune.mov, is located in the data folder within the sketch folder. Also I'm using Processing 2.2.1.
Also the code is very much a hodge-podge of a bunch of different codes so I apologize because it's probably a bit difficult to make it. I'm very new to this. To offer a brief explanation, the sketch creates two windows. One window is a webcam feed that searches for certain colors in the feed. If one of the colors is detected in it, a corresponding video will play in the other window.
Also the code is very much a hodge-podge of a bunch of different codes so I apologize because it's probably a bit difficult to make it. I'm very new to this. To offer a brief explanation, the sketch creates two windows. One window is a webcam feed that searches for certain colors in the feed. If one of the colors is detected in it, a corresponding video will play in the other window.
Code:
import java.util.HashMap;
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import javax.swing.*;
SecondApplet s;
import processing.video.*;
Movie Rune1;
Capture video;
// Colors being tracked
color trackColor2 = color (255, 0, 0);
color trackColor3 = color (0, 0, 255);
float worldRecord1 = 500;
float worldRecord2 = 500;
float worldRecord3 = 500;
float worldRecord4 = 500;
float worldRecord5 = 500;
float worldRecord6 = 500;
public void setup() {
Rune1 = new Movie (this, "Rune1.mov");
frameRate (200);
size(1280, 720);
PFrame f = new PFrame(width, height);
frame.setTitle("first window");
f.setTitle("second window");
//Changes WebCam source
video = new Capture(this, "name=Logitech HD Webcam C615,size=1280x720,fps=30");
video.start();
// Start off tracking for red
trackColor2 = color(255,41,3);
smooth();
}
public void draw() {
// Capture and display the video
if (video.available()) {
video.read();
}
video.loadPixels();
image(video,0,0);
// Before we begin searching, the "world record" for closest color is set to a high number that is easy for the first pixel to beat.
float worldRecord0 = 500;
// XY coordinate of closest color
int closestX = 0;
int closestY = 0;
// Begin loop to walk through every pixel
for (int x = 0; x < video.width; x ++ ) {
for (int y = 0; y < video.height; y ++ ) {
int loc = x + y*video.width;
// What is current color
color currentColor = video.pixels[loc];
float r1 = red(currentColor);
float g1 = green(currentColor);
float b1 = blue(currentColor);
float r3 = red(trackColor2);
float g3 = green(trackColor2);
float b3 = blue(trackColor2);
float r4 = red(trackColor3);
float g4 = green(trackColor3);
float b4 = blue(trackColor3);
// Using euclidean distance to compare colors
float d2 = dist(r1,g1,b1,r3,g3,b3); // We are using the dist( ) function to compare the current color with the color we are tracking.
float d3 = dist(r1,g1,b1,r4,g4,b4);
// If current color is more similar to tracked color than
//closest color, save current location and current difference
if (d2 < worldRecord1) {
worldRecord1 = d2;
}
if (d3 < worldRecord2) {
worldRecord2 = d3;
}
}
}
// We only consider the color found if its color distance is less than 10.
// This threshold of 10 is arbitrary and you can adjust this number depending on how accurate you require the tracking to be.
}
public class PFrame extends JFrame {
public PFrame(int width, int height) {
setBounds(100, 100, width, height);
s = new SecondApplet();
add(s);
s.init();
show();
}
}
public class SecondApplet extends PApplet {
int ghostX, ghostY;
public void setup() {
background(0);
noStroke();
}
public void draw() {
background(200);
fill(0);
//the following define what happens if colors are detected
if (worldRecord1 < 50) {
Rune1 = new Movie (this, "Rune1.mov");
Rune1.play();
image(Rune1, mouseX, mouseY);
}
}
public void setGhostCursor(int ghostX, int ghostY) {
this.ghostX = ghostX;
this.ghostY = ghostY;
}
}