We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, what I am trying to do is:
Get 5 colours, each one from a random pixel in webcam video. The problem is I don't want the webcam video to be visible in the sketch window. So essentially the very first thing the sketch will do when run is (but without showing cam.read):
color a = get((int)random(width),(int)random(height));
color b = get((int)random(width),(int)random(height));
color c = get((int)random(width),(int)random(height));
color d = get((int)random(width),(int)random(height));
color e = get((int)random(width),(int)random(height));
So that I can then use the colours as the colour scheme of a sketch.
Thanks!
Answers
cam.read()
doesn't write anything to screen — you have to useimage(cam, x, y)
to actually draw the output. However, it doesn't look like the camera is available to read duringsetup()
, so you have to do it during the first frame. You can use a boolean to ensure it only happens once.