Loading...
Logo
Processing Forum
Hey all,
I'm building a small app that mixes the colors of the pixels of 2 pictures to create a new image. The idea is simple, a read pixel overlayed on a blue pixel should return a purple pixel. I have it running and blending using the PImage.blend() method but it doesnt seem to mix the colors that way. I've tried all the blend mode options. Is there a trick I'm missing or should i be looking into a more complex color mixing algorithm for this project? The Images are taken from the camera. on interaction a current frame is taken and blended with a previous saved image.

Heres what i have running so far:

Copy code
  1. import processing.video.*;

  2. Capture cam;
  3. boolean interaction = false; // has there been interaction
  4. PImage currImage;

  5. void setup(){
  6.   size(800,600);
  7.   background(0);
  8.   frameRate(24);
  9.   cam = new Capture(this, width, height, 24);
  10. }

  11. void draw(){
  12.   background(0);
  13.   if(cam.available()){
  14.     cam.read();
  15.     cam.loadPixels();
  16.     if(currImage == null){
  17.       currImage = cam.get();
  18.     }else if(interaction){
  19.       currImage.blend(cam, 0,0,width, height, 0,0, width, height, EXCLUSION);
  20.       currImage.updatePixels();
  21.       interaction = false;
  22.       println("done");
  23.     }
  24.   }
  25.   if(currImage != null){
  26.     image(currImage, 0,0);
  27.   }
  28. }

  29. void keyPressed(){
  30.   go();
  31. }

  32. void go(){
  33.   println("going");
  34.   interaction = true;
  35. }