Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
12 views

Lab 1 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)
12 views

Lab 1 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/ 8

BOUMERDES UNIVERSITY

Institute of Electrical and Electronic


Engineering
I.G.E.E (ex-INELEC)
Department of electronics
Telecommunications engineering option

Lab experiment N#1


Introduction to Image
processing using MATLAB

➢ 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:

Figure 1: Reading and displaying image using matlab

Figure : Image "peppers.png" Figure 2 : Image "pout.tif"

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.

Figure 6 Displaying red, green and blue component using matlab

Figure 7: Images of "peppers.png" displayed


with red, green and blue components

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.

Mean and standard deviation:

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):

Figure 10: simulation of an Image using 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:

• a = magic(5) creates a 5x5 magic square matrix 'a'.


• disp(‘a=’) : this is useful for labeling the following output of the matrix 'a'.
• disp(a) :show the actual values of the magic square matrix.
• Additionally, it calculates and presents the values of the pixel's neighbors in different
configurations: N4 (the four adjacent neighbors), N8 (all eight neighbors, including
diagonals), and ND (the four diagonal neighbors). This provides a simple demonstration of
how to access and analyze pixel relationships within a matrix.

Implementation of transformations of an image : scaling and rotation :

Figure 14: Scaling and rotation the image of pout.tif

Figure 13: Scaling and rotation of an image using MATLAB

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.

You might also like