This week I completed the worksheet manipulating pixels and p5.image.
Task 1:
Make a 200×200 canvas completely red with stroke() and point(). Check the code here.
Task 2:
Make every other pixel green of the given image.
Erase a line that is 10 pixels tall across the middle of the image.
Turn a line that is 10 pixels wide down the middle of it blue.
Check the code here.
Task 3:
Make a pixelated 2-tone mirror with createCapture(VIDEO) and 20×20 pixels. Pixels that are > 50% bright are white. Pixels that are < 50% bright are black. Check the code here.
Task 4:
Create an HSB color spectrum. Check the code here.
Debug
Why the image does not completely show on the screen?
The default size of the canvas is 200 by 200 if no other specification, so image can only partly display on the canvas.
After adjusting the size of the canvas, the image does not show on the screen. That was because I put show image function inside preload(), but preload() only aims to preload the image. Thus do not put anything other than loadImage inside.
My thoughts on colors: