Visual color mixing with image blending
in
Core Library Questions
•
1 year ago
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:
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:
- import processing.video.*;
- Capture cam;
- boolean interaction = false; // has there been interaction
- PImage currImage;
- void setup(){
- size(800,600);
- background(0);
- frameRate(24);
- cam = new Capture(this, width, height, 24);
- }
- void draw(){
- background(0);
- if(cam.available()){
- cam.read();
- cam.loadPixels();
- if(currImage == null){
- currImage = cam.get();
- }else if(interaction){
- currImage.blend(cam, 0,0,width, height, 0,0, width, height, EXCLUSION);
- currImage.updatePixels();
- interaction = false;
- println("done");
- }
- }
- if(currImage != null){
- image(currImage, 0,0);
- }
- }
- void keyPressed(){
- go();
- }
- void go(){
- println("going");
- interaction = true;
- }
1