Graph-based image segmentation Václav Hlaváč Czech Technical University in Prague Faculty of Electrical Engineering Department of Cybernetics Prague, Czech.

Slides:



Advertisements
Similar presentations
Cutting Images: Graphs and Boundary Finding Computational Photography Derek Hoiem, University of Illinois 09/15/11 “The Double Secret”, Magritte.
Advertisements

Graph cut Chien-chi Chen.
Introduction to Markov Random Fields and Graph Cuts Simon Prince
I Images as graphs Fully-connected graph – node for every pixel – link between every pair of pixels, p,q – similarity w ij for each link j w ij c Source:
GrabCut Interactive Image (and Stereo) Segmentation Carsten Rother Vladimir Kolmogorov Andrew Blake Antonio Criminisi Geoffrey Cross [based on Siggraph.
GrabCut Interactive Foreground Extraction using Iterated Graph Cuts Carsten Rother Vladimir Kolmogorov Andrew Blake Microsoft Research Cambridge-UK.
GrabCut Interactive Foreground Extraction using Iterated Graph Cuts Carsten Rother Vladimir Kolmogorov Andrew Blake Microsoft Research Cambridge-UK.
A Gimp Plugin that uses “GrabCut” to perform image segmentation
Graph-Based Image Segmentation
Stephen J. Guy 1. Photomontage Photomontage GrabCut – Interactive Foreground Extraction 1.
1 s-t Graph Cuts for Binary Energy Minimization  Now that we have an energy function, the big question is how do we minimize it? n Exhaustive search is.
GrabCut Interactive Image (and Stereo) Segmentation Joon Jae Lee Keimyung University Welcome. I will present Grabcut – an Interactive tool for foreground.
CS 691 Computational Photography Instructor: Gianfranco Doretto Cutting Images.
Lecture 6 Image Segmentation
CS448f: Image Processing For Photography and Vision Graph Cuts.
Region Segmentation. Find sets of pixels, such that All pixels in region i satisfy some constraint of similarity.
Today: Image Segmentation Image Segmentation Techniques Snakes Scissors Graph Cuts Mean Shift Wednesday (2/28) Texture analysis and synthesis Multiple.
2010/5/171 Overview of graph cuts. 2010/5/172 Outline Introduction S-t Graph cuts Extension to multi-label problems Compare simulated annealing and alpha-
Snakes Goes from edges to boundaries. Edge is strong change in intensity. Boundary is boundary of an object. –Smooth (more or less) –Closed. –…
Image Segmentation Today’s Readings Intelligent Scissors, Mortensen et. al, SIGGRAPH 1995Intelligent Scissors From Sandlot ScienceSandlot Science.
MRF Labeling With Graph Cut CMPUT 615 Nilanjan Ray.
Stereo Computation using Iterative Graph-Cuts
An Iterative Optimization Approach for Unified Image Segmentation and Matting Hello everyone, my name is Jue Wang, I’m glad to be here to present our paper.
Image Segmentation Today’s Readings Forsyth & Ponce, Chapter 14
Announcements Mailing list: –you should have received messages Office hours onlineonline –start next week.
Measuring Uncertainty in Graph Cut Solutions Pushmeet Kohli Philip H.S. Torr Department of Computing Oxford Brookes University.
Computer vision: models, learning and inference
Perceptual Organization: Segmentation and Optical Flow.
Segmentation and Clustering Today’s Readings Forsyth & Ponce, Chapter 7 (plus lots of optional references in the slides) From Sandlot ScienceSandlot Science.
Graph-based Segmentation
Image Segmentation Rob Atlas Nick Bridle Evan Radkoff.
MRFs and Segmentation with Graph Cuts Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/31/15.
Cutting Images: Graphs and Boundary Finding Computational Photography Derek Hoiem, University of Illinois 09/14/10 “The Double Secret”, Magritte.
Graph-based Segmentation. Main Ideas Convert image into a graph Vertices for the pixels Vertices for the pixels Edges between the pixels Edges between.
MRFs and Segmentation with Graph Cuts Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/24/10.
Segmentation: MRFs and Graph Cuts Computer Vision CS 143, Brown James Hays 10/07/11 Many slides from Kristin Grauman and Derek Hoiem.
The University of Ontario CS 433/653 Algorithms for Image Analysis Segmentation (2D) Acknowledgements: Alexei Efros, Steven Seitz.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D Images (Fri) Young Ki Baik, Computer Vision Lab.
Lecture 2: Edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Graph Cuts Marc Niethammer. Segmentation by Graph-Cuts A way to compute solutions to the optimization problems we looked at before. Example: Binary Segmentation.
CS774. Markov Random Field : Theory and Application Lecture 02
Gaussian Mixture Models and Expectation-Maximization Algorithm.
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Edge Detection:
Machine Learning – Lecture 15
CS654: Digital Image Analysis Lecture 28: Advanced topics in Image Segmentation Image courtesy: IEEE, IJCV.
A global approach Finding correspondence between a pair of epipolar lines for all pixels simultaneously Local method: no guarantee we will have one to.
Computational Photography lecture 8 – segmentation CS (future 572) Spring 2016 Prof. Alex Berg (Credits to many other folks on individual slides)
Markov Random Fields in Vision
Cutting Images: Graphs and Boundary Finding Computational Photography Derek Hoiem, University of Illinois 09/20/12 “The Double Secret”, Magritte.
Image segmentation.
MRFs and Segmentation with Graph Cuts Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/27/12.
Graph-based Segmentation
Cutting Images: Graphs and Boundary Finding
Segmentation by clustering: normalized cut
Announcements CS accounts Project 1 is out today
GrabCut Interactive Foreground Extraction using Iterated Graph Cuts Carsten Rother Vladimir Kolmogorov Andrew Blake Microsoft Research Cambridge-UK.
CS4670/5670: Image Scissors Noah Snavely Today’s Readings
Markov Random Fields with Efficient Approximations
Graph Cut Weizhen Jing
Markov Random Fields and Segmentation with Graph Cuts
Announcements Reader is in the BOOK STORE (not Comm Bldg.)
Lecture 31: Graph-Based Image Segmentation
Digital Image Processing
Seam Carving Project 1a due at midnight tonight.
Segmentation (continued)
Announcements Project 1 is out today
Announcements Project 1 is out today help session at the end of class.
“Traditional” image segmentation
Presentation transcript:

Graph-based image segmentation Václav Hlaváč Czech Technical University in Prague Faculty of Electrical Engineering Department of Cybernetics Prague, Czech Republic Based on the presentation of D. Hoiem,S. Lazebnik, Jianbo Shi

2 Types of segmentations OversegmentationUndersegmentation Multiple Segmentations

3 Major processes for segmentation  Bottom-up: group tokens with similar features  Top-down: group tokens that likely belong to the same object [Levin and Weiss 2006]

4

5 Main Ideas  Convert image into a graph Vertices for the pixels Edges between the pixels Additional vertices and edges to encode other constraints  Manipulate the graph to segment the image

6 Papers  Interactive graph cuts for optimal boundary & region segmentation of objects in N-D images Boykov and Jolly Minimize an energy function  Efficient Graph-based Segmentation Felzenszwalb and Huttenlocher Cluster the vertices based on edge weight

7 Boykov and Jolly  Binary image segmentation Classify pixels as object or background Their contribution is adding interactivity  Minimise an energy function E(A) = B(A) + λR(A)  A: Segmentation (assign each pixels to object or background)  B(A): The cost of all the edges between object pixels and background pixels  R(A): The cost of deciding a pixel to be object or background

8 Creating the Graph  Each pixel has a corresponding vertex  Additionally, a source (“object”) and a sink (“background”)  Each pixel vertex has an edge to its neighbours (e.g. 8 adjacent neighbours in 2D), an edge to the source, an edge to the sink

9 An image represented as a graph

10 Undirected/directed graph

11

12

13

14 Intelligent Scissors Mortenson and Barrett (SIGGRAPH 1995)

15 Intelligent Scissors A good image boundary has a short path through the graph. Mortenson and Barrett (SIGGRAPH 1995) Start End

16 Intelligent Scissors  Formulation: find good boundary between seed points  Challenges Minimize interaction time Define what makes a good boundary Efficiently find it

17 Intelligent Scissors: method 1.Define boundary cost between neighboring pixels 2.User specifies a starting point (seed) 3.Compute lowest cost from seed to each other pixel 4.Get path from seed to cursor, choose new seed, repeat

18 Intelligent Scissors: method Define boundary cost between neighboring pixels a)Lower if edge is present (e.g., with edge(im, ‘canny’)) b)Lower if gradient is strong c)Lower if gradient is in direction of boundary

19 Gradients, Edges, and Path Cost Gradient Magnitude Edge Image Path Cost

20 Intelligent Scissors: method 1.Define boundary cost between neighboring pixels 2.User specifies a starting point (seed) Snapping

21 Intelligent Scissors: method 1.Define boundary cost between neighboring pixels 2.User specifies a starting point (seed) 3.Compute lowest cost from seed to each other pixel Dijkstra’s shortest path algorithm

22 Dijkstra’s shortest path algorithm Initialize, given seed s:  Compute cost 2 (q, r) % cost for boundary from pixel q to neighboring pixel r  cost(s) = 0 % total cost from seed to this point  A = {s} % set to be expanded  E = { } % set of expanded pixels  P(q) % pointer to pixel that leads to q Loop while A is not empty 1.q = pixel in A with lowest cost 2.Add q to E 3.for each pixel r in neighborhood of q that is not in E a)cost_tmp = cost(q) + cost 2 (q,r) b)if (r is not in A) OR (cost_tmp < cost(r)) i.cost(r) = cost_tmp ii. P(r) = q iii.Add r to A

23 Intelligent Scissors: method 1.Define boundary cost between neighboring pixels 2.User specifies a starting point (seed) 3.Compute lowest cost from seed to each other pixel 4.Get new seed, get path between seeds, repeat

24 Intelligent Scissors: improving interaction 1.Snap when placing first seed 2.Automatically adjust to boundary as user drags 3.Freeze stable boundary points to make new seeds

25 A cut of a graph

26 Flow network, flow

27

28

29

30

31

32

33

34

35 Pixel-based statistical model has limitations because of existing relations to other pixels. P(foreground | image)

36 Solution: encode dependences between pixels P(foreground | image) Labels to be predicted Individual predictions Pairwise predictions Normalizing constant called “partition function”

37 Writing likelihood as an energy Cost of assignment y i Cost of pairwise assignment y i, y j - log(.)

38 Notes on energy-based formulation  Primarily used when you only care about the most likely solution (not the confidences).  Can think of it as a general cost function.  Can have larger “cliques” than 2. The clique is the set of variables that go into a potential function.

39 Markov random field  MRF takes into account context, e.g. labels in neighboring sites.  Neco

40 Markov Random Fields Node y i : pixel label Edge: constrained pairs Cost to assign a label to each pixel Cost to assign a pair of labels to connected pixels

41 Label smoothing grid example Unary potential K 1 K 0 K>0 0: - logP(y i = 0 | data) 1: - logP(y i = 1 | data) Pairwise Potential

42 Creating the graph  Each pixel has a corresponding vertex  Additionally, a source (“object”) and a sink (“background”)  Each pixel vertex has an edge to its neighbors (e.g. 8 adjacent neighbors in 2D), an edge to the source, an edge to the sink

43 Edge weights between pixels  Weight of edges between pixel vertices are determined by the function expressing dependence between two pixels  Low score when boundary is likely to pass between the vertices  High score when vertices are probably part of the same element  E.g. the difference in pixel intensities, the image gradient

44 Solving MRFs with graph cuts Source (Label 0) Sink (Label 1) Cost to assign to 1 Cost to assign to 0 Cost to split nodes

45 Solving MRFs with graph cuts Source (Label 0) Sink (Label 1) Cost to assign to 1 Cost to assign to 0 Cost to split nodes

46 Graph cut, Boykov & Jolly 2001 Image Min Cut Min Cut Cut: Separating source and sink; Energy: collection of edges Min Cut: Global minimal energy in polynomial time Foreground (source) Background (sink)

47 Max flow  Directed graph with one source & one sink node  Directed edge = pipe  Edge label = capacity  What is the max flow from source to sink?

48 Max flow  Graph with one source & one sink node  Edge = pipe  Edge label = capacity  What is the max flow from source to sink?

49 Max flow  What is the max flow from source to sink?  Look at residual graph remove saturated edges (green here) min cut is at boundary between 2 connected components min cut

50 Equivalence of min cut/max flow  The three following statements are equivalent The maximum flow is f The minimum cut has weight f The residual graph for flow f contains no directed path from source to sink min cut

51 Normalized cut A minimum cut penalizes large segments This can be fixed by normalizing the cut by component size The normalized cut cost is: The exact solution is NP-hard but an approximation can be computed by solving a generalized eigenvalue problem assoc(A, V) = sum of weights of all edges in V that touch A J. Shi and J. Malik. Normalized cuts and image segmentation. PAMI 2000Normalized cuts and image segmentation.

52 GrabCut segmentation User provides rough indication of foreground region. Goal: Automatically provide a pixel-level segmentation. Less user input, rectangle only. Handles color Carsten Rother (professor at TU Dresden now) et al. 2004

53 Grab cuts and graph cuts User Input Result Magic Wand (198?) Intelligent Scissors Mortensen and Barrett (1995) GrabCut Regions Boundary Source: K. Rother

54 Color model Gaussian Mixture Model (typically 5-8 components) Foreground & Background Background R G Source: K. Rother

55 Color model 2 Gaussian Mixture Model (typically 5-8 components) Foreground & Background Background Foreground Background G R G R Iterated graph cut Source: K. Rother

56 GrabCut segmentation 1.Define graph usually 4-connected or 8-connected  Divide diagonal potentials by sqrt(2) 2.Define unary potentials Color histogram or mixture of Gaussians for background and foreground 3.Define pairwise potentials 4.Apply graph cuts 5.Return to 2, using current labels to compute foreground, background models

57 What is easy or hard about these cases for graphcut-based segmentation?

58 Easier examples GrabCut – Interactive Foreground Extraction 10

59 More difficult Examples Camouflage & Low Contrast Harder Case Fine structure Initial Rectangle Initial Result GrabCut – Interactive Foreground Extraction 11

60 Using graph cuts for recognition TextonBoost (Shotton et al IJCV)