Skip to content

Latest commit

 

History

History
78 lines (57 loc) · 2.68 KB

README.md

File metadata and controls

78 lines (57 loc) · 2.68 KB

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