Skip to content

Latest commit

 

History

History
70 lines (54 loc) · 3.45 KB

README.md

File metadata and controls

70 lines (54 loc) · 3.45 KB

To change the body type of one person to body type of another person given two images

Set-I

Set-II

Workflow

Requirements

  • OpenCV
  • scipy
  • numba
  • numpy
  • mediapie

Usage

pip install -r requirements.txt
python seam_carving.py (-resize) -im1 <IM_PATH> -im2 <IM_PATH> 
                         -out <OUTPUT_IM_NAME> [-dx <DX>] 

Description of parameters:

  • -im1: The path to the image to change.
  • -im2: The path of the target image.
  • -out: The name for the output image.
  • '-dx- : Number of pixels to remove. Positive for adding pixels, negative for subtracting pixels. Optional. If not present number of pixels gets calculated.

Algorithm used:

  1. Mediapie library used for key point detection
  2. Left and right shoulders detected, distances between shoulder measured. Say distance between lt and rt shoulder for person 1 is 15 while for person 2 it is 20. So if 5 pixels are removed from the middle of the person then we get person 2 looking like person 1
  3. The difference in above distance, the number of pixels removed as the seam through an algorithm called seam carving algorithm

Key-point Detection

To detect essential features of the images to determine by what amount to reduce or increase the width of the given image

Seam-carving Algorithm

An effective method to resize images by removing pixels without cropping images or resulting in loss of information

Acknowledgements

Many parts of the code are adapted/optimized versions of functionality from other implementations: