Seam carving for content aware image resizing: MATLAB
implementation
By: Danny Luong, http://danluong.com, danluong.83@gmail.com
The Program
If you would like to run this program on your copy of MATLAB, you will need to have the image
processing toolbox.
You are free to modify my code and add new features, etc, and redistribute it as you see fit, but
I would like to hear about it, and be given credit where it is due.
Features and functionality
The program allows the user to resize an image by removing a continuous path of pixels (a
seam) vertically or horizontally from a given image. A seam is defined as a continuous path of
pixels running from the top to the bottom of an image in the case of a vertical seam, while a
horizontal seam is a continuous line of pixels spanning from left to right in an image. An
example of a seam overlaid on an image is shown in Figure 1.
Figure 1: Image with vertical seam
The GUI of the program I completed is included as Figure 2. The main overall functionalities
include (in order from the top to bottom in the GUI) opening an image file, resetting the state
of the program to initial values before the image was resized in any way, the removal of a single
vertical running seam from the image, removal of a single horizontal seam from the image,
input boxes for custom image resizing using repeated seam removals and/or insertions
(maximum image size is 2xCurrentsize-1 in the horizontal and vertical directions), a listbox for
user chosen display of the color RGB image, the gradient image, or the energymap image, and a
checkbox to show the seam removed on one of the three chosen types of image chosen from
the listbox.