How can I remove white pixels from my video capture?

Hey all!

Im pretty new to Processing, so I was wondering if I could get some advice on what to do.

Im running into an issue where I want to make a picture of a drawing, and Processing will remove all the white from the a4 paper sheet. So far Ive managed to make Processing take a picture of the drawing (think bold outlines, clipart, nothing too complex) that I put underneath my webcam, but I cannot find a way to make all the white disappear. I have found some help desks that go into removing tons of colours, but I exclusively want to remove white pixels!

Can someone help me out and give me advice on how I can do this?

My code:

< import processing.video.*;

Capture video;

void setup(){

printArray(Capture.list());

size (1280,960);

video = new Capture(this,1280,960,Capture.list()[1]);
video.start();
}

void mousePressed() {
video.read();
}

void draw() {
background(0);
image(video,0,0);
}

Hi @Lautjelief,

Please format your code by using the </> button in the message editor or use backticks around your code: ``` code ``` → code

Can you give an example capture of your webcam with a sample drawing?

If I understand well, you show a drawing on a white paper to your webcam and you want to remove all the pixels that are on the paper.

You probably noticed that the color of the pixels depends on the lighting environment where your computer is and the quality of the webcam capture so you can’t just say “if a pixel is perfectly white (255 for red, green and blue) then I remove it” because the pixel color will vary a lot between frames and on the sheet paper itself.

If you don’t know how to start, check the tutorials on image manipulation:

and colors: