Lab Report 1 3 CSE 4246
Lab Report 1 3 CSE 4246
01
Experiment Name: Write a Program to Flip (Vertically and Horizontally) and Rotate an Image In
MATLAB
Objectives:
1. To learn about image flipping and rotation.
2. To learn the matlab code for image flipping and rotation.
Introduction:
A flipped image or reversed image, the more formal term, is a static or moving image that is generated by
a mirror-reversal of an original across a horizontal axis (a flopped image is mirrored across the vertical
axis).
A mirror image (in a plane mirror) is a reflected duplication of an object that appears almost identical, but
is reversed in the direction perpendicular to the mirror surface. As an optical effect it results from
reflection off from substances such as a mirror or water.
Image rotation is a common image processing routine with applications in matching, alignment, and other
image-based algorithms. The input to an image rotation routine is an image, the rotation angle θ, and a
point about which rotation is done.
Code:
Conclusion:
Here, in rotation we have rotated the image at an angle of 90 degree. It can be rotated in different angle by
changing the degree in the code. Here, the vertically flipped image is also a mirrored image. Here, it looks
like a reflection off from substance mirror.
Experiment No. 02
Experiment Name: Write A Program to Show Histogram of An Image With & Without Using
Built-In Function and to Show Histogram Equalization in MATLAB.
Objectives:
1. To learn about histogram of image.
2. To learn about histogram equalization.
3. To learn the matlab code for histogram and histogram equalization.
Introduction:
An image histogram is a type of histogram that acts as a graphical representation of the tonal distribution
in a digital image. It plots the number of pixels for each tonal value. In a graph, the horizontal axis of the
graph is used to represent tonal variations whereas the vertical axis is used to represent the number of
pixels in that particular pixel. Black and dark areas are represented in the left side of the horizontal axis,
medium grey color is represented in the middle, and the vertical axis represents the size of the area.
Histogram equalization is a widely used contrast-enhancement technique in image processing because of
its high efficiency and simplicity. It is one of the sophisticated methods for modifying the dynamic range
and contrast of an image by altering that image such that its intensity histogram has the desired shape. It
is used to increase or decrease contrast of an image.
Code:
Conclusion:
Here, we can see that both the histogram using built-in function (Fig. 3) and without using built-in
function (Fig. 2) is almost identical. Here, to create the equalized histogram (Fig. 4) we used the
histogram created without the built-in function (Fig. 2). The equalized image (Fig. 5) was created from
the equalized histogram.
Experiment No. 03
Experiment Name: Write a Program to Show the Basic Intensity Transformation Function
(Negative, Log, Power) of an Image in MATLAB.
Objectives:
3. To learn about the basic intensity transformation function (negative, log, power) of image.
4. To learn the matlab code for the basic intensity transformation function (negative, log, power) of
image.
Introduction:
Intensity transformations are applied on images for contrast manipulation or image thresholding. These
are in the spatial domain, i.e., they are performed directly on the pixels of the image at hand, as opposed
to being performed on the Fourier transform of the image.
This relation between input image and the processed output image can be represented as.
s = T (r)
where T is the transformation function, ‘r’ is the pixel value or gray level intensity of input image at any
point. And ‘s’ is the pixel value or gray level intensity of output image at any point.
The following are commonly used intensity transformations:
subplot(3,3,3);imshow(logTransformation);title('Log
img = imread('self.jpg'); Transformation Image');
I = im2double(img);
subplot(3, 3, 1);
c = 2;
imshow(img);
g = [0.5, 0.7,
title('Input 0.9, 1, 3, 5];
Image');
for r = 1 : =
negativeImg length(g)
((2 ^ 8) - 1) - img;
pow = =
normalize c double(img)
* I.^g(r); ./ double(max(max(img)));
subplot(3, 3, =
logTransformation r+3);
2 * log10(normalize + 1);
imshow(pow);
subplot(3,3,2);imshow(negativeImg);title('Negative Image');
xlabel(['gamma: ',num2str(g(r))]);
title('Power Transfomation Image');
end
Output:
Conclusion:
Here, we can see that negative transformation is producing a negative image as output. The log
transformation is producing a darker image as output of the original image. The power transformation is
producing darker or lighter image as output than that of original image based on the gamma value.
Here, constant, c = 2 (both in log and power transformation).