Seam carving [1] is a content-aware image scaling method. The algorithm reduces the image size (width, height, or both) while maintaining the regions of interest. While seam carving is an ideal method for image resizing, it need an good energy map (importance map). Furthermore, images with too many details cause the seam carving to fail to give a good outcome. However, for the vast majority of our applications, in which we are only interested in a few important areas of the image, we still need to utilize seam-carving with an appropriate energy computing method.
In this post, we will go through two energy algorithms, i.e., the center importance method (CI) (computed by summing the difference in the value of a pixel with its surrounding pixels) and Lab saliency (LS) [2].
Seam carving
Formally, for an image, we define a vertical seam to be: where is a mapping . That is, a vertical seam is an 8-connected path of pixels in the image from top to bottom, containing one, and only one, pixel in each row of the image.
As shown in Figure 1, the image is used to compute an energy map , the we find the top - optimal seam lines, where an optimal seam line is
Where is the pixel value at position .
Center importance (CI)
Where is the position, is the energy value at position , is the pixel value at position , , . For each position, its energy depends on how different is its value to its neighbors value. Therefore, only edges and lines are highlighted in the energy map.
Lab saliency (LS)
To produce the saliency map in Figure 3, LS method first apply Gaussian blur on the original image, then convert that blurred image to L color space, let call this converted image . For each channel of , we compute its mean value . The saliency map is computed as:
Results and conclusion
The CI method emphasizes the pixels which have different colors than their neighbors. That means edges and lines that construct object shapes will be highlighted. Therefore, when we only want to reduce a small number of seam lines, CI is stable enough to use. But when re-scaling to a much smaller size, like more than 50% of the original width, the results are guaranteed to be bad, as shown in Figure 4 green area second column .
In theory, the saliency technique is more promising. We can ensure that only insignificant regions are excluded in the seam carving procedure if we can determine the essential object in the image. However, in practice, developing a suitable saliency detection method is difficult; if it succeeds in detecting the right regions, we are good; however, if it fails, the seam carving becomes useless. In our case, we can see that the LS has the tendency to make the pixels at edges have low value, which means they are the first thing seam carving wants to discard. As shown in Figure 4 first row, the right pillar of the tower gets eaten horribly. But in case the saliency detection succeeds, as we can see in Figure 4 second row, the results are impressive.
After comparing the two algorithms qualitatively, we can see that both methods have their own advantages and disadvantages. Therefore, there is no superior one between the two.
References
[1] Avidan, Shai, and Ariel Shamir. Seam carving for content-aware image resizing.In�ACM SIGGRAPH 2007 papers. 2007. 10-es.
[2] Radhakrishna Achanta, Sheila Hemami, Francisco Estrada, and Sabine Susstrunk. Frequency-tuned salient region detection. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pages 1597-1604, 2009