DIP Assnmnt
DIP Assnmnt
clear all;
close all;
i=imread('cameraman.tif');
figure,
imshow(i);
title('Monochrome Image');
j=imread('peppers.png');
figure,
imshow(j);
title('Color Image');
RGB2HSV HSV2RGb
ORIGINAL IMAGE
ii)RGB2YCBCR and YCBCR2RGB
clear all;
close all;
i=imread('football.jpg');
figure,
imshow(i);
title('ORIGINAL IMAGE');
j=rgb2ycbcr(i);
figure,
imshow(j);
title('RGB2YCBCR');
k=ycbcr2rgb(j);
figure,
imshow(k);
title('YCBCR2RGB');
clear all;
close all;
i=imread('greens.jpg');
figure,
imshow(i);
title('ORIGINAL IMAGE');
j=rgb2gray(i);
figure,
imshow(j);
title('RGB2GRAY');
800
600
400
200
j=i(1:10:255);
figure,
bar(j);
title('BAR HISTOGRAM');
figure,
stem(j);
title('STEM HISTOGRAM');
figure,
plot(j);
title('PLOT HISTOGRAM');
ORIGINAL IMAGE
BAR HISTOGRAM
200
180
160
140
120
100
80
60
40
20
0
0 5 10 15 20 25 30
STEM HISTOGRAM
200
180
160
140
120
100
80
60
40
20
0
0 5 10 15 20 25 30
PLOT HISTOGRAM
200
150
100
50
0 5 10 15 20 25 30
Q.6)Write a program to display equalised histogram of the
monochrome image.
clear all;
close all;
i=imread('moon.tif');
figure,
imshow(i);
figure,
imhist(i);
j=histeq(i);
figure,
imshow(j);
figure,
imhist(j);
ORIGINAL IMAGE
HISTOGRAM
7000
6000
5000
4000
3000
2000
1000
HISTOGRAM EQUALISATION
8000
7000
6000
5000
4000
3000
2000
1000
ORIGINAL IMAGE
COMPLEMENT OF THE IMAGE
Q.10)Write a program to obtain image complement by using
imcomplement function.
clear all;
close all;
i=imread('football.jpg');
figure,
imshow(i);
title('ORIGINAL IMAGE');
j=imcomplement(i);
figure,
imshow(j);
title('Using IMCOMPLEMENT');
x=imnoise(i,'poisson');
figure,
imshow(x);
title('POISSON');
GAUSSIAN SALT & PEPPER
SPECKLE POISSON
Q.13)Write a program to implementtwo dimensional 2D DFT in matlab.
clear all;
close all;
i=imread('cameraman.tif');
figure,
imshow(i);
title('ORIGINAL IMAGE');
i1=fft2(i);
figure,
imshow(i1);
title('FFT');
i2=abs(i1),
i3=fftshift(i2);
figure,
imshow(mat2gray(i3));
title('FFTSHIFT');
i4=log(1+abs(i3));
figure,
imshow(mat2gray(i4));
ORIGINAL IMAGE
title('ABSOLUTE');
i5=ifftshift(i3);
i6=ifft2(i1);
figure,
imshow(mat2gray(i6));
title('IFFT2');
FFT FFTSHIFT
ABSOLUTE IFFT2