Hi, I'm working on this project for school. Basically, how it works is the sketch is projected onto a blank canvas on one side of the room. The camera is pointing at a white wall on the other side of the room. In the room there are all sorts of colored objects for the user to use such as paint brushes that are spray painted various colors. When they move the colored object in front of the camera it draws the line of their movement in that color onto the canvas as if they were painting. If there is no movement the image slowly fades back to white. Basically it is working, but there are some things I would like to improve. The colors that the sketch draws to the screen are for the most part accurate to the color that is being moved in front of the camera but sometimes they are not...and I'm not sure why??? I would like to improve on this and also if, for example, the user draws a line with a yellow brush, and then a blue brush on top of the yellow line I would like the line to change to green where they overlap (as it would with real paint). So I think I need to blend the image of the movement with the image from the screen? right? Any suggestions would be greatly appreciated. I have more details and pictures of the project here:
http://www.rebeccavickers.com/pages/English/dejuredefacto.html
The code so far:
import processing.opengl.*;
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import hypermedia.video.*;
OpenCV opencv;
PImage trailsImg;
float threshold = 80f;
Minim minim;
AudioPlayer player;
void setup() {
// size(512, 200, P3D);
minim = new Minim(this);
// load a file, give the AudioPlayer buffers that are 2048 samples long
player = minim.loadFile("soudofpaint.mp3", 2048);
// play the file
// player.shiftGain(0, 20, 2000);
player.loop();
size( 800, 600 );
// open video stream
opencv = new OpenCV( this );
opencv.capture( 800, 600 );
trailsImg = new PImage (800, 600);
background(255);
}
void draw() {
opencv.read(); // grab frame from camera
//image( opencv.image(), 0, 0); // show the original image
PImage camImage;
opencv.absDiff();
filter(INVERT);
camImage = opencv.image();
opencv.blur (OpenCV.BLUR, 3 );
// colorMode(HSB);
trailsImg.blend( opencv.image(), 0, 0, 800, 600, 0, 0, 800, 600, SCREEN);
image( trailsImg, 0,0 ); // display the result
filter(INVERT);
opencv.copy (trailsImg);
opencv.blur (OpenCV.BLUR, 4 );
opencv.contrast (0);
opencv.brightness (-2);
trailsImg = opencv.image();
opencv.remember(); // store the actual image in memory
}
void keyPressed() {
}
void stop()
{
// always close Minim audio classes when you are done with them
player.close();
// always stop Minim before exiting
minim.stop();
super.stop();
}
thank you!!!!!
1