Seam carving algorithm

Seam carving is an algorithm that can be used to resize an image while removing the least important pixels from it.

One possible implementation is to use an edge-detection algorithm first to create an edge-map[1]. This is followed by finding continuous lines that run from top to the bottom, where the only directions of movement allowed are “south”, “south-east” and “south-west”, that minimize the sum of “edge” values. This can be solved using a dynamic programming approach of starting at the bottom and assigning the “minimum-cost-to-bottom” to each cell.

Once this is done, we can find the path throug hthe image with the least cost and remove it.


[1] “Seam Carving | Week 2 | 18.S191 MIT Fall 2020 | Grant Sanderson”


  • Computer Science