Skip to content

Commit

Permalink
add gifs and images
Browse files Browse the repository at this point in the history
fix main.py, update readmes
  • Loading branch information
armingh2000 committed Dec 15, 2023
1 parent a545639 commit 96ec057
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This project explores the image morphing technique, particularly face image morp

We perform image morphing in the frequency. Specifically, we transform the source and target images to frequency domain using DFT and interpolate them to generate the intermediate images.

<p align="center">
<img src="assets/README/morph_slider.gif" width="50%"/>
</p>


This project consists of two major steps: Image Alignment and Transition Control.

Expand All @@ -15,6 +19,11 @@ The baseline paper on which this work is built: [image morphing in frequency dom

The project introduces an automated approach to align images, significantly enhancing morphing quality. It uses the OpenCV Python module for optimized image processing and facial landmark recognition for feature extraction. Techniques such as rotation to align eyes parallel to the ground and affine transformations to align eyes of source and target images are employed for precise alignment.

<p align="center">
<img src="/assets/README/landmarks.png"
width="70%">
</p>

## Transition Control

Transition control is achieved by using the Discrete Fourier Transform (DFT) for transforming images. The project innovates on transitioning images by interpolating their frequency domain representations. It details the approach of using polar interpolation of magnitude and phase of images, a method superior to linear interpolation in spatial domain.
Expand Down Expand Up @@ -81,7 +90,10 @@ show_images_slider(*morphs, path1=paths[0], path2=paths[1])
python3 src/main.py
```

![](assets/README/morph.gif)
<p align="center">
<img src="/assets/README/morph_seperate.png"
width="50%">
</p>

### Producing metrics
To produce the metrics for both DFT and DCT based morphing.
Expand Down
Binary file added assets/README/landmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/README/morph_seperate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
9 changes: 7 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

# Set paths
paths = random_files(emotion1, emotion2)
paths = [
"/home/subroot/Personal/university/dip/image-morphing/data/front/neutral_front/107_03.jpg",
"/home/subroot/Personal/university/dip/image-morphing/data/front/neutral_front/100_03.jpg",
]

# Load images
img1, img2 = load_image(paths[0]), load_image(paths[1])
Expand Down Expand Up @@ -44,13 +48,14 @@
face1 = resize_image(face1)
face2 = resize_image(face2)

# landmarks1 = detect_landmarks_points(face1)
# landmarks2 = detect_landmarks_points(face2)
# face1 = draw_landmarks(face1, landmarks1)
# face2 = draw_landmarks(face2, landmarks2)
# show_images(face1, face2, path1=paths[0], path2=paths[1])

# Perform morph
morph_type = "dft"
morphs = morph(face1, face2, morph_type=morph_type)
morphs = morph(face1, face2, morph_type=configs.morph_type)

# Combine the faces if both are detected
# show_images(*morphs, path1=paths[0], path2=paths[1])
Expand Down

0 comments on commit 96ec057

Please sign in to comment.