Lab 1 Image - Processing
Lab 1 Image - Processing
➢ Done by :
- BOURTCHAI IBTISSEM NADJET.
- HASSINE HANANE.
➢ Option : telecommunication engineering.
➢ Group : 2
➢ Instructor: Prof.CHERIFI Dalila.
1
Introduction:
Image processing is the technique of transforming and manipulating digital images to extract useful
information that would be difficult to obtain manually. Through a variety of operations, such as
image enhancement and restoration, we can generate a comprehensive set of measurements from
images. This technology is widely used across various fields, including medical imaging for diagnosing
diseases, remote sensing for analyzing satellite images, security and surveillance for facial
recognition, and even in the entertainment industry for visual effects. In this laboratory experiment,
we specifically focused on decomposing a color image into its RGB components, allowing us to
observe how each channel contributes to the overall visual representation. Furthermore, we
converted the color image to gray level, simplifying the data while retaining essential information.
This exploration highlighted the significance of different image processing techniques and their
applications in analyzing visual data.
Objective:
Displaying color image, finding its components and converting to gray scale.
Simulating images using arithmetic and logic operation.
Implementing a relationship between pixels neighbour.
Implementing transformations of an image.
Tools:
MATLAB software.
2
Reading and Displaying an Image:
In MATLAB, you can manage and display images using several key functions. Here's how you can
work with images:
Example:
Discussion:
• I = imread('filename'): imports the image and stores it in the variable I, 'filename' should
include the complete path and extension (e.g., .jpg, .png) of the image file..
• imshow (im1): visualizes the image (peppers.png) stored in im1.
• figure (1): it brings the figure window with the identifier 1.
3
Display matrices as images: used for Space Efficiency, enhancing the comparison, for organization,
and other uses.
Figure 4 : Reading and displaying in matrices using matlab Figure 5: The images "peppers.png" and "pout.tif" in a matrix.
Discussion:
• Subplot (211): create a grid of subplots within a single figure, divides the figure into 2 rows and 1
column, and it activates the first subplot, which is the top position.
• Subplot (212): create a grid of subplots within a single figure, divides the figure into 2 rows and 1
column, and it activates the second subplot, which is the bottom position.
4
Discussion:
• Subplot (311): create a grid of subplots within a single figure, divides the figure into 3 rows and 1
column, and it activates the first subplot, which is the top position.
• Subplot (312): create a grid of subplots within a single figure, divides the figure into 3 rows and 1
column, and it activates the first subplot, which is the middle.
• Subplot (313) : create a grid of subplots within a single figure, divides the figure into 3 rows and 1
column, and it activates the first subplot, which is the bottom position.
• imshow (im1(:,:, 1)) : display the red component of an RGB image stored in the variable im1.
• imshow (im1 (:, :, 2)) : display the green component of an RGB image stored in the variable im1.
• imshow (im1 (:,:, 3)) : display the blue component of an RGB image stored in the variable im1.
Figure 8: Calculating the mean and standard deviation of image Figure 9: The results of the mean and standard
"pout.tif" using matlab deviation in MATLAB
Discussion:
• Mean2 (im2): calculates the mean value of all pixel intensities in the matrix im2, treating it as
a two-dimensional array regardless of the number of channels. But mean is a general-
purpose function for calculating means along specified dimensions of any array.
• Std2 (im2): calculates the standard deviation of the pixel intensities in the matrix im2,
treating it as a two-dimensional array.
5
Simulation of an image (arithmetic and logic operation):
Discussion :
The code generates two 80x80 matrices, ‘c ‘and ‘d’, by combining ‘a’ and b in different
configurations. It performs several operations on these matrices, resulting in new matrices ('A', 'M',
'S', 'D'), and displays the outcomes using subplots.
• c = [a b; b a]: creates an 80x80 matrix 'c' by arranging matrices 'a' and 'b' where 'a' and 'b' are
placed side by side in the first row, and then 'b' and 'a' are placed side by side in the second
row.in a specific layout.
• d = [b b; a a]: constructs an 80x80 matrix 'd' by organizing matrices ‘a’ and ‘b’ where 'b' is
placed side by side in the first row, while 'a' is placed side by side in the second row.
• A = 10 * (c + d): computes a new matrix 'A' by adding 'c' and 'd' together element-wise and
then multiplying the sum by 10.
Implementation of relationships between pixels neighbour of 4.8 and diagonal point to find
neighbour of a given pixel:
Figure 11: Implementation of relationships between pixels neighboor of 4.8 and diagonal point using matlalb
6
Figure 12: 4 point Neighbour; 8 point neighbour; Diagonal Neighbour.
Discussion:
7
Discussion:
• Imresize: is used in image processing to change the size of an image or matrix. It can
scale an image up or down based on specified dimensions or a scaling factor.
• Imrotate: is used in image processing to rotate an image or matrix by a specified angle.
This function can rotate an image clockwise or counterclockwise based on the angle
provided.
Conclusion
In summary, this lab experiment helped us understand basic image processing techniques. By
breaking down a color image into its RGB components and converting it to gray scale, we learned
how to simplify data while keeping important information and also transforming images. These
methods have important uses in many fields, showing how valuable image processing is for analyzing
visual data.