Write a matlab code for following :
Load image ‘Balloon.tif’ into Matlab
. Develop a function to mark all pixels in green with 1 and 0 for the rest. Display the result image
Convert it into a grayscale image, denoted with ‘img1’
Create a copy of the clean grayscale image, denoted with ‘img2’, in the memory and add salt and pepper noise to it using imnoise
Remove salt and pepper noise using function medfilt2 and display the clean (img1) and denoised image side by side (using subplot function)
Create a copy of the clean grayscale image, denoted with ‘img3’, in the memory and add Gaussian noise using imnoise. Remove Gaussian noise using imgaussfilt
Enhance the denoised img3 to recover the fine edges
Image link : http://tinypic.com/r/289c2t1/9
a.
in = imread('imin.tif');
inSize = size(in);
out = zeros (inSize(1),inSize(2));
for i=1:inSize(1)
for j=1:inSize(2)
if in(i,j,2)>0
&& in(i,j,1)==0 && in(i,j,3)==0
out(i,j) = 1;
end
end
end
imShow(out); %part a
img1 = rgb2gray(in);
img2 = imnoise(img1,'salt & pepper',0.08); %part b
k=medfilt2(img2);
figure
subplot(1,2,1);
imshow(img1);
subplot(1,2,2);
imshow(k); %part c
img3 = imnoise(img1,'gaussian',0,0.01);
x = imgaussfilt(img3); %part d
y = imsharpen(x); %part e
Get Answers For Free
Most questions answered within 1 hours.