Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image Processing Lab Section 28/3/2016 Prepared by Mahmoud Abdelsatar Demonstrator at IT Dep. Faculty of computers and information Assuit University.

Similar presentations


Presentation on theme: "Image Processing Lab Section 28/3/2016 Prepared by Mahmoud Abdelsatar Demonstrator at IT Dep. Faculty of computers and information Assuit University."— Presentation transcript:

1 Image Processing Lab Section 28/3/2016 Prepared by Mahmoud Abdelsatar Demonstrator at IT Dep. Faculty of computers and information Assuit University

2 Topics Spatial Filtering Linear Filtering Nonlinear Filtering Enhancement using Arithmetic/Logic Operations

3 Spatial filtering use filter (can also be called as mask/kernel/template or window) the values in a filter subimage are referred to as coefficients, rather than pixel. our focus will be on masks of odd sizes, e.g. 3x3, 5x5, …

4 Spatial Filtering Process simply move the filter mask from point to point in an image. at each point (x,y), the response of the filter at that point is calculated using a predefined relationship.

5 Linear Filtering Linear Filtering of an image f of size MxN filter mask of size mxn is given by the expression where a = (m-1)/2 and b = (n-1)/2 To generate a complete filtered image this equation must be applied for x = 0, 1, 2, …, M-1 and y = 0, 1, 2, …, N-1

6 Smoothing Spatial Filters used for blurring and for noise reduction blurring is used in preprocessing steps, such as ▫removal of small details from an image prior to object extraction ▫bridging of small gaps in lines or curves noise reduction can be accomplished by blurring with a linear filter and also by a nonlinear filter

7 Smoothing Linear Filters replacing the value of every pixel in an image by the average of the gray levels in the neighborhood will reduce the “ sharp ” transitions in gray levels. sharp transitions ▫random noise in the image ▫edges of objects in the image thus, smoothing can reduce noises (desirable) and blur edges (undesirable)

8 3x3 Smoothing Linear Filters box filterweighted average the center is the most important and other pixels are inversely weighted as a function of their distance from the center of the mask

9 General form : smoothing mask filter of size mxn (m and n odd) summation of all coefficient of the mask

10 Example a). original image 500x500 pixel b). - f). results of smoothing with square averaging filter masks of size n = 3, 5, 9, 15 and 25, respectively. Note: ▫big mask is used to eliminate small objects from an image. ▫the size of the mask establishes the relative size of the objects that will be blended with the background.

11 Example we can see that the result after smoothing and thresholding, the remains are the largest and brightest objects in the image. original imageresult after smoothing with 15x15 averaging mask result of thresholding

12 Example Apply average filtering on the image f given that the size of the mask(window) is 3x3 and image pixels have the gray values in the range [0,7]. 1100 6677 7777 5544 1/9 Image Mask

13 Example Apply average filtering on the image f given that the size of the mask(window) is 3x3 and image pixels have the gray values in the range [0,7].The mask is weighted and its value as shown in the mask matrix. 1100 6677 7777 5544 1/162/16 1/16 2/164/162/16 1/162/161/16 Image Mask

14 14 Order-Statistics Filters (Nonlinear Filters) the response is based on ordering (ranking) the pixels contained in the image area encompassed by the filter example ▫median filter : R = median{z k |k = 1,2, …,n x n} ▫max filter : R = max{z k |k = 1,2, …,n x n} ▫min filter : R = min{z k |k = 1,2, …,n x n} note: n x n is the size of the mask

15 15 Median Filters replaces the value of a pixel by the median of the gray levels in the neighborhood of that pixel (the original value of the pixel is included in the computation of the median) impulse noise  salt and pepper noise provide excellent noise-reduction capabilitiesless blurring than linear smoothing filters of similar size.quite popular because for certain types of random noise (impulse noise  salt and pepper noise), they provide excellent noise-reduction capabilities, with considering less blurring than linear smoothing filters of similar size.

16 Median Filters forces the points with distinct gray levels to be more like their neighbors. isolated clusters of pixels that are light or dark with respect to their neighbors, and whose area is less than n 2 /2 (one-half the filter area), are eliminated by an n x n median filter. eliminated = forced to have the value equal the median intensity of the neighbors. larger clusters are affected considerably less

17 Example : Median Filters

18 Example Apply median filtering on the image f given that the size of the mask(window) is 3x3 and image pixels have the gray values in the range [0,7]. 1100 6677 7777 5544 11 1 111 111 Image Mask

19 Example Apply min filtering on the image f given that the size of the mask(window) is 3x3 and image pixels have the gray values in the range [0,7]. 1100 6677 7777 5544 11 1 111 111 Image Mask

20 Example Apply max filtering on the image f given that the size of the mask(window) is 3x3 and image pixels have the gray values in the range [0,7]. 1100 6677 7777 5544 11 1 111 111 Image Mask

21 Linear Filtering Using Matlab Linear filtering in matlab accomplished in two steps: 1-Create the appropriate mask( W). 2-Aplly the linear filtering by mask W using the imfilter function. Imfilter function syntax imfilter(image, w, filtering_mode,boundry_option,size_option);

22 Filtering Mode: Correlation or Convolution  ‘corr’  Correlation.(default)  ‘conv’  Convultion. Boundy Option:  value P.  ‘replicate’.  ‘symmetric’.  ‘circular’. Size Option:  ‘full’.  ‘same’.  (default).

23 Average filtering >>W=ones(3); >>w=w./9; >>f=imread(‘cameraman.tif’); >>g2=imfilter(f,w);

24 Enhancement using Arithmetic/Logic Operations Arithmetic/Logic operations perform on pixel by pixel basis between two or more images except NOT operation which perform only on a single image

25 25

26 26 Logic Operations Logic operation performs on gray-level images, the pixel values are processed as binary numbers light represents a binary 1, and dark represents a binary 0 NOT operation = negative transformation

27 27 Example of AND Operation original imageAND image mask result of AND operation

28 28 Example of OR Operation original imageOR image mask result of OR operation

29 29 Image Subtraction g(x,y) = f(x,y) – h(x,y) enhancement of the differences between images


Download ppt "Image Processing Lab Section 28/3/2016 Prepared by Mahmoud Abdelsatar Demonstrator at IT Dep. Faculty of computers and information Assuit University."

Similar presentations


Ads by Google