CS262: Computer Vision Image Regions John Magee Slides courtesy of Diane H. Theriault
Question of the Day • How do you identify and compute properties of objects found in images?
Post-processing • Basic segmentations can be messy. How can you clean them up?
Morphological Operators: Erosion image result “structuring Any pixel where the whole element” structuring element doesn’t fit in the foreground is removed
Morphological Operators image result “structuring Put structuring element on every element” pixel and turn on all pixels the structuring element touches
Identifying Image Regions • Image as a Graph • Definition of Connectivity 4 Connected 8 Connected
Depth First Traversal / Flood Fill: Recursive Depth-first Traversal(self) • – If self marked, stop – Else • Mark self • For each neighbor – Depth-first traversal(neighbor) • What do you know about the architecture of computer memory that might cause a problem here with a very large image region? • [A real “Google Interview” question!
Depth First Traversal / Flood Fill: Iterative • Solution: Use a stack data structure instead of the program stack Depth-first Traversal(self) • – Stack.push(self) – While(!stack.empty()) • node = stack.pop() • For each neighbor – If not marked » Mark neighbor » Stack.push(neighbor)
Removing Small Image Regions • For each image region, count number of pixels • For any regions smaller than some threshold, flood fill the region with a zero
Holes • A hole is any non-foreground that you can’t reach from the “background” e.g. the edge of the image
Defining Holes • If Black is background and white is foreground, are the pink squares background or a hole? • Foreground: 8 connected • Background 4: connected
Boundary Following • Find any pixel in an object (e.g. by scanning through image) then put your “right hand” on the object and walk around till you get back to your start point
Boundary Following • How do you keep your “right hand” on the wall? Check all neighboring pixels, always going clockwise (or counter- clockwise. Consistency is key)
Where is the boundary? • The pixels themselves, or between the pixels?
Where are the boundaries?
Where are the boundaries? • One convention: Have boundaries between background and foreground go clockwise and boundaries between objects and holes go counter-clockwise • Keep a tree of the relationships between objects, holes, and objects in the holes
Where are the Boundaries? • One convention: Have boundaries between background and foreground go clockwise and boundaries between objects and holes go counter-clockwise • Keep a tree of the relationships between objects, holes, and objects in the holes
Properties of Image Regions • “ Location ” • Distance between image regions? – Set of Pixels – Boundary – Centroid (center) – Bounding Box – Bounding Ellipse – Convex Hull Shapiro & Stockman, Chapter 3. Szeliski 3.3.4
Properties of Image Regions • “Shape” – Area – Perimeter – Orientation – Compactness – Circularity – Image Moments
Properties of Image Regions • “Appearance” – Mean brightness – Mean color – Brightness or Color histogram – Other measures of appearance
Simple region properties can get you pretty far!
Recommend
More recommend