colors inverted (sometimes)???
in
Contributed Library Questions
•
2 years ago
Hi,
I was wondering if someone could tell me why in this sketch the colors from my camera are inverted in the program sometimes and other times they are true to the color I am holding in front of the camera? I tried turning the invert filter on and off but it didn't seem to make a difference.
Thanks
I was wondering if someone could tell me why in this sketch the colors from my camera are inverted in the program sometimes and other times they are true to the color I am holding in front of the camera? I tried turning the invert filter on and off but it didn't seem to make a difference.
Thanks
- 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( 1280, 1024 );
// open video stream
opencv = new OpenCV( this );
opencv.capture( 1280, 1024 );
trailsImg = new PImage (1280, 1024);
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, 1280, 1024, 0, 0, 1280, 1024, SCREEN);
image( trailsImg, 0,0 ); // display the result
filter(INVERT);
opencv.copy (trailsImg);
opencv.blur (OpenCV.BLUR, 4 );
opencv.contrast (0);
opencv.brightness (-4);
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();
}
1