Seam Carving
1. Def
Problem statement:
Input Image $𝐼_{𝑛×𝑚}$ and new size 𝑛′×𝑚′
Output Image 𝐼′of size 𝑛′×𝑚′which will be “ good representative ” of the original image 𝐼
即:对图像进行缩放的同时希望输出图像对内容有好的展示
2. General Retargeting Framework

- Assume $m \times n \rightarrow m \times n’, n’<n$ (summarization)
- Basic Idea: remove unimportant pixels from the image 移除不重要的像素出去
- Unimportant = pixels with less “energy” 不重要指的是能量较低
- Intuition for gradient based energy:
- Preserve strong contours
- Human vision more sensitive to edges so try remove content from smoother areas
- Simple enough for producing some nice results
3. A Seam
3.1 Def
- A connected path of pixels from top to bottom (or left to right).可以理解为一个像素的八领域像素点4

3.2 Finding the Seam?


3.3 The Optimal Seam
- The recursion relation
- Can be solved efficiently using dynamic programming in $O(s\times n\times m)$
3.4 Dynamic Programming
3.4.1 Recursion
- 𝑀(𝑖,𝑗)= minimal cost of a seam going through (𝑖,𝑗) 先计算整张图的能量,计算的方法为该像素点过去的领域像素中能量的最小值加上自身的能量。


- 最终:

3.4.2 Backtrack
- Backtrack (can store choices along the path, but do not have to)
- 在最后一层找最小的一个能量的像素点
- 然后回溯,找该像素上三领域中能量最小的像素
- 直到遍历到第一行结束。

3.4.3 伪代码

3.5 效果

- Q: Will the result be the same if the image is flipped upside down?
- A: Yes (up to numerical stability)
- Q: What happens to the overall energy in the image during seam carving?
- 变大
- 所以当我们resize图像后,对于整个图像的平均能量应该变大

- 比较:

- 我们可以发现seam的效果最好
3.6 Both Dimensions?
- $m \times n \rightarrow m’ \times n’, n’<n, m’<m$

- The recursion relation:
- Transport map :
- 其物理含义就是,

