Return to CS 4475 website

CS 4475 Project 1

Davis Haden | Sascha Packard | Lucia Greco | Alexandra Unbehagen

This project aimed to combine two weekend trips (one to Morocco and one to Switzerland) into one artistic image. Three images were altered using edge detection and laid on top of each other. The images are the Hassan II Mosque in Morocco, a tile wall from the mosque, and a Swiss flag over a mountain. The tile image was warped. Finally, we put our faces at the bottom of the image for a goofy touch and to show more technical skill, although a slightly more artistic version without the faces is also included.

Our Images

Image 1
Pattern Glitch Art w/ Images
Image 2
Pattern Glitch Art w/ Clipped Faces

Our Methods

Edge Detection Function
Hover over me!
The edge detection function creates a box filter (size 3), applies cv2.Sobel to the image, applies the filter to the image using cv2.filter2D, and modifies the original image based on edges found (if the corresponding edge pixel value is less than 10, the pixel is set to black; otherwise, the pixel value is intensified to show the difference).
Combining Edges Function
Hover over me!
The function for combining edge images takes two images and optional x and y offsets for positioning and then iterates over the pixels of the first image, adjusting each pixel based on the corresponding pixel in the second image. If a pixel in the first image is non-zero, its value is reduced by one-eighth. If a pixel in the second image is non-zero, it replaces the corresponding pixel in the first image.
Warping Function
Hover over me!
The warping function takes in an image and iterate over each row of pixels in the image to warp only specific ones and give a wavy effect. If the pixel value modulus 100 is equal to 0 (every 100 pixels in the up and down direction (row)), then use np.roll to replace the pixel with the rolled pixel. Every pixel was also warped from the original pixel warped plus 0 to 52 (for i in range(0, 52):) This effectively warps 52 pixels above the row of pixels originally warped making the warp thicker.
Faces Function
Hover over me!
The function to add our faces loads in an image of a face and resizes it using the cv2.resize() function so that it is 1/16 of the background image size. It traverses through the face image replacing the bottom left corner of the background image pixel by pixel with the corresponding face image pixel. This is repeated for all 4 face images, making sure to shift the starting point of the face image to the right ΒΌ of the width of the background picture for each face picture. This results in all four pictures fitting on the bottom row of the final image side by side. Then, it traverses through the whole image pixel by pixel until the pixel is close to white and replaces that pixel with the pixel in the same index of the original image.