CS 1674 Intro to Computer Vision HW 2

  • Slides: 9
Download presentation
CS 1674: Intro to Computer Vision HW 2 Background Prof. Adriana Kovashka University of

CS 1674: Intro to Computer Vision HW 2 Background Prof. Adriana Kovashka University of Pittsburgh Slides from Kristen Grauman

Seam carving: main idea Resize effect: 6 x 10 5 x 10 [Shai &

Seam carving: main idea Resize effect: 6 x 10 5 x 10 [Shai & Avidan, SIGGRAPH 2007]

Seam carving: main idea Content-aware resizing Traditional resizing [Shai & Avidan, SIGGRAPH 2007]

Seam carving: main idea Content-aware resizing Traditional resizing [Shai & Avidan, SIGGRAPH 2007]

Seam carving: main idea Content-aware resizing Intuition: • Preserve the most “interesting” content Prefer

Seam carving: main idea Content-aware resizing Intuition: • Preserve the most “interesting” content Prefer to remove pixels with low gradient energy • To reduce or increase size in one dimension, remove irregularly shaped (non-straight) “seams” Optimal solution via dynamic programming. Kristen Grauman, UT-Austin

Seam carving: main idea • Want to remove seams where they won’t be very

Seam carving: main idea • Want to remove seams where they won’t be very noticeable: – Measure “energy” as gradient magnitude (horizontal/vertical change) • Choose seam based on minimum total energy path across image, subject to 8 -connectedness. Kristen Grauman, UT-Austin

Seam carving: algorithm s 1 s 2 s 3 s 4 s 5 Let

Seam carving: algorithm s 1 s 2 s 3 s 4 s 5 Let a vertical seam s consist of h positions that form an 8 -connected path. Let the cost of a seam be: Optimal seam minimizes this cost: Compute it efficiently with dynamic programming. Kristen Grauman, UT-Austin

Seam carving: algorithm • Compute the cumulative minimum energy for all possible connected seams

Seam carving: algorithm • Compute the cumulative minimum energy for all possible connected seams at each entry (i, j): row i-1 row i Energy matrix (gradient magnitude) j-1 j j+1 j M matrix: cumulative min energy (for vertical seams) • Then, min value in last row of M indicates end of the minimal connected vertical seam. • Backtrack up from there, selecting min of 3 above in M. • Computing horizontal seams is analogous. Kristen Grauman, UT-Austin

Example First, compute cumulative energy from raw energy Energy matrix (gradient magnitude) Kristen Grauman,

Example First, compute cumulative energy from raw energy Energy matrix (gradient magnitude) Kristen Grauman, UT-Austin M matrix (for vertical seams)

Example Now backtrack Energy matrix (gradient magnitude) Kristen Grauman, UT-Austin M matrix (for vertical

Example Now backtrack Energy matrix (gradient magnitude) Kristen Grauman, UT-Austin M matrix (for vertical seams)