1 of 23

Image smoothing

MISS.JYOTI

Assistant Professor Computer Science &IT Department

2 of 23

Low-Pass Filtering (Blurring)�

  • The most basic of filtering operations is called "low-pass".
  • A low-pass filter, also called a "blurring" or "smoothing" filter, averages out rapid changes in intensity.
  • The simplest low-pass filter just calculates the average of a pixel and all of its eight immediate neighbors.
  • The result replaces the original value of the pixel. The process is repeated for every pixel in the image.

3 of 23

  • This low-pass filtered image looks a lot blurrier. But why would you want a blurrier image? Often images can be noisy – no matter how good the camera is, it always adds an amount of ”snow” into the image.
  • The statistical nature of light itself also contributes noise into the image.

4 of 23

  • Noise always changes rapidly from pixel to pixel because each pixel generates its own independent noise.
  • The image from the telescope isn't "uncorrelated" in this fashion because real images are spread over many pixels.
  • So the low-pass filter affects the noise more than it does the image.
  • By suppressing the noise, gradual changes can be seen that were invisible before. Therefore a low-pass filter can sometimes be used to bring out faint details that were smothered by noise

5 of 23

Mean Filter:�

  • It is easy to implement median filtering. It is used as a smoothing method for images, reducing the amount of variation in intensity between one pixel and the next, resulting in image noise reduction. The idea of mean filtering is simply to substitute each pixel value in an image, including itself with the mean (‘average value of its neighbors.

6 of 23

���A square kernel of 3 x33 x 3 is often used, as shown below:��

7 of 23

median filtering

  • It is easy to implement median filtering.
  • It is used as a smoothing method for images, reducing the amount of variation in intensity between one pixel and the next, resulting in image noise reduction. 

8 of 23

  • img = imread('hawk.png');
  • mf = ones(3,3)/9;
  • mf = ones(3,3)/9
  • mf =

  • 0.1111 0.1111 0.1111
  • 0.1111 0.1111 0.1111
  • 0.1111 0.1111 0.1111

9 of 23

  • img = imread('cameraman.tif');
  • imgd = im2double(img); % imgd in [0,1]
  • f = ones(3,3)/9;
  • img1 = filter2(f, imgd);
  • subplot(121);imshow(img);
  • subplot(122);imshow(img1);

10 of 23

Compared to the original input, we can see the filtered image (right) has been blurred a bit (left).

11 of 23

Removing noise in RGB image:�

  • Medfilt2 was the filter that we used to remove the “salt & pepper” type noise. However as the “2” in the name indicates it is for 2-D array, unless we decompose each RGB channel and concatenate each channel after filtering, it will not work for RGB image. The following script does exactly that:

12 of 23

  • I = imread('hawk.png');
  • J = imnoise(I,'salt & pepper',0.2);

  • % filter each channel separately
  • r = medfilt2(J(:, :, 1), [3 3]);
  • g = medfilt2(J(:, :, 2), [3 3]);
  • b = medfilt2(J(:, :, 3), [3 3]);

  • % reconstruct the image from r,g,b channels
  • K = cat(3, r, g, b);

  • figure
  • subplot(121);imshow(J);
  • subplot(122);imshow(K);

13 of 23

14 of 23

Blurring masks vs derivative masks�

  • We are going to perform a comparison between blurring masks and derivative masks.
  • Blurring masks
  • A blurring mask has the following properties.
  • All the values in blurring masks are positive
  • The sum of all the values is equal to 1
  • The edge content is reduced by using a blurring mask
  • As the size of the mask grow, more smoothing effect will take place

15 of 23

Derivative masks�

  • A derivative mask has the following properties.
  • A derivative mask have positive and as well as negative values
  • The sum of all the values in a derivative mask is equal to zero
  • The edge content is increased by a derivative mask
  • As the size of the mask grows , more edge content is increased

16 of 23

  • Relationship between blurring mask and derivative mask with high pass filters and low pass filters.
  • The relationship between blurring mask and derivative mask with a high pass filter and low pass filter can be defined simply as.
  • Blurring masks are also called as low pass filter
  • Derivative masks are also called as high pass filter

17 of 23

Pixel�

  • Pixel is the smallest element of an image. Each pixel correspond to any one value. In an 8-bit gray scale image, the value of the pixel between 0 and 255. The value of a pixel at any point correspond to the intensity of the light photons striking at that point. Each pixel store a value proportional to the light intensity at that particular location.

18 of 23

PEL

  • A pixel is also known as PEL. You can have more understanding of the pixel from the pictures given below.

  • In the above picture, there may be thousands of pixels, that together make up this image. We will zoom that image to the extent that we are able to see some pixels division. It is shown in the image below.

19 of 23

20 of 23

��Relationship with CCD array�We have seen that how an image is formed in the CCD array. So a pixel can also be defined as��The smallest division the CCD array is also known as pixel.��Each division of CCD array contains the value against the intensity of the photon striking to it. This value can also be called as a pixel.�

21 of 23

calculation of total number of pixels�

  • We have define an image as a two dimensional signal or matrix. Then in that case the number of PEL would be equal to the number of rows multiply with number of columns.

  • This can be mathematically represented as below:

  • Total number of pixels = number of rows ( X ) number of columns

  • Or we can say that the number of (x,y) coordinate pairs make up the total number of pixels.

  • We will look in more detail in the tutorial of image types, that how do we calculate the pixels in a color image.

22 of 23

THANK YOU

23 of 23