Jan 8 W04/Lecture 2 1ECE 178: Introduction (contd.)Lecture Notes #2: January 8, 2004 Section 2.4 –sampling and quantization Section 2.5 –relationship between pixels,connectivity analysisJan 8W04/Lecture 2 2Announcements (01/08/04) 01/09/2004: Discussion sessions on Matlab Note that the HW#1 due on Jan 16. HW#2 will be due on Jan 23. Today:– A quick introduction to MATLAB– Basic relationship between pixels (Section 2.5)– Image sampling and quantization (Section 2.4,notes)– Linear systems review (time permitting)Jan 8W04/Lecture 2 3Light and the EM SpectrumJan 8W04/Lecture 2 4WavelengthJan 8W04/Lecture 2 5Digial Image AcquisitionJan 8W04/Lecture 2 6Sampling and QuantizationJan 8W04/Lecture 2 7Sampling & Quantization (contd.)Jan 8W04/Lecture 2 8Digital Image: RepresentationJan 8W04/Lecture 2 9Image Dimension: NxN; k bits per pixel.Storage RequirementJan 8W04/Lecture 2 10Spatial ResolutionJan 8W04/Lecture 2 11Re-sampling …Jan 8W04/Lecture 2 12Quantization: Gray-scale resolutionJan 8W04/Lecture 2 13…false contouringJan 8W04/Lecture 2 14Sampling and AliasingJan 8W04/Lecture 2 15Additional Reading Chapter 1, Introduction Chapter 2, Sections 2.1-2.4– We will discuss sampling and quantization in detaillater (Week 2) Next:– some basic relationships between pixels (Section2.5)– MATLAB: an overview– A quick tour of linear systems (note, G&Wadditional reading)Jan 8W04/Lecture 2 16Relationship 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).Jan 8W04/Lecture 2 17Pixel 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}.Jan 8W04/Lecture 2 18Connectivity-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.Jan 8W04/Lecture 2 19Connected 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.Jan 8W04/Lecture 2 204-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.Jan 8W04/Lecture 2 21ExerciseDevelop a similar algorithm for 8-connectivity.Jan 8W04/Lecture 2 22Problems 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..Jan 8W04/Lecture 2 23Related questions Can you “tile” a plane with a pentagon?Jan 8W04/Lecture 2 24Distance Measures What is a Distance Metric? For pixels p,q, and z, with coordinates (x,y), (s,t),and (u,v), respectively:Dpq Dpq p qDpq DqpDpz Dpq Dqz(,) ( (,) )(,) (, )(,) (,) (,) === +0 0 iffJan 8W04/Lecture 2 25Distance Measures Euclidean City Block ChessboardDpq x s y te(,) ( ) ( )= + 22Dpq x s yt4(,)= + Dpq x sy t8( , ) max( , )= 2222221112210122111222222Jan 8W04/Lecture 2 26Matlab: a quick introduction http://varuna.ece.ucsb.edu/ece178/matlabip.htm A detailed document is available on-line More on MATLAB during the discussion
View Full Document