Académique Documents
Professionnel Documents
Culture Documents
2
3
1
JIMMA UNIVERSITY
INSTITUTE OF TECHNOLOGY
SCHOOL OF COMPUTIG
Group members:
Name ID_NO
1. Mehariw Zewudie…………………….ru0469/08
4 .Marshet Tesfaye………………………..ru0494/08
5.Nebil Mohammed………………………….Ru1334/07
i
ii
Table of Contents
Title ............................................................................................................................................................. 16
Objective ..................................................................................................................................................... 16
Theory ......................................................................................................................................................... 16
Materials used ............................................................................................................................................ 16
Procedures .................................................................................................................................................. 17
Conclusion ................................................................................................................................................... 23
1
2
Lab Report
Objectives
Object of this lab is how the basic arithmetic operation can be done over a given image. How
image can be added, subtracted, multiplied and also divided by image.
In addition it incorporate how to use basic logic gate operations like AND ,OR , XOR and NOT
on a given image.
Theory
In this lab how the image can be added, subtracted, multiplied and divided pixel by pixel using
mat lab software. Adding, subtracting, multiplying and dividing two images can produce image,
but result is different from the original image, because the addition, subtraction, multiplying and
division, AND, OR, XOR and NOT of two different images produce one image.
Materials
In this lab activity we use both hardware and software:
Hardware:
Computer
Software:
Matlab
1
Procedure:
Process of how to add, subtract, multiply and divide images looks like the following:
Image Addition
step1: import image file into the current directory
step2: clc, clear the matlab workspace
step3: I=imread(‘image1.jpg’);
subplot(2,2,1);
title(‘image one’);
imshow(i);
step4: j=imread(‘image2,jpg’);
subplot(2,2,2);
title(‘image two’);
imshow(j);
step5:k=imadd(i,j);
subplot(2,2,3);
title(‘added image’);
imshow(k);
Image subtraction
step1: import image file into the current directory
step2: clc, clear the matlab workspace
step3: i=imread(‘image1.jpg’);
subplot(2,2,1);
title(‘image one’);
imshow(i);
step4: j=imread(‘image2,jpg’);
subplot(2,2,2);
title(‘image two’);
imshow(j);
step5:k=imsubtract(i,j);
subplot(2,2,3);
title(‘added image’);
imshow(k);
2
Image multiplication
step1: import image file into the current directory
step2: clc, clear the matlab workspace
step3: i=imread(‘image1.jpg’);
subplot(2,2,1);
title(‘image one’);
imshow(i);
step4: j=imread(‘image2,jpg’);
subplot(2,2,2);
title(‘image two’);
imshow(j);
step5:k=immultiply(i,j);
subplot(2,2,3);
title(‘added image’);
imshow(k);
Image Division
step1: import image file into the current directory
step2: clc, clear the matlab workspace
step3: i=imread(‘image1.jpg’);
subplot(2,2,1);
title(‘image one’);
imshow(i);
step4: j=imread(‘image2,jpg’);
subplot(2,2,2);
title(‘image two’);
imshow(j);
step5:k=imdivide(i,j);
subplot(2,2,3);
title(‘added image’);
imshow(k);
3
Image AND
step1: import image file into the current directory
Image OR
step1: import image file into the current directory
4
Image XOR
step1: import image file into the current directory
5
Result:-
In this lab we have got different images that can different the original images.
Examples are the followings;-
1. Image addition :
Adding two images can produce one image
To add two images, the images must have the size.
6
New result from the two images.
2. Image Subtraction:
Two images must have the same size.
Subtract one image from other image produce new image.
Image1 - image2
7
=
New image
8
3. Image Multiplication
Multiplications of two images produce new image.
Image1 * image2
New image
9
4. Image division
Image 1 / image 2
New image
10
5 .Image AND
New image
11
6. Image OR
New image
12
7 .Image XOR and NOT
13
Discussion:-
In this section of the lab report we tried to discuss briefly about image addition,
subtraction, multiplication, division and logical operations (AND, OR, XOR,
NOT) which results in obtaing different image quality. It is obvious that we get
image with various qualities at the time we apply these arithmetic and logical
operations on the given image(original image).These report writing is concluded
by incorporating tittle, objective, theory, materials used, procedure and results
obtained.
14
Table of Contents
Title ............................................................................................................................................................. 16
Objective ..................................................................................................................................................... 16
Theory ......................................................................................................................................................... 16
Materials used ............................................................................................................................................ 16
Procedures .................................................................................................................................................. 17
Conclusion ................................................................................................................................................... 23
15
Lab3 report
Title:
Image Cropping, Resizing, Flipping, and Rotation
Objective:
The objectives of this lab activity are Cropping, Resizing, Flipping and Rotating the image using
matlab script.
Theory
In world technology develops rapidly and solves many problems that is very difficult to solve
manually. In order to develop this system lab practice is very important. So we are going to
practices the scripts on mat lab software .This practices also increase our understanding how
image can be cropped, resized, flip and rotated. Cropping is very important when we need only
certain part of the image. Big image need large area of storage and while we have small storage
we have to resize the image using different techniques in matlab. The same is true for flipping
and rotating the image in case studying image in different views.
Materials used
To perform this lab practices we use different hard ware and software materials. These materials
are;
Desk top
Software tools
Matlab 2016
Adobe reader: - to read the given pdf materials.
16
Procedures
In order to Crop, Resize, Flip and rotate an image :
1. We write mat lab script that read image from it’s folder
2. We give position by which order the images are displayed
3. Write mat lab script to display the image
4. Then Cropping, Resizing, Flipping and Rotating
5.
6. Matlab code for image cropping
17
Matlab code for image Resizing
1. image Enlarging
I = imread('image1.jpg');
figure
imshow(I),
title('Original Image');
imshow(I2);
Ib = imresize(I,2);
figure
imshow(Ib), ...
title('Enlarged Image with bilinear interpolation');
The output :
18
2. for shrinking
Out put
19
Image filliping and rotation
Image can be flipped in different direction
I = imread('image1.jpg');
subplot(2,2,1);
imshow(I);
title('Original image')
I2=rgb2gray(I);
subplot(2,2,2);
imshow(I2);
title('Original image converted to grayscale')
%Flipping upside down
J = flipud(I2);
subplot(2,2,3)
imshow(J)
title('Flipped upside-down')
Output
20
a. flipping from left to right
I = imread('image1.jpg');
subplot(2,2,1);
imshow(I);
title('Original image')
I2=rgb2gray(I);
subplot(2,2,2);
imshow(I2);
title('Original image converted to grayscale')
K = fliplr(I2);
subplot(2,2,3), imshow(K);
title('Flipped left-right')
21
a. rotation of images by certain angle
I = imread('image1.jpg');
subplot(2,2,1);
imshow(I);
title('Original image')
I2=rgb2gray(I);
subplot(2,2,2);
imshow(I2);
title('Original image converted to grayscale')
Ir= imrotate(I,35);
subplot(2,2,3),
imshow(Ir);
title('Rotated Image using default Interpolation');
22
Conclusion
As we know knowledge comes from practices. In this practice we understand how images can
cropped, resized, flipped and rotated in different direction. And also we understand the
importance of this cropping, flipping, resizing and rotating an image in different areas of study.
23