Professional Documents
Culture Documents
html
Learn how to pad with zeros using MATLAB built_in function padarray. FLOW CHART:
MATLAB CODE:
%READ AN 2D IMAGE A=imread('zebra.jpg'); title('IMAGE WITH SALT AND PEPPER NOISE'); figure,imshow(A); %PAD THE MATRIX WITH ZEROS ON ALL SIDES modifyA=zeros(size(A)+2); B=zeros(size(A));
%COPY THE ORIGINAL IMAGE MATRIX TO THE PADDED MATRIX for x=1:size(A,1) for y=1:size(A,2) modifyA(x+1,y+1)=A(x,y); end end %LET THE WINDOW BE AN ARRAY %STORE THE 3-by-3 NEIGHBOUR VALUES IN THE ARRAY %SORT AND FIND THE MIDDLE ELEMENT for i= 1:size(modifyA,1)-2 for j=1:size(modifyA,2)-2 window=zeros(9); inc=1; for x=1:3 for y=1:3 window(inc)=modifyA(i+x-1,j+y-1); inc=inc+1; end end med=sort(window); %PLACE THE MEDIAN ELEMENT IN THE OUTPUT MATRIX B(i,j)=med(5); end end %CONVERT THE OUTPUT MATRIX TO 0-255 RANGE IMAGE TYPE B=uint8(B); title('IMAGE AFTER MEDIAN FILTERING'); figure,imshow(B);
Your Reactions:
3 comments:
Movies Gallery 2011 said... Excellent pieces. Keep posting such kind of information on your blog. I really impressed by your blog. Vee Eee Technologies| Vee Eee Technologies November 28, 2011 11:25 PM
Phongthorn.jant said... thank you so much for project lol February 16, 2012 8:51 AM
jeena said... thanks a lot for this code April 4, 2012 7:48 AM
om
Loading...
Subscribe in a reader
Submit
Follow @AaronAngel_
ION
DO YOU HAVE A TOPIC TO SUGGEST? CLICK HERE.
Translate:
Select Language
Blog Archive
2012 (9) 2011 (47) o December (2) o October (3) o September (3) o August (1) o July (2) o June (20) o May (7) o April (7) o March (2) Simple Image Thresholding using GUI component Slid...
MATLAB PROGRAM : 2D MEDIAN FILTERING FOR SALT AND ... 2010 (3)
MATLAB PROGRAM : 2D MEDIAN FILTERING FOR SALT AND PEPPER NOISE WITHOUT USING medfilt2 FUNCTION MEDIAN FILTER: In digital Image processing , removing the noise is one of the preprocessing techniques. The image noise may be termed a...
Matlab code: Histogram equalization without using histeq function It is the re-distribution of gray level values uniformly. Lets consider a 2 dimensional image which has values rangin...
Sobel edge detection The gradient of the image is calculated for each pixel position in the image. The procedure and t...
MATLAB CODE:Local Histogram equalization For every pixel, based on the neighbor hood value the histogram equalization is done. Here I used 3 by 3 window matrix for explanation...
Image Rotation in MATLAB - Examples without imrotate function 180 degree We can develop our own code to rotate an Image.In this article, I have ...