EX.
NO: 1
IMAGE ENHANCEMENT
DATE: 28.06.2024
AIM:
To implement an image enhancement program using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB->bin->
MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the required line.
STEP5: Save and run the program.
STEP6: The image will be enhanced and displayed in different window.
STEP7: Stop the process
1
CODING:
I=imread(' C:\Users\HI\Documents\MATLAB\Winter.jpg');
j=imresize(I,0.3);
figure
imshow(I);
title('original image')
figure
imshow(j);
title('resized image')
j=imcomplement(I);
figure
imshow(j);
title(‘Negative Image’)
2
OUTPUT:
ORIGINAL IMAGE:
RESIZED IMAGE:
NEGATIVE IMAGE:
RESULT:
Thus, the program is executed and verified successfully.
3
EX.NO: 2
HISTROGRAM EQUALIZATION
DATE: 03.07.2024
AIM:
To implement histogram equalization program using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB->bin->
MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the required line.
STEP5: Save and run the program.
STEP6: The image will produce the intensity range and displayed in
different Window.
STEP7: Stop the process.
4
CODING:
A=imread(' C:\Users\HI\Documents\MATLAB \Writer.jpg’);
A_gray=rgb2gray(A);
imhist(A_gray);
imhist(A_gray,128);
imhist(A_gray,32);
R=A(:,1,1);
G=A(:,1,2);
B=A(:,1,3);
subplot(1,3,1),imhist(R),title(R);
subplot(1,3,2),imhist(G),title(G);
subplot(1,3,3),imhist(B),title(B);
5
OUTPUT:
RESULT:
Thus, the program is executed and verified successfully.
RESULT:
Thus, the program is executed and verified successfully.
6
EX.NO: 3
IMAGE RESTORATION
DATE: 11.07.2024
AIM:
To implement an image restoration program using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB->bin->
MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the required line.
STEP5: Save and run the program.
STEP6: The image will be restored and displayed in different
window. STEP7: Stop the process
7
CODING:
I=im2double(imread(' C:\Users\HI\Documents\MATLAB \images.jpg'));
LEN=60;
THETA=0;
noise_var=0.001; est_nsr=noise_var/var(I(:));
PSF=fspecial('motion',LEN,THETA);
wnr=deconvwnr(I,PSF,est_nsr);
imshow(wnr);
8
OUTPUT:
ORIGINAL IMAGE:
RESTORED IMAGE:
RESULT:
Thus, the program is executed and verified successfully.
9
EX.NO: 4
IMAGE FILTERING
DATE: 22.07.2024
AIM:
To implement an image filtering program using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB->bin->
MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the required line.
STEP5: Save and run the program.
STEP6: The original image will be filtered and displayed in different
window
STEP7: Stop the process.
10
CODING:
I=imread(' C:\Users\HI\Documents\MATLAB\Winter.jpg');
h=ones(5,5)/25;
I2=imfilter(I,h);
imshow(I);
title('original image');
figure
imshow(I2);
title('filtered image')
11
OUTPUT:
ORIGINAL IMAGE:
FILTERED IMAGE:
RESULT:
Thus, the program is executed and verified successfully.
12
EX.NO: 5
EDGE DETECTION USING OPERATORS
DATE: 30.07.2024
AIM:
To implement edge detection using operators- program using
MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB->bin->
MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the
required line.
STEP5: Save and run the program.
STEP6: The image will be detected and displayed in three different
formats.
STEP7: Stop the process.
13
CODING:
i=imread('C:\Users\HI\Documents\MATLAB \Winter.jpg');
I=rgb2gray(i);
Bw1=edge(I,'prewitt');
Bw2=edge(I,'sobel');
Bw3=edge(I,'roberts');
subplot(2,2,1);
imshow(I);
title('original image');
subplot(2,2,2);
imshow(Bw1);
title('prewitt');
subplot(2,2,3);
imshow(Bw2);
title('sobel');
subplot(2,2,4);
imshow(Bw3);
title('roberts');
14
OUTPUT:
RESULT:
Thus, the program is executed and verified successfully.
15
EX.NO: 6
IMAGE COMPRESSION
DATE: 07.08.2024
AIM:
To implement an image compression program using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB-
>bin-> MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the required line.
STEP5: Save and run the program.
STEP6: The image will be compressed and displayed in different
window.
STEP7: Stop the process.
16
CODING:
clear all;
close all;
input_image1=imread('C:\pictures\CARU9KLZ.jpg');
input_image=imnoise(input_image1,'speckle',.01);
figure;
imshow(input_image);
n=input('enter the decomposition level=');
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar');
[c,s] = wavedec2(input_image,n,Lo_D,Hi_D);
disp('the decomposition vector output is');
disp(c);
[thr,nkeep] = wdcbm2(c,s,1.5,3*prod(s(1,:)));
[Compressed_image,TREE,Comp_ratio,PERFL2] =
wpdencmp(thr,'s',n,'haar','threshold',5,1);
disp('Compression ratio in %');
disp(Comp_ratio);
re_ima1 = waverec2(c,s,'haar');
re_ima =uint8(re_ima1);
subplot(1,3,1);
imshow(input_image);
title('I/P image');
subplot(1,3,2);
imshow(Compressed_image);
title('Compressed_image');
subplot(1,3,3);
imshow(re_ima);
title('reconstructed image');
17
OUTPUT:
RESULT:
Thus, the program is executed and verified successfully.
18
EX.NO: 7
IMAGE SUBTRACTION
DATE: 27.08.2024
AIM:
To implement an image subtraction program using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB->bin->
MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the
required line.
STEP5: Save and run the program.
STEP6: The colours in the image will be subtracted and produce a
different image.
19
CODING:
I=imread('C:\\Users\\acer\\img1.png’);
figure
imshow(I);
title(‘original image’);
figure
background=imopen(I,strel(‘disk’,15));
IP=imsubtract(I,background);
Imshow(IP,[])
title(‘Subtracted Image’);
20
OUTPUT:
Original Image
Subtracted image
RESULT:
Thus, the program is executed and verified successfully.
21
EX.NO: 8
BOUNDARY EXTRACTION
DATE: 04.09.2024
AIM:
To implement an image to extract boundary using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB-
>bin-> MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the required line.
STEP5: Save and run the program.
STEP6: The image will be extracted using morphology and
displayed in different window.
STEP7: Stop the process.
22
CODING:
A=imread('D:\miriam\durdle_door_coastline_5k-t1.jpg')
S=strel('disk',2.0);
F=imerode(A,S);
subplot(2,1,1);
imshow(A);title('binary image');
subplot(2,1,2);
imshow(A-F);title('boundary extracted image');
23
OUTPUT:
Original Image
Boundary Extracted image
RESULT:
Thus, the program is executed and verified successfully.
24
EX.NO: 9
IMAGE SEGMENTATION
DATE: 12.09.2024
AIM:
To implement an image segmentation program using MATLAB.
ALGORITHM:
STEP1: Start -> My computer->Program files-> MATLAB
->bin->MATLAB.
STEP2: Open MATLAB and select new script.
STEP3: Write the source code.
STEP4: Copy the path of the image and paste it in the required
line.
STEP5: Save and run the program.
STEP6: The image will be segmented and displayed in different
window.
STEP7: Stop the process.
25
CODING:
image=imread(‘C:\Users\HI\Documents\MATLAB\images.jpg');
[height,width,planes]=size(image);
rgb=reshape(image,height,width*planes);
imagesc(rgb);
colorbaron
r=image(:,:,1);
g=image(:,:,2);
b=image(:,:,3);
26
OUTPUT:
RESULT:
Thus, the program is executed and verified successfully.
27