1. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Алгоритмы для
задачи
матирования
Юрий Гитман
Video Group
CS MSU Graphics & Media Lab
2. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Table of content
Introduction
Guided Filter
PatchMatch
Closed-form Matting
Alpha Flow
Conclusion
2
3. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Matting problem
Common statement
3
Фон
Карта
Прозрачности
Объект
Грубая разметка (Trimap)
Исходное изображение
4. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Sum of Absolute Differences
Overall
rank
Average
(small trimap)
Average
(large trimap)
Average
(user-defined trimap)
SVR Matting
(Support Vector Regression)
5.2 6.3 4.8 4.5
Weighted Color and Texture Matting 5.5 4.5 6.5 5.4
Shared Matting 6.1 6.0 7.5 4.9
Global Sampling Matting 7.3 5.5 8.8 7.8
Segmentation-based Matting 7.7 8.0 7.3 7.9
Fast Automatic Matting 7.8 7.1 8.1 8.1
Improved Color Matting 8.2 7.9 7.8 9.0
LSR Matting
(Local Spline Regression)
9.0 10.4 6.9 9.6
Global Sampling Matting
(filter version)
9.1 8.4 9.8 9.3
KNN Matting (K-Nearest Neighbor) 9.7 11.1 10.5 7.4
Learning-based Matting 10.1 10.3 9.4 10.6
LMSPIR Matting 10.2 9.4 10.9 10.3
Shared Matting (real-time) 10.3 10.4 10.4 10.3
Closed-form Matting 10.5 10.1 9.1 12.4
State of the art
Image Matting
4
5. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Problem of papers on
Video matting
Да, статей по matting’у во времени
не мало, но многие из них опираются
на существование идеального
оптического потока
Михаил Ерофеев
5
6. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
В предыдущих сериях
6X. Bai, J. Wang, D. Simons, “Towards Temporally-coherent
Video Matting,” in IEEE Mirage, 2011
7. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Содержание
7
Introduction
Guided Filter
PatchMatch
Closed-form Matting
Alpha Flow
Conclusion
8. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
New edge-preserving filter
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
Guidance
8
9. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
New edge-preserving filter
9
Guided Filter
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
10. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
New edge-preserving filter
10
Bilateral Filter
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
11. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
New edge-preserving filter
11
Gaussian Guided Filter
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
12. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Idea of Filtering
12
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
Для каждого окна :
Коэффициенты и , определяются так,
чтобы наилучшим образом соответствовать
исходному изображению
13. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Steps of the Algorithm
13
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
14. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Application to Matting
14
Binary Mask Source Image
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
15. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Application to Matting
15
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
Guided Filter Source Image
16. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Application to Matting
16
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
Joint bilateral
Filter Source Image
17. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Application to Matting
17
K. He, J. Sun, X. Tang, “Guided Image Filtering,” in ECCV, 2010
Domain
Transform Source Image
18. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Содержание
18
Introduction
Guided Filter
PatchMatch
Closed-form Matting
Nonlocal Matting
Alpha Flow
Conclusion
19. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Fast k nearest
neighbors search (KNN)
19
C. Barnes, E. Shechtman, A. Finkestein, D. Goldman, “PatchMatch.
A Randomized Correspondence Algorithm for Structural Image
Editing,” in ACM Transactions on Graphics (TOG), 2009
20. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Пример работы алгоритма
20
Поиск потока из нижнего изображения в верхнее.
Hue компонента соответствует углу
Magnitude компонента длине вектора
C. Barnes, E. Shechtman, A. Finkestein, D. Goldman, “PatchMatch.
A Randomized Correspondence Algorithm for Structural Image
Editing,” in ACM Transactions on Graphics (TOG), 2009
21. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Детали алгоритма (1)
21
C. Barnes, E. Shechtman, A. Finkestein, D. Goldman, “PatchMatch.
A Randomized Correspondence Algorithm for Structural Image
Editing,” in ACM Transactions on Graphics (TOG), 2009
22. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Детали алгоритма (2)
22
C. Barnes, E. Shechtman, A. Finkestein, D. Goldman, “PatchMatch.
A Randomized Correspondence Algorithm for Structural Image
Editing,” in ACM Transactions on Graphics (TOG), 2009
23. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Содержание
23
Introduction
Guided Filter
PatchMatch
Closed-form Matting
Nonlocal Matting
Alpha Flow
Conclusion
24. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Предположение о природе
изображений
Основное уравнение matting’а:
Предположим, что коэффициенты
локально постоянны
(окрестности 3×3 в авторской реализации)
24
A. Levin, D. Lischinski, Y. Weiss, “A Closed-form Solution to Natural
Image Matting,” in IEEE Pattern Analysis and Machine Intelligence
(PAMI), 2008
25. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Matting Laplacian (1)
Предположив локальную линейность , мы
можем построить функционал, экстремум
которого будет решением:
Тогда
25
A. Levin, D. Lischinski, Y. Weiss, “A Closed-form Solution to Natural
Image Matting,” in IEEE Pattern Analysis and Machine Intelligence
(PAMI), 2008
26. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Matting Laplacian (2)
26
,
где
A. Levin, D. Lischinski, Y. Weiss, “A Closed-form Solution to Natural
Image Matting,” in (PAMI), 2008
27. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Results (1)
27
A. Levin, D. Lischinski, Y. Weiss, “A Closed-form Solution to Natural
Image Matting,” in IEEE Pattern Analysis and Machine Intelligence
(PAMI), 2008
Input image Bayesian Matting Poisson matting Closed-form matting Scribbles
28. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Results (2)
28
A. Levin, D. Lischinski, Y. Weiss, “A Closed-form Solution to Natural
Image Matting,” in IEEE Pattern Analysis and Machine Intelligence
(PAMI), 2008
Input image Trimap Bayesian matting Scribbles Closed-form matting
29. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Results (3)
29
A. Levin, D. Lischinski, Y. Weiss, “A Closed-form Solution to Natural
Image Matting,” in IEEE Pattern Analysis and Machine Intelligence
(PAMI), 2008
Input image Matting result Foreground
reconstruction
Background
reconstruction
New background
30. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Содержание
30
Introduction
Guided Filter
PatchMatch
Closed-form Matting
Nonlocal Matting
Alpha Flow
Conclusion
31. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Предположение о природе
движения в видео
31M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
32. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Шаги Алгоритма (1)
1. Инициализация альфа потока значениями
оптического потока для RGB
2. Обработка occlusions: построение цепочек
(суперпикселей во времени)
3. Перерасчет значений прозрачности
32M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
33. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Шаги Алгоритма (2)
4. Фильтрация (Guided Filter),
чтобы подавить артефакты в виде
больших полупрозрачных областей
(в конце этот шаг может быть пропущен)
5. Вычисление альфа потока
6. Переход на шаг 2
33M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
34. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Вычисление оптического
потока (1)
Первое и третье слагаемое оптимизируются
34
попеременно
M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
35. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Вычисление оптического
потока (2)
Первое слагаемое:
PatchMatch-based Motion Estimation
Второе слагаемое:
Решение линейной системы уравнений
(если я не ошибаюсь)
Вообще, говоря условие гладкости может
быть включено и в PatchMatch [Besse 2012]
35M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
36. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Обработка occlusions
Оптический поток вычисляется в обе стороны
Если вектора в обоих направлениях
приблизительно совпадают (если я не
ошибаюсь), то они образуют ненаправленное
ребро в нашем графе
Попробуем соединять последовательные
вектора в цепочки
36M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
37. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Алгоритм построения
цепочек
Цепочки должны начинаться и заканчиваться
в occlusion’ах
На каждом шаге будем «жадно» выбирать
две цепочки, которые соединяем, пока цена
(приращение оптимизируемой функции)
не станет отрицательна
Каждая цепочка дает вклад в зависимости
от дисперсии цветов пикселей вдоль нее
37M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
38. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Распределение длин
цепочек (Avg = 2–4)
38M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
39. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Иллюстрация объединения
цепочек
39M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video
Matting,” Asian Conference on Computer Vision (ACCV), 2013
40. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Перерасчет значений
прозрачности
40
Энергия, которую мы оптимизируем на этом шаге:
, где Lt matting Laplacian
для полученных суперпикселей
41. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Содержание
41
Introduction
Guided Filter
PatchMatch
Closed-form Matting
Nonlocal Matting
Alpha Flow
Conclusion
42. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Matting algorithms
comparison by M. Erofeev (1)
42
43. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Matting algorithms
comparison by M. Erofeev (1)
43
44. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Литература
1. M. Sindeev, A. Konushin, and C. Rother, “Alpha Flow for Video Matting,”
Asian Conference on Computer Vision (ACCV), 2013.
2. K. He, J. Sun, X. Tang, “Guided Image Filtering,” in European
Conference on Computer Vision (ECCV), 2010, pp. 1–14.
3. C. Barnes, E. Shechtman, A. Finkestein, D. Goldman, “PatchMatch. A
Randomized Correspondence Algorithm for Structural Image Editing,”
in ACM Transactions on Graphics (TOG), 2009, vol. 28, p. 24.
4. F. Besse, C. Rother, A. Fitzgibbon, J. Kautz, “PMBP: PatchMatch Belief
Propagation for Correspondence Field Estimation,” in British Machine
Vision Conference (BMVC), 2012.
5. A. Levin, D. Lischinski, Y. Weiss, “A Closed-form Solution to Natural
Image Matting,” in IEEE Pattern Analysis and Machine Intelligence
(PAMI), 2008, vol. 30, pp. 228–242.
44
45. CS MSU Graphics & Media Lab (Video Group)
www.compression.ru/video/
Only for
Maxus
Литература
6. P. Lee, Y. Wu, “Nonlocal Matting,” in IEEE Computer Vision and Pattern
Recogntion (CVPR), 2011, pp. 2193–2200.
7. X. Bai, J. Wang, D. Simons, “Towards Temporally-coherent Video
Matting,” in IEEE Mirage, 2011, pp. 63–74.
8. I. Choi, M. Lee, Y.W. Tai, “Video Matting Using Multi-Frame Nonlocal
Matting Laplacian,” in European Conference on Computer Vision (ECCV),
2012.
45