pixels
Pixels are small blocks of color arranged on a screen.
R G B A
Four values determine the color
R — pixels[index+0]=255
G — pixels[index+1]=255
B — pixels[index+2]=255
A — pixels[index+3]=255
The higher the alpha channel value, the brighter it will be
Let index = (x+y*width)*4;
this line calculates the starting index of the pixel at (x, y) in the pixels[ ] array. You can then access the pixel's color channels using pixels[index] (red channel), pixels[index + 1] (green channel), pixels[index + 2] (blue channel), and pixels[index + 3] (alpha channel).
https://editor.p5js.org/yaoooo11/sketches/nLYH742UX
video = createCapture(VIDEO)
Turn on the camera to capture the picture