320 likes | 857 Views
Seam Carving. Effective resizing of images should not only use geometric constraints, but consider the image content as well.A seam is a connected path of low energy pixels crossing the image from top to bottom, or from left to right.Seam-carving is a simple image operator that can change the size
E N D
1. Seam Carving for Content-Aware Image Resizing ACM Transactions on Graphics, Volume 26, Number 3, SIGGRAPH 2007
1
2. Seam Carving Effective resizing of images should not only use geometric constraints, but consider the image content as well.
A seam is a connected path of low energy pixels crossing the image from top to bottom, or from left to right.
Seam-carving is a simple image operator that can change the size of an image.
2
3. Image reduction & Image enlarging For image reduction, seam selection ensures that while preserving the image structure, we remove more of the low energy pixels and fewer of the high energy ones.
For image enlarging, the order of seam insertion ensures a balance between the original image content and the artificially inserted pixels.
3
4. Image reduction Results of 5 different strategies for reducing the width of an image.
(b)?????????
(c)?????????
(d)Seam removal
(e)???????????
(f)??????,????
4
5. The Operator Energy function:
(gradient)
let I be an nm image and define a vertical seam to be:
horizontal seam is:
Optimal seam s* that minimizes this seam cost :
5
6. Energy Preservation Measure 6 Randomly removing pixels should keep the average unchanged, but content-aware resizing should raise the average as it removes low energy pixels and keeps the high energy ones.
7. Image Energy Function(1/2)
Taking the maximum of the
HoG at the denominator
attracts the seams to edges
in the image.
Use an 8-bin histogram
computed over a 1111
window around the pixel.
7
8. Image Energy Function(2/2) As expected, no single energy function performs well across all images but in general they all accommodate a similar range for resizing.
We found either e1 or eHoG to work quite well.
8
9. Aspect Ratio Change(1/2) ????:
Left:
Seam removals
Center:
Scaling
Right:
Cropping 9
10. Aspect Ratio Change(2/2) ????:
In both examples the original
image is widened by seam
insertion.
10
11. Image Enlarging(1/2) ?????????????seam??
??????????????seam? NO
?????????,???????k?seam
????????:
1.????seam
2.?seam??????????
3.?seam???????????(???)???????(????) 11
12. Image Enlarging(2/2)
(a)Original (b)???Seam ??(c)Inserting the seams in order of removal (d)50% enlargement (e)????100%????scaling(f)????50% (g)???enlargement 12
13. Content Amplification ??????????seam caving?scaling???
????Scaling ????,??Seam Carving ????????
13
14. Object Removal(1/2) The system can automatically calculate the smaller of the vertical or horizontal diameters (in pixels) of the target removal region and perform vertical or horizontal removals accordingly .
????UI????
?????????
14
15. Object Removal(2/2) ?????????(????)
??????????? 15
16. Multi-size Image(1/3) ????????????????????????????
???????400500 ?100100 ??? 2.2 ??
??,?????????????seam ????????
????pre-processing ??,??????????
??index map,????????? 16
17. Multi-size Image(2/3) Index map:
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).
17
18. Multi-size Image(3/3) ??????,?index map????seam
??????,??seam?????????????????????????????
18
19. Seam Carving in the gradient domain combine seam carving with Poisson reconstruction ([Perez et al. 2003]).
??:Original
??:Seam carving
??:??Poisson
??:????
19
20. Retargeting with Optimal Seams-Order(1/4) ??I ?nm??? retarget?nm,?m<m and n<n,seam carving?????????
Remove vertical seams first? Horizontal seams first?
Or alternate between the two?
Define the search for the optimal order as an optimization of the following objective function:
where k = r+c, r = (m-m), c = (n-n) and ai is used as a parameter that determine if at step i we remove a horizontal or vertical seam: ai {0,1} 20
21. Retargeting with Optimal Seams-Order(2/4) k = r+c, r = (m-m), c = (n-n)
{0,1}
:vertical :horizontal
Find the optimal order using a transport map T
Entry T(r,c) holds the minimal cost needed to obtain an image of size n-rm-c.
21
22. Retargeting with Optimal Seams-Order(3/4) Starting at T(0,0) = 0 we fill each entry (r,c) choosing the best of two options - either removing a horizontal seam from an image of size n-rm-c+1 or removing a vertical seam from an image of size n-r+1m-c:
22
23. Retargeting with Optimal Seams-Order(4/4) Top is the original image and
its transport map T.
??:
optimal path (white path on T)
??:
Alternating between vertical and
horizontal
??:
vertical seams first
??:
horizontal seams first 23
24. Limitations(1/3) Combined with a face detector we get much better results. 24
25. Limitations(2/3) ?????Original?Cropped?Scaled
?????simple bottom up?face protect?face and flower 25
26. Limitations(3/3) ???????,???????????,????????,????scaling ??????? 26
27. ????(1/2) ????????gradient?,????Sobel opertaor
??????energy map image,(i,j)??gradient ?current ?????????????
i.e. min((i-1,j-1),(i-1,j),(i-1,j+1))
?????????
???????gradient 27
28. ????(2/2) ??energy map?,??optimal seam
??????????,??????????????,?????vertical?optimal seam,horizontal seam????
??optimal seam???????????
Seam insertion???seam????????,????????seam?????????????
????????????-1?pixel? 28
29. ??Demo 29
30. Reference Seam carving for content aware image resizing: MATLAB
http://danluong.com/2007/12/21/seam-carving-matlab-implementation-tutorial/
liquid-resize
http://www.thegedanken.com/retarget/
CAIR code
http://code.google.com/p/seam-carving-gui/
Rsizr??
http://cn.rsizr.com/
?????
http://swieskowski.net/carve/ 30
31. The EndThanks for your listening! 31