Groupe de Lecture du 21 Octobre 2009 SeamCarving & PatchMatch

Download Report

Transcript Groupe de Lecture du 21 Octobre 2009 SeamCarving & PatchMatch

Groupe de Lecture du 21 Octobre 2009
SeamCarving
&
PatchMatch
Groupe de Lecture du 21 Octobre 2009
I. SeamCarving: kézaco ?
1. Why ?
2. How does it work ?
II. How to code
3. Ideas
4. An example: our one
5. Other stuffs
6. That's great, but...
III. Here comes PatchMatch
7. Why (again) ?
8. Ze idea: NNF aka Nearest-Neighbor Field
9. Bonus
I. Seam Carving : kézaco?
1. Why?
Too big???
What the f**** ?
I. Seam Carving : kézaco?
2. How does it work ?
Wahou ! It's quiet better !
I. Seam Carving : kézaco?
Computing a matrix of energy
I. Seam Carving : kézaco?
Find the minimum connex path and remove it
II. How to code ?
1. Ideas
Image = (r, g, b) array array
We define the luminosity of a pixel with the formula :
0,6g + 0,3r + 0,1b
Image and its luminosity representation
II. How to code ?
Energy computing :
We define here an energy function :
∀ i , j ,
E i , j = [M i1, j− M i−1, j] [ M i , j 1−M i , j−1] where M is the image
2
2
There's a lot of others energy functions which give different
results. We can't say that one is better than an other, it just
depend on the cases.
II. How to code ?
Find the minimum path :
We have to minimize the cost of a path :
Cost  path =∑ E  i , j   where  i , j∈ path
Let Ch(i, j) be the minimum path which ends in (i, j). Assuming that
we are looking for a vertical path, we get the formula :
Ch(i,j)= (i,j)::Ch(i-1,y) where y = min { Cost(Ch(i-1, x) / x in [j-1, j, j+1] }
50
80
27
67
II. How to code ?
Take a look ...
II. How to code ?
3. Other stuffs
➢
Enlarging pictures:
What would happen if we
were doing the same thing
to enlarge ?
II. How to code ?
3. Other stuffs
➢
Enlarging pictures:
Answer:
Problem:
This is always the same
path which is duplicated !
II. How to code ?
3. Other stuffs
➢
Enlarging pictures:
Another idea: to enlarge of
k pixels, maybe we can
choose the k first paths
and duplicate them.
Problem: the k first paths are
quite the same...
So, what is the good method ?
II. How to code ?
3. Other stuffs
➢
Enlarging pictures:
Select a path to remove
●
k
times
Keep it and do the
removal
●
Insert selected paths
●
II. How to code ?
Constraints :
Goal : to protect certain parts of the image (e.g.
faces) or to remove others (e.g. Your ex-girlfriend).
Solution : Give those parts infinite energy (or very
small energy) !
II. How to code ?
Honey ???!
II. How to code ?
Optimal seams to retarget
Delete vertical seams first ? Horizontal?
We want to minimize the sum of the energy of all
seams removed.
As usual, dynamic programming
II. How to code ?
4. That's great but … ?
II. How to code ?
Can we keep the same perspectives as before ?
Yes, we can !