Professional Documents
Culture Documents
Resizepgm
Resizepgm
Resizepgm
Aim:
Write the MATLAB program to resize the given image and store the image
in the given folder.
Apparatus Required:
Personal Computer
MATLAB tool
PROGRAM:
OUTPUT:
1. REDUCE THE GIVEN IMAGE BY 2
Result:
Date:
Staff Signature:
Exercise No: 10 Date:
PROGRAM TO RESIZE THE ALL THE IMAGES AND STORE IN NEW FOLDER
Aim:
Write the MATLAB program to resize all the images and store the images
in new folder.
Apparatus Required:
Personal Computer
MATLAB tool
PROGRAM:
Procedure:
1. Start the MATLAB program.
2. Go to editor window and type the program.
3. Choose the location where current folder exists(D:\matlabprogram)and having
image files that is to be resized.
4. Save Run the program.Check for error, if you have correct it.Check the result.
5. Now this program will create a new folder name animalnew1 folder.And this
contains a resized images.
6. Stop the program
Result:
Date:
Staff Signature:
Exercise No: 11 Date:
Aim:
Write the MATLAB program to rotate the given image and also to merge
the selected images.
Apparatus Required:
Personal Computer
MATLAB tool
PROGRAM:
% IMAGE ROTATION
clear all;
close all;
clc;
I=imread('3a.jpeg');
figure,
imshow(I);
title('original image');
J=imread('4a.jpeg');
k=imrotate(I,45);
figure,
imshow(J);
figure,
imshow(k);
title('Image after 45 degree rotation');
% IMAGE MERGING
I=imread('3a.jpeg');
J=imread('4a.jpeg');
CI=cat(2,I,J);
figure,
montage(CI);
title('2-merged image');
I1=imread('1a.jpeg');
I2=imread('2a.jpeg');
I3=imread('3a.jpeg');
I4=imread('4a.jpeg');
I5=cat(4,I1,I2,I3,I4)
figure,
montage(I5);
title('4-MERGED IMAGE');
OUTPUT:
Procedure:
Date:
Staff Signature:
Exercise No: 12 Date:
Aim:
Write the MATLAB program to insert text on the image.
Apparatus Required:
Personal Computer
MATLAB tool
PROGRAM:
clear all;
close all;
clc;
I=imread('horse.jpeg');
figure,
imshow(I);
title('ORIGINAL IMAGE');
J=insertText(I,[300 300],'BEAUTIFUL HORSE');
figure,
imshow(J);
title('AFTER INSERTING TEXT IN IMAGE')
OUTPUT:
Procedure:
Date:
Staff Signature:
Exercise No: 13 Date:
Aim:
Write the MATLAB program to separate objects from the given image.
Apparatus Required:
Personal Computer
MATLAB tool
PROGRAM:
% PROGRAM FOR OBJECT SEGMENTATION
clc;
clear all;
close all;
inpict=imread('toolspic2.png');
figure, imshow(inpict);
title('original image');
%cropped from thumpnail
bpict=rgb2gray(inpict)<240;
%pick a threshold to isolate from Background
S=regionprops(bpict,'boundingbox','filledimage');
C=cell(numel(S),1);
for n=1:numel(S)
%get mask of object only
mk=S(n).FilledImage;
%get corresponding rectangular area of original image
bb=floor(S(n).BoundingBox);
samp=inpict(bb(2):bb(2)+bb(4)-1,bb(1):bb(1)+bb(3)-1,:);
%remove adjacent object fragments from rectangular sample
samp(repmat(~mk,[1 1 size(inpict,3)]))=255;
%store the image
c{n}=samp;
end
%just plot the images for viewing
for n=1:numel(S)
subplot(3,4,n)
imshow(c{n},'border','tight')
end
OUTPUT:IMAGE BEFORE AND AFTER OBJECT SEPARATION
Procedure:
Date:
Staff Signature: