Skip to content

C++ implementation of the Seam Carving Algorithm using Dynamic Programming. Available to use as a C++ binary

License

Notifications You must be signed in to change notification settings

wthrajat/seamcarving

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seam Carving OpenCV C++ CMake GitHub license

Seam carving (or liquid rescaling) is an algorithm for content-aware image resizing, developed by Mitsubishi Electric Research Laboratories (MERL). It functions by establishing a number of seams (paths of least importance) in an image and automatically removes seams to reduce image size or inserts seams to extend it. Read the paper at:

Dependencies

Make sure to install the following dependencies to avoid build errors:

Build

git clone https://github.com/wthrajat/seamcarving.git
cd seamcarving && mkdir build && cd build && cmake .. && make

After compilation, this will build an executable "seam_carving" at ./build/app/:

./build/app/seam_carving # Executable file

Usage

./build/app/seam_carving <input_image> <direction> <number of seams> <mode> <x> <y> <w> <h>

# OR

./build/app/seam_carving <input_image> <direction> <number of seams>

Arguments

<input_image> : image_name.extension [required]

<direction> : 'h' OR 'v' [required]
    'h' for horizontal seam removal
    'w' for vertical seam removal

<number of seams> : integer [required]

<mode> : 'r' OR 'p' [optional]
    'r' for removal
    'p' for protection

<x> <y> <w> <h> : Specifies the Region of Interest [optional]
    'x' X-coordinate
    'y' Y-coordinatew
    'w' Width of the ROI
    'h' Height of the ROI

Examples

./build/app/seam_carving assets/ronaldo.jpeg v 300
Resized Original
./build/app/seam_carving assets/tower.jpg v 300
Resized Original

Video demo

video

About

C++ implementation of the Seam Carving Algorithm using Dynamic Programming. Available to use as a C++ binary

Topics

Resources

License

Stars

Watchers

Forks