Lab2 Image Processing
Lab2 Image Processing
EE513L
➢ 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.
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:
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.
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.
• 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.
task:
discussion:
Discussion:
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.