Connected components - 1

Similar documents
Problem definition Image acquisition Image segmentation Connected component analysis. Machine vision systems - 1

CS443: Digital Imaging and Multimedia Binary Image Analysis. Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University

EE 584 MACHINE VISION

Operators-Based on Second Derivative double derivative Laplacian operator Laplacian Operator Laplacian Of Gaussian (LOG) Operator LOG

CITS 4402 Computer Vision

Topic 6 Representation and Description

Binary Image Processing. Introduction to Computer Vision CSE 152 Lecture 5

Lecture 3: Art Gallery Problems and Polygon Triangulation

Introduction. Computer Vision & Digital Image Processing. Preview. Basic Concepts from Set Theory

Image Processing. Bilkent University. CS554 Computer Vision Pinar Duygulu

CS534 Introduction to Computer Vision Binary Image Analysis. Ahmed Elgammal Dept. of Computer Science Rutgers University

Image Segmentation. Selim Aksoy. Bilkent University

Image Segmentation. Selim Aksoy. Bilkent University

CoE4TN4 Image Processing

Exercise Computer graphics (till October 30, 2007)

Lecture 8 Object Descriptors

Computational Geometry

From Pixels to Blobs

Digital Image Processing

Types of image feature and segmentation

09/11/2017. Morphological image processing. Morphological image processing. Morphological image processing. Morphological image processing (binary)

Topic 4 Image Segmentation

Digital Image Processing Chapter 11: Image Description and Representation

CS4733 Class Notes, Computer Vision

EN1610 Image Understanding Lab # 3: Edges

Morphological Image Processing

Texture. Frequency Descriptors. Frequency Descriptors. Frequency Descriptors. Frequency Descriptors. Frequency Descriptors

Motion detection Computing image motion Motion estimation Egomotion and structure from motion Motion classification

Motion Detection. Final project by. Neta Sokolovsky

CS521 \ Notes for the Final Exam

Processing of binary images

A Texture-based Method for Detecting Moving Objects

EECS490: Digital Image Processing. Lecture #23

Image Processing: Final Exam November 10, :30 10:30

Polyominoes and Polyiamonds as Fundamental Domains for Isohedral Tilings of Crystal Class D 2

Polyominoes and Polyiamonds as Fundamental Domains for Isohedral Tilings of Crystal Class D 2

Perception. Autonomous Mobile Robots. Sensors Vision Uncertainties, Line extraction from laser scans. Autonomous Systems Lab. Zürich.

BSB663 Image Processing Pinar Duygulu. Slides are adapted from Selim Aksoy

C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S. Image Operations II

Processing and Others. Xiaojun Qi -- REU Site Program in CVMA

Segmentation algorithm for monochrome images generally are based on one of two basic properties of gray level values: discontinuity and similarity.

Matching and Planarity

UPEM Master 2 Informatique SIS. Digital Geometry. Topic 2: Digital topology: object boundaries and curves/surfaces. Yukiko Kenmochi.

Det De e t cting abnormal event n s Jaechul Kim

Robotics Programming Laboratory

Power Set of a set and Relations

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Announcements. Binary Image Processing. Binary System Summary. Histogram-based Segmentation. How do we select a Threshold?

MULTI-REGION SEGMENTATION

Morphological Image Processing

Example 2: Straight Lines. Image Segmentation. Example 3: Lines and Circular Arcs. Example 1: Regions

Example 1: Regions. Image Segmentation. Example 3: Lines and Circular Arcs. Example 2: Straight Lines. Region Segmentation: Segmentation Criteria


CS 787: Assignment 4, Stereo Vision: Block Matching and Dynamic Programming Due: 12:00noon, Fri. Mar. 30, 2007.

Morphological Image Processing

Copyright 2000, Kevin Wayne 1

CS Data Structures and Algorithm Analysis

Solutions to Problem Set 1

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

EE795: Computer Vision and Intelligent Systems

Outline. Advanced Digital Image Processing and Others. Importance of Segmentation (Cont.) Importance of Segmentation

3.1 Basic Definitions and Applications

γ 2 γ 3 γ 1 R 2 (b) a bounded Yin set (a) an unbounded Yin set

First Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms...

Chapter 3. Sukhwinder Singh

Antisymmetric Relations. Definition A relation R on A is said to be antisymmetric

Graphics (Output) Primitives. Chapters 3 & 4

Multimedia Computing: Algorithms, Systems, and Applications: Edge Detection

Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections.

Tracking and Recognizing People in Colour using the Earth Mover s Distance

Lecture 6: Multimedia Information Retrieval Dr. Jian Zhang

Mathematical Morphology and Distance Transforms. Robin Strand

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

CSE 152 Lecture 7. Intro Computer Vision

Idea. Found boundaries between regions (edges) Didn t return the actual region

Digital Image Processing. Prof. P.K. Biswas. Department of Electronics & Electrical Communication Engineering

Chapter 11 Representation & Description

A Keypoint Descriptor Inspired by Retinal Computation

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

CSE 152 Lecture 7` Intro Computer Vision

Segmentation Computer Vision Spring 2018, Lecture 27

Content-based Image and Video Retrieval. Image Segmentation

6.801/866. Segmentation and Line Fitting. T. Darrell

Basic Communication Operations Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar

Boundary descriptors. Representation REPRESENTATION & DESCRIPTION. Descriptors. Moore boundary tracking

Image Acquisition + Histograms

Biomedical Image Analysis. Mathematical Morphology

CS6100: Topics in Design and Analysis of Algorithms

Motion detection Computing image motion Motion estimation Egomotion and structure from motion Motion classification. Time-varying image analysis- 1

6. Object Identification L AK S H M O U. E D U

9 length of contour = no. of horizontal and vertical components + ( 2 no. of diagonal components) diameter of boundary B

SDSU CS 662 Theory of Parallel Algorithms Networks part 2

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours

Application of fuzzy set theory in image analysis. Nataša Sladoje Centre for Image Analysis

Image Analysis - Lecture 5

8. Hidden Surface Elimination

implementing the breadth-first search algorithm implementing the depth-first search algorithm

High Efficiency Video Coding. Li Li 2016/10/18

Transcription:

Connected Components Basic definitions Connectivity, Adjacency, Connected Components Background/Foreground, Boundaries Run-length encoding Component Labeling Recursive algorithm Two-scan algorithm Chain Codes Integral Images Histograms Gray and Color Histograms Edge Histograms Connected components - 1

4(8) Connectivity Definition: Given a pixel (i,j) its 4-neighbors are the points (i,j ) such that i-i + j-j = 1 the 4-neighbors are (i±i, j) and (i,j±1) Definition: Given a pixel (i,j) its 8- neighbors are the points (i,j ) such that max( i-i, j-j ) = 1 the 8- neighbors are (i, j±1), (i±1, j) and (i±1, j±1) Connected components - 2

Adjacency Definition: Given two disjoint sets of pixels, A and B, A is 4-(8) adjacent to B is there is a pixel in A that is a 4-(8) neighbor of a pixel in B Connected components - 3

Connected components Definition: A 4-(8)path from pixel (i 0,j 0 ) to (i n,j n ) is a sequence of pixels (i 0,j 0 ) (i 1,j 1 ) (i 2,j 2 ),... (i n,j n ) such that (i k, j k ) is a 4-(8) neighbor of (i k+1, j k+1 ), for k = 0,..., n-1 (i 0,j 0 ) (i 0,j 0 ) (i n, j n ) (i n, j n ) Every 4-path is an 8-path! Connected components - 4

Connected components Definition: Given a binary image, B, the set of all 1 s is called the foreground and is denoted by S Definition: Given a pixel p in S, p is 4-(8) connected to q in S if there is a path from p to q consisting only of points from S. The relation is-connected-to is an equivalence relation Reflexive - p is connected to itself by a path of length 0 Symmetric - if p is connected to q, then q is connected to p by the reverse path Transitive - if p is connected to q and q is connected to r, then p is connected to r by concatenation of the paths from p to q and q to r Connected components - 5

Connected components Since the is-connected-to relation is an equivalence relation, it partitions the set S into a set of equivalence classes or components these are called connected components Definition: S is the complement of S - it is the set of all pixels in B whose value is 0 S can also be partitioned into a set of connected components Regard the image as being surrounded by a frame of 0 s The component(s) of S that are adjacent to this frame is called the background of B. All other components of S are called holes Connected components - 6

Examples - Black = 1, Green = 0 How many 4- (8) components of S? What is the background? Which are the 4- (8) holes? Connected components - 7

Background and foreground connectivity Use opposite connectivity for the foreground and the background 4-foreground, 8-background: 4 single pixel objects and no holes 4-background, 8-foreground: one 4 pixel object containing a 1 pixel hole Connected components - 8

Boundaries The boundary of S is the set of all pixels of S that have 4-neighbors in S. The boundary set is denoted as S. The interior is the set of pixels of S that are not in its boundary: S-S Definition: Region T surrounds region R (or R is inside T) if any 4-path from any point of R to the background intersects T Theorem: If R and T are two adjacent components, then either R surrounds T or T surrounds R. Connected components - 9

Examples A A A A A A B A B A B B Even levels are components of 0 s The background is at level 0 Odd levels are components of 1 s Connected components - 10

Run-length Encoding Used mainly to represent binary images such as faxes. Various approaches exist, the book represents only foreground. Foreground is a list of lists. Each non-zero row is represented by a list. (r b 1 e 1 b 2 e 2 ) where r is the row and b i e i are the beginning and ending column indices for a foreground run ((11144)(214)(52355)) Connected components - 11

Component labeling Given: Binary image B Produce: An image in which all of the pixels in each connected component are given a unique label. Solution 1: Recursive, depth first labeling Scan the binary image from top to bottom, left to right until encountering a 1 (0). Change that pixel to the next unused component label Recursively visit all (8,4) neighbors of this pixel that are 1 s (0 s) and mark them with the new label Connected components - 12

Example Connected components - 13

Recursive Algorithm 1. Create stack S, initially empty 2. Scan the binary image from top to bottom, left to right until encountering a 1 (0). 3. Change that pixel s label to the next unused component label 4. Push the pixel on S (push the coordinates) 5. While S is not empty Pop a pixel p from S For each unlabeled neighbor of p if it s value is 1(0) label it with the current label push it on S Connected components - 14

Topology Challenge How to determine which components of 0 s are holes in which components of 1 s Scan labeled image: When a new label is encountered make it the child of the label on the left Connected components - 15

Solution 2 - row scanning up and down Start at the top row of the image partition that row into runs of 0 s and 1 s each run of 0 s is part of the background, and is given the special background label each run of 1 s is given a unique component label For all subsequent rows partition into runs if a run of 1 s (0 s) has no run of 1 s(0 s) directly above it, then it is potentially a new component and is given a new label if a run of 1 s (0 s) overlaps one or more runs on the previous row give it the minimum label of those runs Let a be that minimal label and let {c i } be the labels of all other adjacent runs in previous row. Relabel all runs on previous row having labels in {c i } with a Connected components - 16

Local relabeling What is the point of the last step? We want the following invariant condition to hold after each row of the image is processed on the downward scan: The label assigned to the runs in the last row processed in any connected component is the minimum label of any run belonging to that component in the previous rows. Note that this only applies to the connectivity of pixels in that part of B already processed. There may be subsequent merging of components in later rows Connected components - 17

Example a a B b B B B B a a B b/a B B B B a a a a B c c c a a B a B B B B a a a a B c/ac/ac/a B a a a a a C a a a B a B B B B a a a a B a a a B a a a a a C a a a a a D a a a a a B a B B B B a a a a B a a a B a a a a a C a a a a a D/B a a a a a a a B B B B If we did not change the c s to a s, then the rightmost a will be labeled as a c and our invariant condition will fail. Connected components - 18

Upward scan A bottom to top scan will assign a unique label to each component we can also compute simple properties of the components during this scan Start at the bottom row create a table entry for each unique component label, plus one entry for the background if there are no background runs on the last row Mark each component of 1 s as being inside the background Connected components - 19

Upward scan For all subsequent rows if a run of 1 s (0 s) (say with label c) is adjacent to no run of 1 s (0 s) on the subsequent row, and its label is not in the table, and no other run with label c on the current row is adjacent to any run of 1 s on the subsequent row, then: create a table entry for this label mark it as inside the run of 0 s (1 s) that it is adjacent to on the subsequent row property values such as area, perimeter, etc. can be updated as each run is processed. if a run of 1 s (0 s) (say, with label c) is adjacent to one or more run of 1 s on the subsequent row, then it is marked with the common label of those runs, and the table properties are updated. All other runs of c s on the current row are also given the common label. Connected components - 20

Example -------aaa ccc---aaa c-c---aaa c-c---aaa ---c--aaa aaaaaaaa changed to a during first pass but c s in first column will not be changed to a s on the upward pass unless all runs are once equivalence is detected Connected components - 21

Example a a B b B B B B a a a a B c c c B a a a a a C a a a a a D a a a a a a a B B B B a a a a B d d d B a a a B d d d B a a a B d d d a a B b B B B B a a a a B c c c B a a a a a C a a a a a B a a a a a a a B B B B a a a a B d d d B a a a B d d d B a a a B d d d a B process row 4 d process row 3 a a B b B B B B a a a a B c c c B a a a a a C a a a a a B a a a a a a a B B B B a a a a B d d d B a a a B d d d B a a a B d d d a a B a B B B B a a a a B a a a B a a a a a C a a a a a B a a a a a a a B B B B a a a a B d d d B a a a B d d d B a a a B d d d C a B process row 2, then 1 d Connected components - 22

Chain Codes Used for efficient boundary representation. First (reference) pixel is recorded. All other pixels by given by their relative displacement index. An example chain code. The reference pixel starting the chain is marked by an arrow: 0007766555555670000006444444442221111112234445652211 Connected components - 23

Integral Images Values ii(i,j) at location (i,j) represent the sums of all the original pixel values left of and above (i,j) Computing Integral Images: 1. Let s(i,j) denote a cumulative row sum, let s(i,-1)=0. 2. Let ii(i,j) be an integral image, let ii(-1,j)=0. 3. Using a single row-by-row scan of the image, calculate s(i,j) and ii(i,j) using the following iterative formulas s(i,j) = s(i,j-1)+f(i,j) ii(i,j) = ii(i-1,j)+s(i,j) Connected components - 24

Integral Images: Computing Sums in an Area The sum of values in area D can be obtained using ii Connected components - 25

Integral Images: Computing Rectangle Features Rectangle-based features are computed from an integral image. These features are computed by subtracting the sum in the shaded rectange(s) from the sum in the non-shaded rectangle(s). Pictures show: (a-b) two-rectangle, (c) three-rectangle, (d) four rectangle. These features can easily be computed at different scales/sizes. Connected components - 26

Gray Image Histograms Histogram h: gray-level frequency distribution of the gray level image f h f (g): # of pixels in f whose gray level is g Cumulative histogram H f (g): # of pixels in F whose gray level is g In Matlab: imhist Connected components - 27

Color Histograms Reduced color representation = C = (R/16) * 256 + (G/16)*16 + (B/16) (This results in a 24 -> 12 bit color depth reduction) This results in a 4096 bin histogram lowest 4 bits are less useful requires less storage faster implementation - easier to compare histograms Connected components - 28

Color Edge Histograms Use edge detector to compute edges in each color band (r x,r y,g x,g y,b x,b y ) Combine the three color bands into the structure matrix, S, to compute the color edge response The edge strength is computed as the larger of the two eigenvalues of S, and the orientation is given by the corresponding eigenvector Histogram bin index is determined using edge orientation (36 bins total), and the bin count is incremented using the edge magnitude Connected components - 29

Connected components - 30 Histogram Matching Histogram Intersection Chi Squared Formula! + " = i b c b c b c i h i h i h i h h h ) ( ) ( )) ( ) ( ( 2 ), ( 2 2 #!! = i b c i b c b c i h i h i h i h h h I )} ( ), ( max{ )} ( ), ( min{ ), (

Examples of edge histograms similar histograms different histograms Similarity (inters.) = 92% X 2 = 61 Connected components - 31 Similarity (inters.) = 22% X 2 = 828

Using Histograms for Background Modeling Use histograms of small regions to model the background: Color histograms computed for small regions of the background image and the current (new) image (reduced color/ 12 bit bit representation) Color edge histograms computed for small regions of the background image and the current image (36 bin quantization) Connected components - 32

Overall Control Divide each frame into 40x40 pixel blocks To make sure that we do not miss objects on grid block boundaries we tile the frame by overlaying two grids, one of which is shifted by 20 pixels in x and y directions Connected components - 33

Criteria for Block Activation On a block by block basis, similarity measures between background and foreground histograms are computed For histogram intersection: If the similarity is below a threshold, T, then the block contains a foreground object and is activated for display For chi squared: If the X 2 measure is greater than a threshold, T χ, then the block contains a foreground object and is activated for display Connected components - 34

Using Edge Histograms for Detection Connected components - 35

Moving Person in a Cluttered Scene Connected components - 36

Color Histogram Based Detection Connected components - 37

Edge Histogram-Based Detection Connected components - 38

Surveillance: Dropping an Object Connected components - 39

Surveillance: Removing an Object Connected components - 40

Surveillance: Interacting People Connected components - 41