70 likes | 396 Views
Salt and pepper noise. tw=imread('twins.tif'); t=rgb2gray(tw); t_sp=imnoise(t, 'salt & pepper ‘ , 0.1 );. Low-pass filtering. a3=fspecial('average'); t_sp_a3=filter2(a3,t_sp);. Ex#1. Try 7x7 averaging filter and 3x3 median filter ( medfilt2 ). Gaussian noise.
E N D
Salt and pepper noise tw=imread('twins.tif'); t=rgb2gray(tw); t_sp=imnoise(t, 'salt & pepper‘, 0.1); Low-pass filtering a3=fspecial('average'); t_sp_a3=filter2(a3,t_sp); Ex#1. Try 7x7 averaging filter and 3x3 median filter (medfilt2)
Gaussian noise t_ga=imnoise(t, 'gaussian'); % default: mean=0, var=0.01 Ex#2: image averaging For the twin image, generate 10 Gaussian noisy images. Then take a the average of them. Ex#3: average filter Try 3x3 and 5x5 average filter to the t_ga noisy image
Periodic noise [x,y]=meshgrid(1:size(t,1), 1:size(t,2)); p=sin(x+y/1.5)+1; t_pn=(double(t)/128+p)/4; Ex#4. Show the DFT of t_pn
Band reject filtering z=sqrt((x-129).^2+(y-129).^2); br=(z<47 | z>51); tbr=T.*br; imshow(log(1+abs(tbr)), []) Ex#5. (a) perform iDFT to tbr. Show the restored image. (b) Notch filtering: perform notch filtering as the image on the right. Show the restored image.
Inverse filtering bc=imread('board.tif'); bg=im2uint8(rgb2gray(bc)); b=bg(100:355, 50:305); imshow(b) m=fspecial('motion', 7, 0); bm=imfilter(b,m); imshow(bm); m2(1,1:7)=m; mf=fft2(m2); bmi=ifft2(fft2(double(bm))./mf); imshow(abs(bmi), []) Ex#6. Limit the division. Such that no division when mf(i,j) < 0.02;