Albert M. Vossepoel www.ph.tn.tudelft.nl/~albert
scene image formation sensor pre-processing image enhancement image restoration texture filtering segmentation user analysis classification CBP course: Binary Image Processing 2
CBP course: Binary Image Processing 3 Binary Image Operations Binary images have 1 bit / pixel: 1 = object pixel = non-object pixel (background pixel) Data Image 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Binary Image Operations Binary images are obtained from segmentation procedures such as: Thresholding Edge detection and filling Region analysis Binary Image Operations are used to Correct or improve imperfect segmentation Analysis of connectivity of components Object selection using geometric features CBP course: Binary Image Processing 4
Objects and Components Object = real world thing Component = blob of connected pixels Correspondence by segmentation and binary image processing CBP course: Binary Image Processing 5
The paradox of the square grid 8-connectivity 4-connectivity How many objects? And how many background components? CBP course: Binary Image Processing 6
The paradox of the square grid Object connectivity Background connectivity Object interpretation Background interpretation Consistent + Conflict 4 4 3 objects 8 4 1 object 4 8 3 objects 8 8 1 object 2 components 2 components 1 component 1 component + + CBP course: Binary Image Processing 7
Types of operations Operation type Monadic (one input image) Dyadic (two input images) Pixel operations Identity, Inversion Boolean arithmetic Neighborhood operations Cellular logic operations, Binary morphology Hit-or-miss transforms Object operations Skeleton, Exo-skeleton Propagation, Anchor skeleton CBP course: Binary Image Processing 8
Pixel operations Input image 1 Input image 2 Output image monadic (1 input image): INVERT IDENTITY dyadic (2 input images): AND OR EXOR CBP course: Binary Image Processing 9
Neighborhood operations 3x3 window -> 9 input bits Each operation is equivalent to a table with 2 9 = 512 entries Examples: Erosion Dilation Contour Remove isolated pixels 512* 1 bit CBP course: Binary Image Processing 1
Neighborhood operations Repeated 3x3 cellular logic operations result in a larger nxn operation (n = 5,7,9,..) Examples: dilation erosion opening closing CBP course: Binary Image Processing 11
Object oriented operations Impossible to state beforehand which pixels from input image contribute to output: No fixed neighborhood size.? Examples: skeleton exo-skeleton propagation anchor-skeleton CBP course: Binary Image Processing 12
Dilation (expansion) Expands each object pixel with its neighbors. There are two kinds of dilation, D4 and D8. D4 4D4 4-connected dilation D8 4D8 8-connected dilation CBP course: Binary Image Processing 13
Erosion (shrinking) Removes each object pixel having a neighbor in the background E4 4-connected erosion E8 8-connected erosion CBP course: Binary Image Processing 14
Erosion versus dilation An 8-connected dilation of the object(s) corresponds with an 8-connected erosion of the background, and vice-versa The same holds for the 4-connected case. CBP course: Binary Image Processing 15
Opening consists of a number of erosions followed by the same number of dilations. E4 D4 Applications: separation of connected objects removing small objects (size discrimination) CBP course: Binary Image Processing 16
Closing consists of a number of dilations followed by the same number of erosions D4 E4 Applications: connection of disconnected object parts closing of holes contour smoothing CBP course: Binary Image Processing 17
Contour finding The contour is the set of object pixels that are connected to the background EXOR E4 4-connected background neighbours 8-connected contour 8-connected background neighbours 4-connected contour object E8 EXOR CBP course: Binary Image Processing 18
Conditional erosion: skeleton A conditional erosion is an erosion under one or more of the following conditions: A. Do not remove a last pixel B. Do not break the connectivity C. Do not remove an end pixel {A}: Object to point reduction {B}: Find holes {A,B}: Skeleton without end pixel condition {A,B,C}: Skeleton with end pixel condition CBP course: Binary Image Processing 19
Conditional erosion (continued) Do not remove the last pixel... object to point reduction Note: not always one point per object! CBP course: Binary Image Processing 2
Conditional erosion (continued) Do not break connectivity... find holes CBP course: Binary Image Processing 21
Conditional erosion (continued) Do not remove the last pixel & do not break connectivity... skeleton without end-pixel condition CBP course: Binary Image Processing 22
Conditional erosion (continued) Do not remove the last pixel & do not break connectivity & do not remove an end-pixel... skeleton with end-pixel condition CBP course: Binary Image Processing 23
Skeleton: definition The skeleton of an object is a line connecting points midway between the boundaries A skeleton has the same connectedness ("topology") as the original object. CBP course: Binary Image Processing 24
Digital skeleton Wishes: The skeleton... 1. has the same connectedness as the original object, so it can be used as an representation of the object. 2. is one pixel thick, so crossings and end points can be found in a 3x3 neighborhood. 3. preserves isolated pixels and endpoints, so long objects have long skeletons. 4. is in the middle of the object, so it can be used as an object 'axis'. CBP course: Binary Image Processing 25
Digital skeleton (continued) Wishes may conflict: conflict between: 'one pixel thick' and 'in the middle of the object : conflict between: 'same connectedness' and 'one pixel thick' CBP course: Binary Image Processing 26
Digital skeleton (continued) Many different skeleton algorithms exist, and also a variety of versions of the same algorithm They differ in: handling conflicting wishes noise sensitivity 'cleanness' of the result sensitivity to details of the object contours Well-known algorithms: the Hilditch algorithm for sequential machines and the algorithm by Arcelli and Levialdi for parallel machines CBP course: Binary Image Processing 27
Conditional dilation: exoskeleton The exo-skeleton is a dilation under the condition: 'Do not connect disconnected components' Similar result by inverting the original image and skeletonize it However: Most skeleton programs can only give an 8-connected result, i.e., areas remain 8-connected CBP course: Binary Image Processing 28
Propagation Propagation is a dyadic conditional dilation: 'Dilate a (seed) image recursively within a given (object) mask'. mask (original objects) seed CBP course: Binary Image Processing 29
Propagation: applications Remove objects connected to the image boundary Seed: image boundary Mask: objects Result: object(s) connected to the image boundary CBP course: Binary Image Processing 3
Propagation: applications Close holes Seed: image boundary Mask: background Result: background connected to the image boundary Inverse of propagation result: objects with holes closed CBP course: Binary Image Processing 31
Propagation: applications Find specific objects Seed: pixels of desired objects Mask: all objects Result: desired objects CBP course: Binary Image Processing 32
Watershed Characterise grey-scale topology Note: very noise sensitive pre-processing recommended splitting and merging nearly always necessary CBP course: Binary Image Processing 33
Dilation (expansion) revisited Expands each object pixel with its neighbors. There are two kinds of dilation, D4 and D8. D4 4D4 4-connected dilation D8 4D8 8-connected dilation CBP course: Binary Image Processing 34
Distance transforms Assign to each pixel in a binary image the distance to the nearest background pixel. Circles for different metrics: Chamfer method: a c b a) City block (4-connected) (chamfer: 1,2) b) Chess board (8-connected) (chamfer: 1,1) c) Euclidean d) Octagonal (chamfer 5,7) e) Hexadecagonal (chamfer 5,7,11) d e CBP course: Binary Image Processing 35
Hit-or-Miss transform HoM = (A erosion T 1 ) (A c erosion T 2 ) T 1 T 2 Locate all points in image A where T 1 fits in the object (A) and T 2 fits in the background (A c ), i.e., exact match of template T (T 1,T 2 ) in the image A. Disadvantages: very sensitive to: noise exact shape and size of template to be matched CBP course: Binary Image Processing 36