For the Change a bit project, I developed in Processing the system for detecting the bricks and obtaining the string of bits that they represent; I used the help of the OpenCV library by Greg Borenstein.

I created a program that first lets me select the vertices of the square “working area” (where the bricks will be) from a webcam input, and then analyzes this area to find the bricks. Specifically, the program finds the contours in the area after applying a grayscale conversion and thresholding, and then locates those contours within predefined cells. If a cell contains a brick, that bit will have a “1”, and if it is empty, it will have a “0”.

The video above shows the system working, and below are some screenshots.

The code for the project is in this Github repository.

The next steps include figuring out the real setup (camera, bricks, working area), as well as connecting the graphical output of the installation with the bits that are being obtained with this program.