Seam Carving, also known as Content Aware Image-Resizing, Image Retargeting, is a technique to "smart" resize the images. The technique basically resizes images based on the content of the image i.e. it preserves the content in order of its importance.This technique was first introduced by Shai Avidan and Ariel Shamir in this paper.
The goal of this project is to implement seam carving and use it to retarget images. In order to do this we need to find optimal seams of low energy and remove it (if we want to reduce image size) or add it (if we want to increase the size) from or to the image.
![]() |
![]() |
The high-level view of algorithm is described below :
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Removing low energy seams from the image inserts new energy. The inserted energy is due to new edges created by previously non adjacent pixels that become neighbors once the seam is removed. This change can be measures by taking gradient between the new neighbours. Using such forward energy we can compare the amount of energy inserted by each seam and reduce it by choosing the seam which inserts the lowest amount of energy. The comparision between backward energy seam carving and forward energy seam carving is shown in the following figures.
![]() |
![]() |
![]() |
Original | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Original | Backward energy | Forward energy |
The images can be enlarged by adding low energy seams into the image. As human eye is sensitive mostly towards edges, it is not able to preceive low energies added to the image. The following example shows the image enlargement using seam insertion.
![]() |
![]() |
![]() |
![]() |
The seam carving algorithm can be used for object removal. In order to remove objects from the image, we make changes to the energy matrix in order to force seams to pass through the object. This can be done by reweighting the area of energy matrix where the object appears.
![]() |
![]() |
![]() |
![]() |
![]() |
Wyeth | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Kandinsky | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Ratatouille | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Monalisa | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Plier | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Snow | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Dali | Backward energy | Forward energy |
![]() |
![]() |
![]() |
Car | Backward energy | Forward energy |
![]() |
![]() |
Boat | Enlarged |
![]() |
![]() |
Kandinsky | Enlarged |
![]() |
![]() |
Monalisa | Enlarged |
![]() |
![]() |
Pamir | Enlarged |
![]() |
![]() |
Car | Enlarged |