0% found this document useful (0 votes)
24 views

Lab2 Image Processing

Uploaded by

hassinehanane123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Lab2 Image Processing

Uploaded by

hassinehanane123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

BOUMERDES UNIVERSITY

Institute of Electrical and Electronic


Engineering
I.G.E.E (ex-INELEC)
Department of electronics
MASTER In Telecommunication

EE513L

Lab experiment N#2


Basics of Image processing

➢ Done by:
- BOURTCHAI IBTISSEM NADJET.
- HASSINE HANANE.
➢ Option : Telecommunications engineering.
➢ Group : 2
➢ Instructor: Prof.CHERIFI Dalila.
Introduction:
A histogram is a graphical representation of pixel intensity values in an image, showing the
distribution of brightness levels. To improve image contrast, techniques like histogram
equalization and histogram stretching are used. Histogram equalization redistributes pixel
values for a more uniform intensity distribution, enhancing visibility in both bright and dark
areas. Histogram stretching, on the other hand, adjusts specific intensity ranges to utilize the
full spectrum, making details more discernible. These techniques are essential for optimizing
image quality and clarity.

Objective:
➢ Reading and displaying an image.
➢ Checking how the image appears in the workspace.
➢ Improving image contrast using equalization and intensity adjustment.

Tools:
➢ MATLAB software.
Read and display an image:
First, we used the command ‘close all’ to close all open figure windows. This command
clears the screen of any graphical output from previous plots or figures, ensuring that any
new visualizations or plots start fresh without overlap or clutter from earlier displays.

Figure 1 : Matlab command.

Check how the image appears in the workspace:

Figure2 : ‘cameraman.tif ‘image.

Discussion:

• I= imread (‘cameraman.tif’): to read an image from a specified file path, in our case
the file is ‘cameraman.tif’. When executed, this function loads the image into the
variable I as a matrix of pixel values.
• imshow: used to display the image.
• Whos: is used to display information about the variables currently in the workspace.
When you execute this command, it provides details such as the names of the
variables, their sizes, memory usage, and types.
Improve image contrast using equalization:

Figure3: image and histogram of ‘pout.tif’.

Discussion:

• Figure, imhist(I): is used to create a new figure window and display the histogram
of the image represented by the matrix I, which shows the distribution of pixel
intensities in the image.
• We have read the image (‘pout.tif’) and display its histogram in the figure.
• In the original image, the histogram displays a range from 70 to 160, it histogram
is centered around the middle of the gray level axis, indicating a relatively narrow
intensity range. Therefore, we can conclude that (‘pout.tif’) is a low contrast
image.
• In the equalized image, the histogram displays a more uniform distribution across
the full range of gray levels from 0 to 255.
• The command ‘histeq(Ip)’ used to perform histogram equalization on the image
represented by the matrix Ip.
➢ Histogram equalization is a technique that enhances the contrast of an image by
redistributing the intensity values, resulting in a more uniform distribution of pixel
intensities.

Figure4: original, equalized, adjusted pout.tif images and its histograms.

Discussion:

• Imadjust(I): used to adjust the intensity values of the image represented by the
matrix I. This function enhances the contrast of the image by stretching the range
of pixel values to cover the full spectrum of intensity levels.
• The histogram of the adjusted image is stretched over all the gray level range 0-
255 with keeping same shape as original one.

Improve image contrast using intensity adjustment:

Figure5: image contrast and adjustment of pout.tif and its histograms.


Discussion:

• imadjust (I, [0.3 0.7], [] ): is used to enhance the contrast of the image I. Here,
the input intensity values are specified to be in the range [0.3 0.7], meaning that
pixel values falling within this range will be stretched to utilize the full range of
output intensity values, which typically spans from 0 (black) to 1 (white). The
empty brackets [] for the third argument indicate that MATLAB will automatically
scale the output values accordingly.
• is stretched over the full gray level range of 0-255, This adjustment redistributes
the pixel intensities. The overall shape remains similar to the original histogram,
there is a clearer representation of values in the mid-range, with the extremes
(values below 0.3 and above 0.7) mapped to the lower and upper ends of the
range, respectively.

Figure 6: pout.tif image before and after adjustment.

task:

discussion:

Figure 7: football image before and after adjustment.

Discussion:

• RGB1 = imread('football.jpg'): This line reads the image file named


"football.jpg" and stores it in the variable RGB1. The image is likely a color image as it
is being stored in an RGB format.
• RGB2 = imadjust(RGB1, [0.2, 0.3, 0; 0.6, 0.7, 1], []): This
line applies an intensity transformation to the image using the imadjust function.
Here's a breakdown of the parameters:
- RGB1: The input image.
- [0.2, 0.3, 0; 0.6, 0.7, 1]: This matrix defines the mapping of
input intensity values to output intensity values for each color channel (R, G,
B). The first row specifies the input range, and the second row specifies the
output range.
- []: This parameter is empty, indicating that the output range should be
automatically determined based on the input range and the specified
transformation.

Impact on the Image:

The provided images demonstrate the effect of the imadjust function. The original football
image is relatively dull and has a narrow range of intensities. The adjusted image, on the
other hand, has a wider range of intensities, making it appear more vibrant and contrasting.

Conclusion:
In conclusion, histogram analysis is a fundamental tool in image processing that provides
insight into the distribution of pixel intensities. Understanding and applying histogram
adjustment techniques are vital for enhancing image quality, facilitating clearer visual
communication, and improving the accuracy of data analysis.

You might also like