15-463: Computational Photography
Programming Project #2: Seam Carving for Content-Aware Image Resizing

Aaron Lo

Basics:
The basic implementation is pretty straight forward, get the energy function and use dynamic programming scanning down each row, record the minimum accumulative energy as well as the indices. Then remove the seam with the lowest energy. It's just not as intuitive in Matlab as in C. Luckily, I found a very good example and it turn out that if you can make good use of Matlab, the code can be really short and simple. I implemented the vertical seam first and the horizontal is just a simple transpose operation. Generally, this algorithm works best when the target is very obvious and out standing.

Compare energy functions:
I implemented three simple energy functions - gradient, simple Laplacian of Gaussian and entropy. As mentioned in the paper, no single function out perform others in all circumstances. As for the comparison heuristics, I was trying to compare the total energy lost for each energy function but can't quite get the consistent result, so not mentioned here.

Seam Insertion:
Seam insertion is just the reverse operation of carving, so for each seam, instead of removing it, just insert a new seam and color it from the neighbors.

Optimal diagonal resizing:
not yet.

Images:
The images listed below are downloaded from webshot.com and flickr.com

vertical seams that works well:

     
gradient
Laplacian
entropy
  entropy doesn't work well in this example    

   
     

   
     

   
Laplacian works best because it has the best seam distribution so that the horizontal line will look most continuous.

   
     

   
     

   
     


horizontal seams that works well:

gradient Laplacian entropy
   
  Laplacian doesn't work  

   
acceptable for insertion    


vertical seams that doesn't work well:
these example mostly involves complicated scenes

   
     

   
     

 

horizontal seams that doesn't work well:

   
seam insertion for this example image is terrible but maybe applying a mean filter to smooth out the dots on the ground will help

   
just doesn't work for complicated images but insertion is still acceptable