There are five steps in the implementation:
Step | File | Description |
---|---|---|
1 | energy.py |
Energy calculation |
2 | seam.py |
Finding the lowest-energy seam |
3 | carve.py |
Removing seams from the image |
4 | resize.py |
Resizing an image to given dimensions |
5 | video_stitch.py |
Stitching visualized frames to make a video |
Each step is documented at the top of the exercise file.
-
Ensure you have Python 3 installed. I'm a fan of pyenv, but you can install the latest version of Python in any way you wish.
-
Install the dependencies using
pip
:pip install -r requirements.txt
Run the files in terminal using descriptions at the beginning of each file.
For a one-shot test, run carve using python resize.py andaman.jpg 1300 2000 True
Images are stored inside the images directory, in jpg format.
Outputs such as videos, intermediate and final images are stored in the out directory in mp4 and png format respectively. Videos are titled similarly to the input image, with "_result" suffixed, while images are suffixed with "_intermediate" and "_resized" to indicate the intermediate and final output.
Visualized seams are stored in the visual_out directory. Two subdirectories titled vertical and horizontal contain vertical reductions and horizontal reductions respectively. The frames are titled similarly to the input images with "_x" suffixed where x denotes number of reduction, in png format. These are used to construct the video output at the end, if indicated so while operating resize.py.
All images are free to redistribute. Attribution is not necessary, but encouraged:
-
Seatree - Suprateem Banerjee on Blues Photo Journal
-
Andaman - Suprateem Banerjee from Personal Collection
-
Surfer - Kiril Dobrev on Pixabay