The document discusses a workshop on image processing using MATLAB. It provides an overview of MATLAB and its image processing toolbox. It describes how to read, display, and convert between different image formats in MATLAB. It also demonstrates various image processing operations that can be performed, such as arithmetic operations, conversion between color and grayscale, image rotation, blurring and deblurring, and filling regions of interest. The document aims to introduce the basics of working with images in the MATLAB environment.
1. Workshop on “Image processing
using MATLAB”
Presented by
Amarjeetsingh Thakur
Asst. Professor
Dept. of Electronics & Communication Engg.
S.G.B.I.T. Belgaum
2. Outline
What is MATLAB?
Image Processing tool box
Image formats
How to read an image?
Image conversion
Arithmetic operations on images
Conversion of an image into different formats
Image rotation
Image blurring and deblurring
Fill in ROI in grayscale image
References
3. What is MATLAB?
• MATLAB = MATrix LABoratory
• “MATLAB is a high-level language and
interactive environment that enables us to
perform computationally intensive tasks faster
than with traditional programming languages
such as C, C++ and Fortran.”
• MATLAB is an interactive, interpreted language
that is designed for fast numerical matrix
calculations.
5. Key Industries
Aerospace and defense
Automotive
Biotech and pharmaceutical
Communications
Computers
Education
Electronics and semiconductors
Energy production
Industrial automation and machinery
Medical devices
6. The MATLAB Environment
MATLAB window
components:
Workspace
> Displays all the defined
variables
Command Window
> To execute commands
in the MATLAB
environment
Command History
> Displays record of the
commands used
File Editor Window
> Define functions
7. MATLAB Help
• MATLAB Help is an
extremely powerful
assistance to learning
MATLAB
• Help not only contains the
theoretical background,
but also shows demos for
implementation
• MATLAB Help can be
opened by using the
HELP pull-down menu
8. MATLAB Help (cont.)
• Any command description
can be found by typing
the command in the
search field
• As shown above, the
command to take square
root (sqrt) is searched
• We can also utilize
MATLAB Help from the
command window as
shown
9. What is the Image Processing
Toolbox?
• The Image Processing Toolbox is a collection of
functions that extend the capabilities of the
MATLAB’s numeric computing environment. The
toolbox supports a wide range of image
processing operations, including:
– Geometric operations
– Linear filtering and filter design
– Transforms
– Image analysis and enhancement
– Binary image operations
– Region of interest operations
10. Images in MATLAB
• MATLAB can import/export
several image formats:
– BMP (Microsoft Windows
Bitmap)
– GIF (Graphics
Interchange Files)
– HDF (Hierarchical Data
Format)
– JPEG (Joint Photographic
Experts Group)
– PCX (Paintbrush)
– PNG (Portable Network
Graphics)
– TIFF (Tagged Image File
Format)
• Data types in MATLAB
– Double (64-bit double-
precision floating point)
– Single (32-bit single-
precision floating point)
– Int32 (32-bit signed
integer)
– Int16 (16-bit signed
integer)
– Int8 (8-bit signed integer)
– Uint32 (32-bit unsigned
integer)
– Uint16 (16-bit unsigned
integer)
– Uint8 (8-bit unsigned
11. Images in MATLAB
• Binary images : {0,1}
• Intensity images : [0,1] or uint8, double etc.
• RGB images : m × n × 3
• Multidimensional images: m × n × p (p is the number of layers)
12. Binary Images
They are also called “ Black & White ” images ,
containing ‘1’ for white and ‘0’(zero) for black
MATLAB code
13. Intensity Images
They are also called ‘ Gray Scale images ’ ,
containging numbers in the range of 0 to 255
14. Indexed Images
These are the color images and also represented
as ‘RGB image’.
In RGB Images there exist three indexed images.
First image contains all the red portion of the
image, second green and third contains the blue
portion.
15. How to read an image??
I=imread(‘steve.jpg’)
figure
Imshow(I)
size(I) % 295 171 3
16.
17. Images and Matrices
Column 1 to 256
Row1to256
o
[0, 0]
o
[256, 256]
How to build a matrix
(or image)?
Intensity Image:
row = 256;
col = 256;
img = zeros(row, col);
img(100:105, :) = 0.5;
img(:, 100:105) = 1;
figure;
imshow(img);
18. Image Conversion
• gray2ind - intensity image to index image
• im2bw - image to binary
• im2double - image to double precision
• im2uint8 - image to 8-bit unsigned integers
• im2uint16 - image to 16-bit unsigned integers
• ind2gray - indexed image to intensity image
• mat2gray - matrix to intensity image
• rgb2gray - RGB image to grayscale
• rgb2ind - RGB image to indexed image
19. Arithmetic operations on
images
1. Imadd
Syntax : Z = imadd(X,Y)
Description: Z = imadd(X,Y) adds
each element in array X with the
corresponding element in array Y and
returns the sum in the corresponding
element of the output array Z.
21. Contd..
2. imsubtract
Syntax : Z = imsubtract(X,Y)
Description: Z = imsubtract(X,Y) subtracts
each element in array Y from the
corresponding element in array X and
returns the difference in the corresponding
element of the output array Z
23. Contd..
3. immultiply
Syntax : Z = immultiply(X,Y)
Description: Z = immultiply(X,Y)
multiplies each element in array X by the
corresponding element in array Y and
returns the product in the corresponding
element of the output array Z.
25. Contd..
4. imdivide
Syntax : Z = immultiply(X,Y)
Description: Z = imdivide(X,Y) divides
each element in the array X by the
corresponding element in array Y and
returns the result in the corresponding
element of the output array Z.
47. Applications of image
processing
BIOLOGICAL: automated systems for analysis of
samples.
DEFENSE/INTELLIGENCE: enhancement and
interpretation of images to find and track targets.
DOCUMENT PROCESSING: scanning, archiving,
transmission.
FACTORY AUTOMATION: visual inspection of
products.
• MATERIALS TESTING: detection and quantification
of cracks, impurities, etc.
MEDICAL: disease detection and monitoring,
therapy/surgery planning