Git Product home page Git Product logo

content-aware-image-resizing's Introduction

Content-Aware-Image-Resizing

Seam Carving Algorithm for content aware image resizing and object removal

Importance/Cost Matrix

two types of cost functions are implemented

  • get_cost_gradient.m computes image gradient as cost
  • get_cost_entropy.m computes cost as per pixel entropy considering 9-by-9 neighbourhood
original image gradient cost
images/broadway_tower/Broadway_tower_edit.jpg images/broadway_tower/Broadway_tower_edit.jpg
images/lake/lake_seamcut.jpg images/lake/cost.jpg

Image Downsizing

  • seam_carving.m does reduction in width using seam carving
  • results below are for gradient cost matrix
original width : 1428 pixels reduced width : 1128 pixels reduced width : 714 pixels reduced width : 476 pixels
images/broadway_tower/Broadway_tower_edit.jpg images/broadway_tower/Broadway_tower_edit.jpg images/broadway_tower/Broadway_tower_edit.jpg images/broadway_tower/Broadway_tower_edit.jpg
  • per pixel entropy generally works better than gradient but it is computationally expensive
original width : 470 pixels gradient cost, reduced width : 235 pixels entropy cost, reduced width : 235 pixels
images/lake/lake_seamcut.jpg images/lake/lake_seamcut_width_half.jpg images/lake/lake_seamcut_width_half_entropy.jpg

Image Upsizing

  • expand.m does increment in width using seam carving
  • if width is to be increased by x pixels, then width is reduced by x pixels first using normal seam carving and the deleted seams are duplicated in original image to get the resultant image with width increased by x pixels
original width : 1428 pixels increased width : 2142 pixels
images/broadway_tower/Broadway_tower_edit.jpg images/broadway_tower/width_plus_700.jpg
original width : 464 pixels increased width : 696 pixels
images/street/street.jpg images/street/street_width_plus_230.jpg
original width : 520 pixels increased width : 2128 pixels
images/wave/wave.jpg images/wave/wave_width_plus_230.jpg

Object Removal

  • object_removal.m resize the image in such a way that specific object in the image is removed smoothly
  • bounding box over the object is given and the cost values of the pixels in the bounding box are made negative infinite to make every seam pass through the object
original object removed
images/broadway_tower/Broadway_tower_edit.jpg images/broadway_tower/Broadway_tower_edit.jpg
original object removed
images/dog/dog.jpg images/dog/remove.jpg

content-aware-image-resizing's People

Contributors

chaitanya100100 avatar starttirth1998 avatar

Watchers

 avatar  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.