Coder Social home page Coder Social logo

seam-carving's Introduction

Seam-Carving

Seam Carving using C++ and OpenCV

Image retargeting is the process of pasting the content of an image of certain size to a canvas of a different size. Figure 1 illustrates this process: the goal is to take the content of Image 1a) and paste it to a canvas that is shorter along the x axis. Common methods include non-uniform scaling (Figure 1b) or cropping (Figure 1c). However, both have their shortcomings. Non-uniform scaling may distort the proportions of the objects in the scene and cropping might remove important content. A better solution is seam-carving

Here a simple seam carving technique is implemented using dynamic programming and the OpenCV library.

The seam carving algorithm uses horizontal or vertical seams (Figure 2(red)) to iteratively reduce the size of the image. A seam is a pixel thick cut through the image that stretches either from left to right or from up to down (depending on the orientation of the seam). Removing the seam reduces the image by one unit.

The main idea is to find the seams that cut through the non-salient content of the image.

Specifications

The program has 3 arguments: an input image, width of the new target, height of the new target, output image.

Example: ./sc castle.png 300 200 castle2.png

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.