Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image Sampling and Quantization

Similar presentations


Presentation on theme: "Image Sampling and Quantization"— Presentation transcript:

1 Image Sampling and Quantization
Representing Digital Images The notation introduced in the preceding paragraph allows us to write the complete M*N digital image in the following compact matrix. This digitization process requires decisions about values for M, N, and for the number, L, of discrete gray levels allowed for each pixel. There are no requirements on M and N, other than that they have to be positive integers. Due to processing, storage, and sampling hardware considerations, the number of gray levels typically is an integer power of 2: L = 2k.

2 Representing digital images

3 Each pixel have an value equal f that is gray value

4 Image Sampling and Quantization
The number, b, of bits required to store a digitized image is b = M * N * k. When M=N, this equation becomes b = N2k. Table 2.1 shows the number of bits required to store square images with various values of N and k.

5

6 Pixels relations N4 connectivity (b) D – connectivity together type called 8- connectivity

7 4-adjacency: if q is in the set N4(p).
m-adjacency: if if q is in the set N4(p), or if q is in the set ND(p) and the set N4(p)∩N4(q) has no pixels whose values are from V.

8 3 1 2 1 2 2 0 2 1 2 1 1 1 0 1 2 لايوجد مسار بين P و q فى حالة N4
Example let v = {0,1} compute 4,8 and m-path between p and q q لايوجد مسار بين P و q فى حالة N4 p

9 3 1 2 1 2 2 0 2 1 2 1 1 1 0 1 2 اقل مسار بين P و q فى حالة N8 = 4
Example let v = {0,1} compute 4,8 and m-path between p and q q اقل مسار بين P و q فى حالة N8 = 4 p

10 m-adjacency :if q is in the set N4(p), or
m- path the length of this path is 5 q p m-adjacency :if q is in the set N4(p), or if q is in the set ND(p) and the set N4(p)∩N4(q) has no pixels whose values are from V.

11 3 1 2 1 2 2 0 2 1 2 1 1 1 0 1 2 يوجد مسار بين P و q فى حالة N4 = 6
Example let v = {1,2} compute 4,8 and m-path between p and q q يوجد مسار بين P و q فى حالة N4 = 6 p

12 q يوجد مسار بين P و q فى حالة N8 = 4 p

13 3 1 2 1 2 2 0 2 1 2 1 1 1 0 1 2 يوجد مسار بين P و q فى حالة m = 6
q يوجد مسار بين P و q فى حالة m = 6 ”لاتاخذ الاقطار الا اذا توافرت الشروط“ p

14 Consider the tow image S1 and S2 for v {1} determine whether s1 and S2 connected (4 or 8 or m) ?

15 S1 and S2 are not 4- connected because q is not in set N4(p), S1 and S2 are 8- connected because q is in set N8(p), S1 and S2 are m- connected because q is in set ND(p) and set N4(p) intersection N4(q) is empty S1 S2 q p

16 * * * Labeling of connected components
Scan an image pixel by pixel from left to right and form top to bottom 4-connected components * * * r t p

17 When we get p point points r and t have already been countered ( and label if they were 1’s )
* If the value of p=0 then move on the next scanning position If the value of p=1 then if r=0 and t=0 then assign a new label to p else

18 If r=1 ant t=0 then assign the label of r to p
Else If r=0 and t=1 then assign the value t to p Else if r =1 and t=1 and have different label then assign one of the label to p

19 Note ( that the two label are equivalent ) else If r=1 ant t=1 and have the same e label then assign that label to p

20 The label 8- connected components we process the same way but the to upper diagonal neighbors of p denoted by q and s , also have to be examined r * * * * * q s t p

21 Relations , equivalence and transitive closure A binary (two) relation R on a set A is a set of pairs of elements from A For example the set of pair of point A = { p1 ,p2, p3 ,p4 } arranged as p1 p2 p3 p4

22 And define the relation 4- connected in case R is the set of pairs of point A that are 4- connected that is R = {( p1 ,p2) , (p2,p1) ,(p1,p3) ,(p3,p1) } A binary relation R over set A is said to be

23 (A) reflexive if for each a in A , a R a
(b) symmetric if for each a and b in A , a R b implies b R a , and (c) transitive if for a,b and c in in A , a R b and b R c implies a R c A relation satisfying these three properties is called equivalence relation

24 Distance measures For pixels p ,q and z with coordinates (x,y) , (s,t) and (u,v) respectively , D is a distance function or metric if

25 The Euclidean distance between p and q define as:
The 4- distance also called city block distance between p and q is defines as

26 Note the pixels with D4 <= 2 from (x,y) (the center point) from the folloing contours
2 1 2

27 the pixels with with D4 = 1 are the 4- neighbors of (x,y)
the 8- distance (also called chessboard distance between p and q defined as:

28 Note the pixels with D8 <= 2 from (x,y) (the center point) from the folloing contours

29 the pixels with with D8 = 1 are the 8- neighbors of (x,y)
For m connectivity the value of distance ( length of the path) between two pixels depends on the values of the pixels along the path for instance consider the following arrangement of pixels

30 p3 p4 p1 p2 p Assume that p , p2 and p4 have avalue of 1 and that p1 and p3 can have a value of 0 or 1 if only connectivity of pixels valued 1 is

31 Allowed and p1 and p3 are 0 , the m-distance between p and p4 is 2
p3 p4 p1 p2 p 1 1 1

32 If either p1 or p3 is 1 , the distance is 3
p3 p4 p1 p2 p 1 1 1

33 If both p1 and p3 are 1 , the distance is 4
p3 p4 p1 p2 p 1 1 1 1

34 Image geometry Some basic transformation Translation To translate a point with coordinates (x,y,z) to a new location by using displacements (x0,y0,z0) the translation is accomplished by using the equations:

35 Z (x*,y*,z*) v (x0,y0,z0) X Y

36 X* = x+x0 Y* = y+y0 Z* = z+z0 Where (x*,y*,z*) are the coordinates of the new point. This equations can expressed in matrix form as

37

38 Transformation Matrix
Note the use of square matrix simplifies the notational representation of this process we can written the previous equation as Transformation Matrix

39 Similarly to translate the point (x,y) to a new point
x* = x + x0 y* = y + y0 Can be expressed in matrix form as:

40 Scaling Scaling by factors sx,sy and sz along the X,Y and Z axes is given by thr transformation matrix

41 Rotation Rotation in 3D is more complex than 2D . In 2D a rotation is prescribed by an angle of rotation and center of rotation P 3D rotation require the prescription of an angle of rotation and an axis of rotation.

42 Rotation

43

44 Rotation a bout Z axis (x*,y*,z*)= (x,y,z) Where

45 Rotation a bout Z axis in matrix form

46 Rotation a bout Y axis (x*,y*,z*)= (x,y,z) Where

47 Rotation a bout Y axis in matrix form

48 Rotation a bout X axis (x*,y*,z*)= (x,y,z) Where

49 Rotation a bout X axis in matrix form

50 Example Rotation original Angle 45 : rotation Angle 90 : rotation

51 Example :Rotation & scaling

52 Example Translation original X 30, y 45 translation

53 Translation & rotation
Rotation  translation

54 f(x) (2,5) 5 3 (1,3) X 1 2 f (x) = m x + b

55 Z (x,y,z) c (0,0,0) X b a Y


Download ppt "Image Sampling and Quantization"

Similar presentations


Ads by Google