Download presentation
Presentation is loading. Please wait.
Published byDustin Gilmore Modified over 6 years ago
1
COMP 9517 Computer Vision Binary Image Analysis 4/15/2018
COMP 9517 S2, 2009
2
Binary Image Analysis How to do this? ? 4/15/2018 COMP 9517 S2, 2009
3
Binary Image Analysis How to obtain binary images from scale-level images? How to extract connected groups of pixels (components)? How to process the separate components? How to extract properties of components for use in high-level tasks? 4/15/2018 COMP 9517 S2, 2009
4
Binary Image Definition: A binary image is a digital image with all pixel values 0 or 1 Foreground: a subset of image pixels that are of interest in an image analysis task Background: the rest of the image A binary image B can be obtained from a gray-scale image or colour image through a selection operator: Thresholding: subset of gray tones or colour space Classification, segmentation, etc 4/15/2018 COMP 9517 S2, 2009
5
Binary Image Example A gray-scale image contains the character “C”
Threshold t=200 to obtain a binary image 1s denote foreground pixels, 0s background pixels 1 4/15/2018 COMP 9517 S2, 2009
6
Binary Image Analysis Thresholding: convert gray scale image to binary image Labelling: connected component labelling Counting: object counting Thinning & Thickening: join and/or separate components Component Properties: extract features for higher level processes 4/15/2018 COMP 9517 S2, 2009
7
Applications Document analysis Industrial machine vision
Counting, recognition, localisation and inspection tasks 4/15/2018 COMP 9517 S2, 2009
8
Thresholding Binary image can be obtained from gray-scale images by thresholding Choose foreground and background based on the distribution of gray tones Types of thresholding: threshold above: p ≥ the threshold t threshold below: p < t threshold inside: t1 ≤ p < t2 threshold outside: p < t1 or p ≥ t2 4/15/2018 COMP 9517 S2, 2009
9
How to choose the thresholds
The basis for choosing a threshold is the histogram of the gray-tone image The histogram h of gray-tone image I is defined by Where m spans the gray-level values. 4/15/2018 COMP 9517 S2, 2009
10
Compute A Histogram Compute the histogram H of gray-scale image I
Procedure histogram(I,H) { //Initialise the bins of the histogram to zero. for i=0 to MaxVal H[i] = 0; //Compute values by accumulation. for r=0 to MaxRow for c=0 to MaxCol { grayval = I[r,c]; H[grayval] = H[grayval] + 1; } 4/15/2018 COMP 9517 S2, 2009
11
Threshold from Histogram
Bimodal: one mode corresponding to dark pixels the other one corresponding to light pixels choose any value in the valley between two modes Overlapped modes – more difficult t t 4/15/2018 COMP 9517 S2, 2009
12
Pixel and Neighbourhoods
Not only the value of a pixel but also its neighbours are used 4-neighbours and 8-neighbours N4[r,c]: {[r-1,c],[r+1,c],[r,c-1], and [r,c+1]} N8[r,c]: N4[r,c] + {[r-1,c-1], [r-1,c+1], [r+1, c-1], and [r+1,c-1]} A pixel [r’,c’] neighbours a pixel [r,c] if [r’,c’] lies in the selected type of neighbourhood of [r,c] N W * E S NW N NE W * E SW S SE 4/15/2018 COMP 9517 S2, 2009
13
Masks Mask: a set of pixel positions and corresponding values called weights Origin of a mask: usually the centre of the mask 1 1 2 4 1 4/15/2018 COMP 9517 S2, 2009
14
Applying a Mask Convolution: apply a mask to an image
yields same size output image for each pixel, place the mask on the image with the mask origin on that pixel value of pixel under the mask multiplied by the corresponding mask weight summed up to a single output value for the pixel 4/15/2018 COMP 9517 S2, 2009
15
Example of Applying a Mask
40 80 640 800 1120 1280 40 50 70 80 1 2 4 the sum of the weights 4/15/2018 COMP 9517 S2, 2009
16
Example of Applying a Mask
40 80 *1 *2 *4 40 80 640 40 80 40 80 *1 *2 *4 640 800 1 2 4 4/15/2018 COMP 9517 S2, 2009
17
Connected Component Labelling
Definition: a connected component labelling of a binary image B is a labelled image LB in which the value of each pixel is the label of its connected component. 1 1 2 3 4/15/2018 COMP 9517 S2, 2009
18
Recursive Labelling B is the original binary image;
LB will be the labelled connected component image. Recursive_connected_components(B, LB) { LB = negate(B); label = 0; Find_components(LB, label); } Find_components(LB,label){ for (r=0 to MaxRow) for (c=0 to MaxCol) if (LB[r, c]==-1){ label = label + 1; Search(LB, label, r, c); Search(LB, label, r, c) { LB[r, c] = label; Nset = neighbours(r, c); for ([r’, c’] in Nset) if (LB[r’, c’]==-1) Search(LB, label, r, c); 4/15/2018 COMP 9517 S2, 2009
19
Recursive Labelling 4/15/2018 COMP 9517 S2, 2009 1 2 * 3 4 1 -1 1 -1 1
1 -1 1 -1 1 -1 1 2 -1 1 2 -1 4/15/2018 COMP 9517 S2, 2009
20
Binary Image Morphology
Morphology refers to form, structure and the shape of a region in computer vision Mathematical morphology: set operations Structuring element: a shape presented by a binary image, any size and arbitrary structure Common structuring element: Box, Disk & Ring 1 1 1 4/15/2018 COMP 9517 S2, 2009
21
Basic Morphology Operations
Dilation: enlarges a region Erosion: makes a region smaller Closing: closes up internal holes and eliminate bays on boundaries Opening: gets rid of juts 4/15/2018 COMP 9517 S2, 2009
22
Dilation Definition: the dilation of a binary image B by structuring element S is denoted by and is defined by S is swept over B When the origin of S touches 1 in B, S is ORed to the output image 4/15/2018 COMP 9517 S2, 2009
23
Dilation 1 1 1 S 1 1 1 1 B 1 1 1 4/15/2018 COMP 9517 S2, 2009
24
Erosion Definition: the erosion of a binary image B by structuring element S is denoted by B S and is defined by B S S is swept over B When every element of S covers a 1-pixel in B, the pixel in B corresponding to the origin of S is ORed to the output image 4/15/2018 COMP 9517 S2, 2009
25
Erosion 1 1 S 1 1 1 1 B 1 1 4/15/2018 COMP 9517 S2, 2009
26
Closing Definition: The closing of a binary image B by structuring element S is denote by and is defined by 1 S 1 1 1 B 4/15/2018 COMP 9517 S2, 2009
27
Opening Definition: the opening of a binary image B by structuring element S is denoted by and is defined by 1 S 1 1 1 B 4/15/2018 COMP 9517 S2, 2009
28
Conditional Dilation Remove noise by erosion, but want to keep entire components Definition: give an original binary image B, a processed binary image C and a structuring element S, let and The conditional dilation of C by S with respect to B is defined by where the index m is the smallest index satisfy 4/15/2018 COMP 9517 S2, 2009
29
Conditional Dilation C is repeatedly dilated by S, and each result is reduce to only the pixels that were 1s in B 1 1 V S 1 1 1 1 B C AND 4/15/2018 COMP 9517 S2, 2009
30
Other Morphological Algorithms
Boundary extraction 4/15/2018 COMP 9517 S2, 2009
31
Basic Morphological Algorithms
Region Filling 4/15/2018 COMP 9517 S2, 2009
32
Applications of Morphology
Opening & closing to separate components and remove holes Thresholding Opening + Closing 4/15/2018 COMP 9517 S2, 2009
33
Applications of Morphology
Industrial inspection – identify defects hole_ring, hole_mask, gear_body, sampling_ring_spacer, sampling_ring_width, tip_spacing , defect_cue a b c d f g h e 4/15/2018 COMP 9517 S2, 2009
34
Applications of Morphology
Feature extraction Extract shape corners Original image B Resultant opening R Corner image C=B-R 4/15/2018 COMP 9517 S2, 2009
35
Region Properties Properties of the regions as input to higher- level procedures for decision making Area: Centroid: Perimeter 4/15/2018 COMP 9517 S2, 2009
36
Region Properties Perimeter length Circularity Mean radial distance
Standard deviation of radial distance 4/15/2018 COMP 9517 S2, 2009
37
Region Properties Bounding box and extremal points
Extremal axis length 4/15/2018 COMP 9517 S2, 2009
38
Region Properties Second-order row moment Second-order column moment
Second-order mixed moment 4/15/2018 COMP 9517 S2, 2009
39
Region Adjacency Graphs
Definition: a region adjacency graph(RAG) is a graph in which each node represents a region of the image, and an edge connects two nodes if the two regions are adjacent. 1 2 -1 3 -2 -3 1 -1 2 -3 3 -2 4/15/2018 COMP 9517 S2, 2009
40
References Shaoo, P.K., and others A survey of thresholding techniques. Compu. Vision, Graphics, and Image Proc. V.41: Rosefeld,A., and J.L. Pfaltz, Sequential operations in digital picture processing. Journal of the Association for Computing Machinery, Vol. 13: Serra, J Image Analysis and Mathematical Morphology. Academic Press, New York. 4/15/2018 COMP 9517 S2, 2009
41
Acknowledgement Some material, including images and tables, were drawn from the textbook and Digital Image Processing by Gonzalesz and Woods. 4/15/2018 COMP 9517 S2, 2009
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.