Giter VIP home page Giter VIP logo

seam_carving's Introduction

seam_carving

Seam carving (or liquid rescaling) is an algorithm for content-aware image resizing

Useful examples and explanation: https://en.wikipedia.org/wiki/Seam_carving

Examples

Original Seam Carved to 50% of original size
before after
before after
before after
before after

Usage

seam_carving image.ppm
usage: seam_carving <image>
    image   : a P3 ppm image
    # shrinks image to half
usage: seam_carving <image> <pixels>
    image   : a P3 ppm image
    pixels  : the number of pixels to remove

Implementation Details

The program takes a ppm file (was easy for me to read to memory) and carves away vertical seams from it.

it uses a Image class that is parent to the gradient, the DPtable and the PPM image objects. it uses a thread pool from to calculate the gradients.

PPMimage reads the file and checks for errors in the file. PPMimage then has a method called "delete_columns" that deletes a certain number of columns. delete_colums creates a DPtable of values that represent the cost of the seams that can be removed this dp table is filled by analyzing the gradient Image. the creating of the gradient image is made with a thread pool of promises and futures. then when the ppm objects receive the dp table it decides which seam to remove. then reiterates till all the required seams have been deleted.

Flags For Compilation

g++ -std=c++17 -Wall -pthread -O3

How To Get A Ppm Image

I use convert from ImageMagick

convert <source.extension> -compress none <destionation.ppm>

written by

Nicola Manzini

seam_carving's People

Contributors

nmanzini avatar

Watchers

 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.