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.

Median filter Implementation using TMS320C6745

3,168 views

Published on

Median filter Implementation using TMS320C6745

Published in: Education
  • Be the first to comment

Median filter Implementation using TMS320C6745

  1. 1. Median filter Implementation using TMS320C6745 https://www.pantechsolutions.net/products/dsp- dsc-boards/tms320c6745-tyro
  2. 2. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. • Types of noise: – Salt and pepper noise – Impulse noise – Gaussian noise • Due to – transmission errors – dead CCD pixels – specks on lens – can be specific to a sensor Types of Noise
  3. 3. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Median Filter
  4. 4. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Median Filter • The median filter is a sliding-window spatial filter. • It replaces the value of the center pixel with the median of the intensity values in the neighborhood of that pixel. • to reduce "salt and pepper" noise. • For every pixel, a 3x3 neighborhood with the pixel as center is considered. In median filtering, the value of the pixel is replaced by the median of the pixel values in the 3x3 neighborhood. •
  5. 5. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. There are many masks used in Noise Elimination Median Mask is a typical one 23 65 64 120 187 90 47 209 72 J=1 2 3 I=1 2 3 Rank: 23, 47, 64, 65, 72, 90, 120, 187, 209 median Masked Original Image The principle of Median Mask is to mask some sub-image, use the median of the values of the sub-image as its value in new image
  6. 6. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. • How can we remove noise? • Replace each pixel with the average of a kxk window around it 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 130 110 120 110 0 0 0 0 0 110 90 100 90 100 0 0 0 0 0 130 100 90 130 110 0 0 0 0 0 120 100 130 110 120 0 0 0 0 0 90 110 80 120 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Neighborhood Processing Practical Noise Reduction 104
  7. 7. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Median Filter Matlab code I = imread('eight.tif'); J = imnoise(I,'salt & pepper',0.02); K = medfilt2(J); figure, imshow(J), figure, imshow(K)
  8. 8. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. C source code for Median filter #include<stdio.h> #include<math.h> #include "Image1.h" #define ROW 128 #define COL 128 unsigned int im[ROW][COL]; unsigned int i,j; unsigned int SR7,SR1,SR2,SR3,SR4,SR5,SR6,SR8,SR9,bbr; float median(int SR1,int SR2,int SR3,int SR4,int SR5,int SR6,int SR7,int SR8,int SR9); void main() { for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) { im[i][j]=Inp[i][j]; } } for(i=1;i<ROW-1;i++) { for(j=1;j<COL-1;j++) { SR1 = Inp[i-1][j-1]; SR2 = Inp[i-1][j]; SR3 = Inp[i-1][j+1]; SR4 = Inp[i][j-1]; SR5 = Inp[i][j]; SR6 = Inp[i][j+1]; SR7 = Inp[i+1][j-1]; SR8 = Inp[i+1][j]; SR9 = Inp[i+1][j+1]; bbr=median(SR1,SR2,SR3,SR4,SR5,SR6,SR7,SR8,SR9); im[i][j]=bbr; } } }
  9. 9. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Image settings-Noisy Image
  10. 10. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd. Image settings-Filtered Image

×