1Introduction (contd.) 1ECE 178: Introduction (contd.)Lecture Notes #2: more basics Section 2.4 –sampling and quantization Section 2.5 –relationship between pixels,connectivity analysisIntroduction (contd.) 2AnnouncementsToday:– A quick introduction to MATLAB– Basic relationship between pixels (Section 2.5)– Image sampling and quantization (Section 2.4,notes)2Introduction (contd.) 3Light and the EM SpectrumIntroduction (contd.) 4Digial Image Acquisition3Introduction (contd.) 5Sampling and QuantizationIntroduction (contd.) 6Sampling & Quantization (contd.)4Introduction (contd.) 7Digital Image: RepresentationIntroduction (contd.) 8Image Dimension: NxN; k bits per pixel.Storage Requirement5Introduction (contd.) 9Spatial ResolutionIntroduction (contd.) 10Re-sampling…6Introduction (contd.) 11Quantization: Gray-scale resolutionIntroduction (contd.) 12…false contouring7Introduction (contd.) 13Sampling and AliasingIntroduction (contd.) 14Additional Reading Chapter 1, Introduction Chapter 2, Sections 2.1-2.4– We will discuss sampling and quantization in detaillater Next:– some basic relationships between pixels (Section2.5)8Introduction (contd.) 15Relationship between pixels Neighbors of a pixel– 4-neighbors (N,S,W,E pixels) == N4(p). A pixel p atcoordinates (x,y) has four horizontal and four verticalneighbors:• (x+1,y), (x-1, y), (x,y+1), (x, y-1)– You can add the four diagonal neighbors to give the 8-neighbor set. Diagonal neighbors == ND(p).– 8-neighbors: include diagonal pixels == N8(p).Introduction (contd.) 16Pixel ConnectivityConnectivity -> to trace contours, define object boundaries,segmentation.In order for two pixels to be connected, they must be“neighbors” sharing a common property—satisfy somesimilarity criterion. For example, in a binary image withpixel values “0” and “1”, two neighboring pixels are saidto be connected if they have the same value.Let V: Set of gray level values used to defineconnectivity; e.g., V={1}.9Introduction (contd.) 17Connectivity-contd. 4-adjacency: Two pixels p and q with valuesin V are 4-adjacent if q is in the set N4(p). 8-adjacency: q is in the set N8(p). m-adjacency: Modification of 8-A to eliminatemultiple connections.– q is in N4(p) or– q in ND(p) and N4(p) Ç N4(q) is empty.Introduction (contd.) 18Connected components Let S represent a subset of pixels in animage. If p and q are in S, p is connected to q in S ifthere is a path from p to q entirely in S. Connected component: Set of pixels in S thatare connected; There can be more than onesuch set within a given S.10Introduction (contd.) 194-connected components– both r and t = 0; assign new label to p;– only one of r and t is a 1. assign that label to p;– both r and t are 1.• same label => assign it to p;• different label=> assign one of them to p andestablish equivalence between labels (they arethe same.)prtp=0: no action;p=1: check r and t.Second pass over the image to merge equivalent labels.Introduction (contd.) 20ExerciseDevelop a similar algorithm for 8-connectivity.11Introduction (contd.) 21Problems with 4- and 8-connectivity Neither method is satisfactory.– Why? A simple closed curve divides a plane intotwo simply connected regions.– However, neither 4-connectivity nor 8-connectivitycan achieve this for discrete labelled components.– Give some examples..Introduction (contd.) 22Related questions Can you “tile” a plane with a pentagon?12Introduction (contd.) 23Distance Measures What is a Distance Metric? For pixels p,q, and z, with coordinates (x,y), (s,t),and (u,v), respectively:D p q D p q p qD p q D q pD p z D p q D q z( , ) ( ( , ) )( , ) ( , )( , ) ( , ) ( , )! = ==" +0 0 iff Introduction (contd.) 24Distance Measures Euclidean City Block ChessboardD p q x s y te( , ) ( ) ( )= ! + !2 2D p q x s y t4( , ) = ! + !D p q x s y t8( , ) max( , )= ! !2 2 2 2 22 1 1 1 22 1 0 1 22 1 1 1 22 2 2 2 213Introduction (contd.) 25Matlab: a quick introduction http://www.ece.ucsb.edu/~manj/ece178/matlabip.htm A detailed document is available on-line More on MATLAB during the discussion session(s).Introduction (contd.)
View Full Document