Software
Machine Building
Summary
We developed a drawing robot designed to draw caricatures on a dry erase board. This robot features a robust design and construction phase where a frame was engineered with motor control systems, incorporating carts that slide on rails, and various mounts crafted from aluminum extrusions.
The programming aspect includes software development for actuating stepper motors, translating specific x, y coordinates into motor actions, and custom milling of circuit boards. Complementarily, our Python code manipulates images by altering facial features through "exploding" or "imploding" processes, which adjust the pixels around the feature to exaggerate or compress its appearance for caricature effects. This image manipulation process involves detailed facial landmark detection, feature selection, and a blurring technique to blend the altered regions smoothly into the original image.
Additionally, the end effector of the robot is designed to hold and maneuver a marker and eraser with potential for multi-color functionality, all integrated and tested in conjunction with the mechanical frame to ensure seamless operation, aiming for completion by the designated Sunday to start testing.
Details
We created a drawing robot that writes and erases caricatures.
Programming and Motor Control: The software side entails programming to actuate stepper motors, converting desired x, y coordinates into motor steps, and milling boards needed for the electronics.
Our python code performs image manipulation on a specified face in a photo, focusing on altering specific facial features through a process known as "exploding" or "imploding" them.
1. Configuration: The code starts by configuring which facial features to modify (jawline, left eye, right eye) and setting the intensity of the modification through the explode_factor dictionary. Other features like brows, nose, and mouth are configurable but are disabled in the current settings.
2. Image Scaling: A function is defined to scale images to a consistent size, which is used to resize the input image to a predefined width and height. This standardization is important for consistent feature detection across different images.
3. Face and Landmark Detection: The code uses the dlib library for face detection and landmark prediction. It converts the image to grayscale to simplify the detection process, then identifies facial landmarks (like the corners of eyes or the outline of the jaw) using a trained model.
4. Feature Selection and Manipulation: The code extracts coordinates for the specified features from the detected landmarks. It applies a transformation ("exploding" or "imploding") to each selected feature. This transformation is done by adjusting the pixels around the feature to either expand outwards or compress inwards, which is visually represented by stretching or squeezing the feature. This manipulation is achieved using the wand image library, where each feature region is isolated, modified, and then replaced in the image.
5. Blurring: After altering a feature, the region around it is blurred using a Gaussian blur. This step helps blend the modified feature with the surrounding area, making the alterations appear more natural.
6. Final Assembly: The modified features are then combined back into the original image, replacing the original unmodified regions.
7. Display: Finally, the modified image is displayed to the user, showcasing the changes to the facial features.
The primary goal of this code is to create caricature-like effects on images by exaggerating certain facial features, potentially for artistic or entertainment purposes.
Algorithm Images
Here are some examples of the image manipulation output:
Here you can see the program running: