Week 9_assignment

For this assignment, I worked with Tianjun Wang.

We’ve made a sketch that we capture Video from cam and change the rgb color when the mouse is positioned in different position of the canvas. We also add a function of particles which make some particles on the canvas and their colors are determined by the camera.

You can see sketch from below link,

https://editor.p5js.org/bestesaylar/sketches/8SZKY6Hpq

After watching the Brightness Mirror tutorial of Daniel Shiffman, I’ve decided to modify this example into a pixelated motion detection camera, so that if there is any change in any pixel values, fill that particular pixel to red color. I approached this by adding a new variable pbright at the end of the nested for loop, hoping to save the brightness value of each pixel from the previous frame, and compare with the current frame. However, it turned out that the camera have turned the pixels with brightness values into red, and filled the darker pixels with brightness.

Than I’ve learned that it seemed like inside the nested for loop, I was comparing the brightness value of the current pixel with the brightness value of the previous pixel in the array instead of the same pixel of the previous frame. So, instead of comparing individual pixels, I saved all the pixels from the last frame as preFrame and compare the pixels in that array with pixels in current frame to detect pixel change.

You can see sketch from below link,

https://editor.p5js.org/bestesaylar/sketches/WFsPqG-8A