0% found this document useful (0 votes)
38 views14 pages

Image Processing Toolbox Matlab: Fajri Kurniawan

The document discusses image processing in MATLAB. It introduces how images are represented as matrices in MATLAB and supported image formats. It describes reading and writing image files, accessing image elements, and basic image processing functions like thresholding, labeling, converting between color spaces, and building sample images using functions like zeros, ones, etc. It also briefly mentions example problems like counting objects and noise removal.

Uploaded by

Fajri Kurniawan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views14 pages

Image Processing Toolbox Matlab: Fajri Kurniawan

The document discusses image processing in MATLAB. It introduces how images are represented as matrices in MATLAB and supported image formats. It describes reading and writing image files, accessing image elements, and basic image processing functions like thresholding, labeling, converting between color spaces, and building sample images using functions like zeros, ones, etc. It also briefly mentions example problems like counting objects and noise removal.

Uploaded by

Fajri Kurniawan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 14

Image Processing Toolbox

MATLAB
Fajri Kurniawan
Introduction
• An image in MATLAB is treated as
a matrix
• Every pixel is a matrix element
• All the operators in MATLAB
defined on matrices can be used
on images: +, -, *, /, ^, sqrt, sin, cos
etc.
• The help in MATLAB is very good,
use it!
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)
• XWD (X Window Dump)
• MATLAB can also load raw-data or other types of image data
Image Representation

• Binary images : {0,1}


• Intensity images : [0,1] or uint8, double etc.
• RGB images : m-by-n-by-3
• Indexed images : m-by-3 color map
• Multidimensional images m-by-n-by-p (p is
the number of layers)
Intensity image

RGB image
Binary image
Read Image Files
Read and write images in Matlab
>> I=imread('cells.jpg');
>> imshow(I)
>> size(I)
ans = 479 600 3 (RGB image)
>> Igrey=rgb2gray(I);
>> imshow(Igrey)
>> imwrite(lgrey, 'cell_gray.tif', 'tiff')

Alternatives to imshow
>>imagesc(I)
>>imtool(I)
>>image(I)
Images and Matrices
How to build a matrix (or image)?
>> A = [ 1 2 3; 4 5 6; 7 8 9 ];
A= 1 2 3
4 5 6
7 8 9
>> B = zeros(3,3)
B= 0 0 0
0 0 0
0 0 0
>> C = ones(3,3)
C= 1 1 1
1 1 1
1 1 1
>> imshow(A, [], 'InitialMagnification', 'fit‘) %imshow(A,[]) to get
automatic pixel range
Images and Matrices
X

Accesing image elements (row, column)


>> A(2,1) Y
ans = 4
: can be used to extract a whole column or row
>> A(:,2)
ans =
2
5
8 A=
or a part of a column or row 12 3
>> A(1:2,2) 45 6
ans = 7 8 9
2
5
Histogram
Thresholding

• Lorem ipsum dolor sit amet, consectetuer


adipiscing elit. Vivamus et magna. Fusce sed
sem sed magna suscipit egestas.
• Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Vivamus et magna. Fusce sed
sem sed magna suscipit egestas.
Labeling

• Binary images : {0,1}


• Intensity images : [0,1] or uint8, double etc.
• RGB images : m-by-n-by-3
• Indexed images : m-by-3 color map
• Multidimensional images m-by-n-by-p (p is
the number of layers)
Converting
How to build a matrix (or image)?
>> A = [ 1 2 3; 4 5 6; 7 8 9 ];
A= 1 2 3
4 5 6
7 8 9
>> B = zeros(3,3)
B= 0 0 0
0 0 0
0 0 0
>> C = ones(3,3)
C= 1 1 1
1 1 1
1 1 1
>> imshow(A, [], 'InitialMagnification', 'fit‘) %imshow(A,[]) to get
automatic pixel range
Problem I: Count Rice

• Lorem ipsum dolor sit amet, consectetuer


adipiscing elit. Vivamus et magna. Fusce sed
sem sed magna suscipit egestas.
• Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Vivamus et magna. Fusce sed
sem sed magna suscipit egestas.
Problem 2: Noise Removal
How to build a matrix (or image)?
>> A = [ 1 2 3; 4 5 6; 7 8 9 ];
A= 1 2 3
4 5 6
7 8 9
>> B = zeros(3,3)
B= 0 0 0
0 0 0
0 0 0
>> C = ones(3,3)
C= 1 1 1
1 1 1
1 1 1
>> imshow(A, [], 'InitialMagnification', 'fit‘) %imshow(A,[]) to get
automatic pixel range

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy