Git Product home page Git Product logo

seam-carver's Introduction

Seam Carving Demonstration

An implementation of the content-aware image resizing algorithm presented in the paper Seam carving for content-aware image resizing.

This implementation is designed for my article on real-world applications of dynamic programming (will include link once the article is available). As a result, the priorities are:

  • Easy to understand code. I didn't try to optimize too heavily, and I only implemented vertical seam detection/removal.

  • Ability to create visualizations. This is why I didn't worry about writing to and re-reading from intermediate files. While inefficient, I need to produce intermediate files for the visualizations anyway, so I didn't bother optimizing this process.

Quick start

# Build the software. Make sure you have the C development tools, such as a
# compiler, installed. On Debian-based systems, typically, this can be
# installed via:
#
#   sudo apt install build-essential
make

# Run the retargeting tool to reduce the width of an image by 256 pixels. Usage
# of the tool is detailed below:
mkdir output-directory
./seam-carver input-image.jpg output-directory 256

# Or run the wrapper script that also generates an animation of the resizing
# process. Using this wrapper is also detailed below.
./remove-vertical-seams.sh input-image.jpg 256

Output

USAGE: ./seam-carver <input-image> <output-directory> <number-of-iterations>

The Seam Carver outputs a series of images that are useful for visualizing the resizing process. All the output images are stored inside of the specified output directory, which must already exist. The generated images are:

  • img-energy.jpg - a visualization of the energy functional of the input image.

  • img-seam-<iteration>.jpg - visualizing the lowest energy seam in the result of the previous iteration (or the lowest energy seam in the original image in the case of img-seam-0000.jpg).

  • img.jpg - the final retargeted image after all the iterations have completed.

Wrapper script

USAGE: ./remove-vertical-seams.sh <input-image> <number-of-iterations>

This repo contains a wrapper script, remove-vertical-seams.sh, that eases the use of the Seam Carving tool. The wrapper automatically cleans up the out directory and recreates the directory before running the Seam Carving tool. The wrapper also generates an out/animation-seams.mp4 that animates how the retargeting proceeds from iteration to iteration.

Forward energy variant

The follow-up paper Improved seam carving for video retargeting describes an improvement to the algorithm centered around what is called the "forward energy". This variation is implemented in the forward-energy branch of this repository.

seam-carver's People

Contributors

avik-das avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.