A key feature of our drawing machine is that it draws an image of the user that stands in front of it. To draw that image we need to use a webcam that captures the image and processes it to provide instructions for the machine to draw with.
The starting point of this capturing code is the OpenCV library with the face_detection code, with the example shown below.
Having the face detection working I wanted to capture the entire face of the user, thus enlarging the rectangle shown around the face. And have the result printed full screen in the sketch area. Because the code opens the camera through the OpenCV library it isn’t possible to directly read the pixels and modify them. To get the same result I saved the image object the OpenCV library presented, and then loaded it into the sketch to be modified to what I want. (See image below for development images).
The result is now that, whenever you click, the sketch searches for your face, saves it and displays it full screen. It always centers around the face of the user.
Now the image selection is completed the next step is to do the image processing to create patterns the drawing machine will actually draw. How I process the image, like the example below, will define what and how the machine will draw. Being (contrast) lines, or black spots that form the image.