figure 9: an image with its vertical and horizontal seam index maps V
and h, colored by their index from blue (first seams) to red (last seams).
In this section we demonstrate a number of applications
based on seam carving.
4. 1. aspect ratio change
Assume we want to change the aspect ratio of a given image
I from n × m to n × m′ where m − m′ = c. This can be achieved
simply by successively removing c vertical seams from I.
Contrary to simple scaling, this operation will not alter
important parts of the image (as defined by the energy function), and in effect creates a nonuniform, content-aware
resizing of the image (Figure 7).
The same aspect ratio correction, from n × m to n × m′, can
also be achieved by increasing the number of rows by a factor
of m/m′ (Figure 10). The added value of such an approach is
that it does not remove any information from the image. We
figure 10: aspect ratio change of pictures of the Japanese master
utagawa hiroshige. in both examples the original image is enlarged
by seam insertion.
discuss our strategy for increasing an image size in details in
Section 4. 3.
4. 2. image retargeting
In case the user is interested in changing both the width
and the height of the image, this can be achieved by finding
the optimal sequence of horizontal and vertical seams. User
input can be provided in the form of positive pixel weights
to guide the retargeting process. Figure 4 demonstrates
automatic image retargeting, while Figure 11 shows a user
4. 3. image enlarging
The process of removing vertical and horizontal seams can
be seen as a time-evolution process. We denote I(t) as the
smaller image created after t seam have been removed from
I. To enlarge an image we approximate an “inversion” of
this time evolution and insert new “artificial” seams to the
image. Hence, to enlarge the size of an image I by one we
compute the optimal vertical (horizontal) seam s on I and
duplicate the pixels of s by averaging them with their left and
right neighbors (top and bottom in the horizontal case).
Using the time-evolution notation, we denote the resulting image as I(−
1). Unfortunately, repeating this process will
most likely create a stretching artifact by choosing the same
seam (Figure 12(b)). To achieve effective enlarging, it is
important to balance between the original image content
and the artificially inserted parts. Therefore, to enlarge an
image by k, we find the first k seams for removal, and duplicate them to arrive at I(−k) (Figure 12(c) ). This can be viewed
as the process of traversing back in time to recover pixels
from a larger image that would have been removed by seam
removals (although it is not guaranteed to be the case).
figure 11: Retargeting the Buddha. at the top is the original image, a
cropped version where the ornaments are gone, and a scaled version
where the content is elongated. using simple bottom up feature
detection for automatic retargeting cannot protect the structure of
the face of the Buddha (bottom, left) and this is a challenging image
for face detectors as well. By adding simple user constraints to
protect the face (bottom, middle) or the face and flower (bottom,
right), better results are achieved.