Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mathematical tools in DIP


Published on

This presentation gives information on basic mathematical tools required in digital image processing.

Published in: Engineering
  • Be the first to comment

Mathematical tools in DIP

  1. 1. Digital Image Processing Mathematical tools used in DIP By Dr. K. M. Bhurchandi
  2. 2. Array versus Matrix Operations β€’ Consider two 2 x 2 images π‘Ž11 π‘Ž12 π‘Ž21 π‘Ž22 and 𝑏11 𝑏12 𝑏21 𝑏22 β€’ Array Product is: π‘Ž11 𝑏11 π‘Ž12 𝑏12 π‘Ž21 𝑏21 π‘Ž22 𝑏22 β€’ Matrix Product is: π‘Ž11 𝑏11 + π‘Ž12 𝑏21 π‘Ž11 𝑏12 + π‘Ž12 𝑏22 π‘Ž21 𝑏11 + π‘Ž22 𝑏21 π‘Ž21 𝑏12 + π‘Ž22 𝑏22
  3. 3. β€’ Array operation involving one or more images is carried out on a pixel-by-pixel basis. β€’ Ex. i) Raising an image to a power. Individual pixel is raised to that power. ii) Dividing an image by another: Division is between corresponding pixel pairs.
  4. 4. Linear versus Nonlinear Operations β€’ General operator, H, that produces an output image, g(x, y), for a given input image, f (x, y): H[f(x, y)] = g(x, y) β€’ H is said to be a linear operator if H[aifi(x,y) + ajfj(x,y)] = aiH[fi(x,y)] + ajH[fj(x,y)] = aigi(x,y) + ajgj(x,y)β€”Eq.(i) where, ai, aj – arbitrary constants fi(x,y), fj(x,y) – images of same size.
  5. 5. β€’ Suppose H is the sum operator, β€’ [π‘Žπ‘–π‘“π‘– π‘₯, 𝑦 + π‘Žπ‘—π‘“π‘—(π‘₯, 𝑦)] = π‘Žπ‘– 𝑓𝑖(π‘₯, 𝑦) + π‘Žπ‘— 𝑓𝑗(π‘₯, 𝑦) = π‘Žπ‘– 𝑓𝑖 π‘₯, 𝑦 + π‘Žπ‘— 𝑓𝑗(π‘₯, 𝑦) = π‘Žπ‘– 𝑔𝑖 π‘₯, 𝑦 + π‘Žπ‘—π‘”π‘—(π‘₯, 𝑦) Thus, operator is linear.
  6. 6. β€’ Consider max operation, β€’ Let f1 = 0 2 2 3 , f2 = 6 5 4 7 , a1 = 1, a2 = -1. β€’ To Test Linearity, β€’ LHS of eq(i): π‘šπ‘Žπ‘₯ 1 0 2 2 3 + (βˆ’1) 6 5 4 7 = βˆ’2 β€’ RHS of eq(i): 1 π‘šπ‘Žπ‘₯ 0 2 2 3 + βˆ’1 π‘šπ‘Žπ‘₯ 6 5 4 7 = -4 β€’ LHS β‰  RHS β€’ So, max is non-linear operation.
  7. 7. Arithmetic Operations β€’ Arithmetic operations are array operations that are carried out between corresponding pixel pairs. β€’ Four arithmetic operations: s(x, y) = f(x, y) + g(x, y) d(x, y) = f(x, y) - g(x, y) p(x, y) = f(x, y) * g(x, y) v(x, y) = f(x, y) / g(x, y) Where, x = 0,1,2,…,M-1, y = 0,1,2,….N-1. All images are of size M (rows) x N (columns).
  8. 8. Set and Logical Operations β€’ Basic Set operation β€’ Let A - set composed of ordered pairs of real numbers. β€’ If pixel a = (x,y), is an element of A β€’ If a is not an element of A β€’ Set with no elements is called the null or empty set
  9. 9. β€’ If every element of a set A is also an element of a set B, then A is said to be a subset of B β€’ Union of two sets A and B β€’ Intersection of two sets A and B β€’ Two sets A and B are disjoint or mutually exclusive if they have no common elements
  10. 10. β€’ The set universe, U, is the set of all elements in a given application. β€’ complement of a set A is the set of elements that are not in A β€’ difference of two sets A and B,
  11. 11. Illustration of Set Concept
  12. 12. Set operations on gray- scale images β€’ a) Original image b) Image Negative c) Union of (a) & constant image
  13. 13. Illustration of Logical Operators
  14. 14. Spatial Operations β€’ Spatial operations are performed directly on the pixels of a given image. o (1) single-pixel operations, o (2) neighborhood operations, & o (3) geometric spatial transformations. β€’ Single-pixel operations s = T(z) o z - intensity of a pixel in the original image o s - (mapped) intensity of the corresponding pixel in the processed image.
  15. 15. β€’ Neighborhood operations
  16. 16. β€’ We can express the operation in equation form as β€’ where r and c are the row and column coordinates of the pixels whose coordinates are members of the set Sxy.
  17. 17. β€’ Geometric spatial transformations β€’ They modify the spatial relationship between pixels in an image. β€’ a.k.a. rubber-sheet transformations. β€’ They consists of two basic operations: o (1) spatial transformation of coordinates and o (2) intensity interpolation that assigns intensity values to the spatially transformed pixels. β€’ The transformation of coordinates may be expressed as o (v, w) - pixel coordinates in the original input image o (x, y) - the corresponding pixel coordinates in the transformed output image.
  18. 18. β€’ One of the most commonly used spatial coordinate transformations is the affine transform β€’ Its General Form β€’ This transformation can scale, rotate, translate, or sheer a set of coordinate points, depending on the value chosen for the elements of matrix T.
  19. 19. β€’ forward mapping, consists of scanning the pixels of the input image and, at each location, (v, w), computing the spatial location, (x, y), of the corresponding pixel in the output image. β€’ inverse mapping, scans the output pixel locations and, at each location, (x, y), computes the corresponding location in the input image using (v, w, 1) = T-1(x, y, 1) β€’ It then interpolates using either of nearest neighbor, bilinear, and bicubic interpolation techniques.
  20. 20. Vector and Matrix Operations β€’ Color images are formed in RGB color space by using red, green, and blue component images. β€’ Each pixel of an RGB image has 3 components, which can be organized in the form of a column vector.
  21. 21. β€’ Euclidean distance, D, between a pixel vector z and an arbitrary point a in n-dimensional space is defined as the vector product β€’ This is a generalization of the 2-D Euclidean distance β€’ Sometimes is referred to as a vector norm, denoted by 𝑧 βˆ’ π‘Ž .
  22. 22. β€’ An image of size M X N can be represented as a vector of dimension MN X 1. β€’ A broad range of linear processes can be applied to such images by using notation g = Hf + n o f – MN X 1 vector representing Input image o n - MN X 1 vector representing M X N noise pattern o g - MN X 1 vector representing affected image o H – MN X MN matrix representing linear process applied to input image
  23. 23. Image Transforms β€’ Approaches discussed till now work directly on spatial domain. β€’ Some tasks are best formulated by transforming the input images, carrying the specified task in a transform domain, and applying the inverse transform to return to the spatial domain. β€’ General form of 2-D linear transforms is given by: …..eq.(1) o f(x, y) - is the input image o r(x, y, u, v) - is called the forward transformation kernel o u – 0,1,2,…..,M-1 o v – 0,1,2,…..,N-1
  24. 24. β€’ General approach for operating in the linear transform domain. o x, y - spatial variables o u, v – transform variables o M, N - row and column dimensions of f. o T(u, v) - is called the forward transform of f(x, y).
  25. 25. β€’ Given T(u, v) , we can recover f(x, y) using the inverse transform of T(u, v), ….eq.(2) o x – 0,1,2,…..,M-1 o y – 0,1,2,…..,N-1 o s(x, y, u, v) - is called the inverse transformation kernel.
  26. 26. β€’ (a) Image corrupted by sinusoidal interference. β€’ (b) Magnitude of the Fourier transform. (a) (b) (c) (d) β€’ (c) Mask (Filter) used to eliminate the energy bursts. β€’ (d) Result of computing the inverse of the modified Fourier transform.
  27. 27. β€’ The forward transformation kernel is said to be separable if β€’ Also the kernel is said to be symmetric if r1(x, y) is functionally equal to r2(x, y). β€’ Identical comments apply to the inverse kernel by replacing r with s in the preceding equations. β€’ Thus, forward & inverse kernels are given by:
  28. 28. β€’ Substituting these kernels into the general transform formulations, we get the Discrete Fourier transform pair:
  29. 29. β€’ Fourier (forward and inverse) kernels are o separable and symmetric o allow 2-D transforms to be computed using 1-D transforms & β€’ f(x, y) is a square image of size M x M β€’ Then, eq.(1) & eq.(2) can be expressed in matrix form as o F – M x M matrix with element of input image f(x, y). o A – M x M matrix with elements aij = r1(x, y) o T – resulting M x M matrix with values T(u, v), u, v = 0,1,2….., M-1
  30. 30. β€’ To obtain the inverse transform, we pre- and post- multiply above equation by an inverse transformation matrix B. β€’ If B = A-1 β€’ F can be recovered completely from its forward transform. β€’ If B β‰  A-1 β€’ Approximation is