import processing.video.*;
Capture cam;
void setup() {
size(362, 480);
cam = new Capture(this, 640, 480);
//cam = new Capture(this, width, height, devices[0]);
//cam.settings();
rectMode(CENTER);
}
size(362, 480);
cam = new Capture(this, 640, 480);
//cam = new Capture(this, width, height, devices[0]);
//cam.settings();
rectMode(CENTER);
}
void draw() {
if (cam.available() == true) {
cam.read();
image(cam, 0, 0);
color c = get(width/2,height/2);
noStroke();
fill(c);
//rect(width/2,height/2,width/2,height/2);
blend(cam, width/2, height/2, 1, 1, width/4, height/4, width*2/4, height*2/4, BLEND );
//set(160, 100, cam);
}
}
/*
BLEND - linear interpolation of colours: C = A*factor + B
ADD - additive blending with white clip: C = min(A*factor + B, 255)
SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)
DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
DIFFERENCE - subtract colors from underlying image.
EXCLUSION - similar to DIFFERENCE, but less extreme.
MULTIPLY - Multiply the colors, result will always be darker.
SCREEN - Opposite multiply, uses inverse values of the colors.
OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens light values.
HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower.
SOFT_LIGHT - Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as harsh.
DODGE - Lightens light tones and increases contrast, ignores darks. Called "Color Dodge" in Illustrator and Photoshop.
BURN - Darker areas are applied, increasing contrast, ignores lights. Called "Color Burn" in Illustrator and Photoshop.
*/
if (cam.available() == true) {
cam.read();
image(cam, 0, 0);
color c = get(width/2,height/2);
noStroke();
fill(c);
//rect(width/2,height/2,width/2,height/2);
blend(cam, width/2, height/2, 1, 1, width/4, height/4, width*2/4, height*2/4, BLEND );
//set(160, 100, cam);
}
}
/*
BLEND - linear interpolation of colours: C = A*factor + B
ADD - additive blending with white clip: C = min(A*factor + B, 255)
SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)
DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
DIFFERENCE - subtract colors from underlying image.
EXCLUSION - similar to DIFFERENCE, but less extreme.
MULTIPLY - Multiply the colors, result will always be darker.
SCREEN - Opposite multiply, uses inverse values of the colors.
OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens light values.
HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower.
SOFT_LIGHT - Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as harsh.
DODGE - Lightens light tones and increases contrast, ignores darks. Called "Color Dodge" in Illustrator and Photoshop.
BURN - Darker areas are applied, increasing contrast, ignores lights. Called "Color Burn" in Illustrator and Photoshop.
*/