- OpenCV
- scipy
- numba
- numpy
- mediapie
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.
- Mediapie library used for key point detection
- 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
- The difference in above distance, the number of pixels removed as the seam through an algorithm called seam carving algorithm
To detect essential features of the images to determine by what amount to reduce or increase the width of the given image
An effective method to resize images by removing pixels without cropping images or resulting in loss of information
Many parts of the code are adapted/optimized versions of functionality from other implementations:
- https://github.com/axu2/improved-seam-carving
- https://github.com/vivianhylee/seam-carving
- https://karthikkaranth.me/blog/implementing-seam-carving-with-python/
- Seam carving for content-aware image resizing(2007) link
- Mediapie for key point detection
- A fast Python implementation of Seam Carving for Content-Aware Image Resizing (2007), including the improved energy algorithm described in Improved Seam Carving for Video Retargeting (2008).