|
3. Experimental Results
|
I test the code with both the images in the original paper [1] and images collected by myself.
The experiments include several parts: (1) Vertical seam carving (2) Horizontal seam carving (3) 2D optimal order seam carving (4) Image enlarging (5) Content amplification (6) Object removal
Discussion
(1) The optimal order computation is of very high cost. It may be
accelerated by storing intermediate results (an efficient way is to
store the removed seams), using parallel computation [3] and updating
the energy of pixels affected by the seam instead of computing the
energy of all pixels.
(2) The differences between results of the optimal order seam carving
and manually setted order seam carving are minor. However, the
differences may be large for some images.
(3) The energy function e1 may work poorly in some cases. For example, the smooth region in the object may also be shrinked.
Appendix
User GuideYou can download the test data and simply run .bat files to reproduce my results.
The use of the executable file is as follows.
imageResizeTest mode inImage [maskImage] outImage [width] [height] / [fraction]
mode: -s -- shrink and enlarge an image -a
-- content amplification (you can use a mask image to protect the
content; please scale the image using other softwares before you use
it.) -r -- object removal
(the mask image should be used; if the width and height are not given,
the image will shrink until the object is removed and will not enlarge
to the original size)
The inImage, maskImage and outImage must be image file names with a suffix .jpg, .bmp or .png. Please check the suffix carefully. The green pixels in the mask image are to be removed and the red ones are to be protected.
The fraction is used only for enlarging, to control the enlarged fraction in a step. It should be between 0 and 0.5.
Example:
- Shrinking an image
imageResizeTest -s waterfall.png waterfall_seam.jpg 350 466 - Enlarging an image
imageResizeTest -s edo.png edo_seam.jpg 531 580 imageResizeTest -s Fuji.png Fuji_seam.jpg 729 738 0.2 - Content amplification
Use IrfanView to scale arch_original.png to 110% of the original size imageResizeTest -a arch_110.jpg arch_110_seam.jpg 400 300 - Object removal
imageResizeTest -r Couple.png Couple_mask.png Couple_removal.jpg imageResizeTest -r Beach.png beach_bird_mask.png beach_nobird_removal.jpg 400 300
|
References
[1] Avidan, S. and Shamir, A. Seam carving for
content-aware image resizing. ACM SIGGRAPH, 2007.
[2] Kwatra, V., Schödl, A., Essa, I., Turk, G., and Bobick, A. Graphcut
textures: image and video synthesis using graph cuts. ACM SIGGRAPH, 2003.
[3] Jacob Stultz. Seam Carving: Parallelizing a novel new image resizing algorithm. MIT 6.338/18.337 Final Project Report, 2008.
|
-----------------------------------------------------------------------------------------------------
Copyright
(c) 2009 Wei Zhang
|