SlideShare a Scribd company logo
Lecture 1: Introduction to
Image Processing and MATLAB
Computer Vision In MATLAB
By. Assist. Prof. Ielaf O.Abdul Majjed
2022-2023
Image Processing
Refer to the operation that be applied on the
information of the digital image such as (analysis ,
transformation ,enhancement )
Image formation
There are numerous ways to acquire images, but the objective is how to
generate digital image from sensed data (physical image ).since the output of
the most sensors is continuous. Converting continuous sensed data into digital
form involves two processes , sampling and quantization
Sampling
f
t
A sampled function
Sampling is the process of converting a signal (for example, a
function of continuous time and/or space) into a numeric
sequence (a function of discrete time and/or space).
∆𝑥
Hint: take enough samples so that the “continuous” image can be
reconstructed from its samples.
What is the effect of Δx?
 Large Δx (i.e., few samples)
results to overlapping
• Smaller Δx (i.e., more samples)
alleviates aliasing!
How to choose Δx
 The sampling period (Δx) Choose according to Nyquist criterion
(should be smaller than or at the most equal to half of the period
of the finest detail present within an image).
Nyquist Theory where W is the max frequency of f(x)
Image Sampling
 To convert the image to digital we have to sample the function in both
coordinates (x,y)
Two dimensional sampling array
∆𝑦 where W is the max frequency
Quantization
f
t
3
2
1
0
Quantization
∆𝑥
Quantization Conversion of the sampled analogue pixel intensities to
discrete valued integer numbers is the process of quantization. Quantization
involves assigning a single value to each sample in such a way that the image
reconstructed from the quantized sample values
Image Sampling & quantization
0
255
Image Sampling & quantization
Representing Digital Images
The result of Sampling and Quantization is a matrix of integer
numbers.
Representing Digital Images

















)
1
,
1
(
...
...
)
1
,
0
(
...
)
0
,
1
(
...
...
...
)
1
,
1
(
...
...
)
1
,
0
(
)
0
,
0
(
)
,
(
N
M
f
N
f
M
f
f
f
f
y
x
f
f(x,y) where x,y denote spatial coordinates and the value of f
at any point (x,y) is the intensity(gray-level) of image at that
point
Here we have an image f(x,y)
Where x = 1,2 , ………….., M and M= number of rows
Where y = 1,2 , ………….., N and N= number of column
How are images represented
in the computer?
The image can now be represented as a matrix of integer values
What is a Digital Image
 Digital image is composed of a finite number of elements, each of
which has a particular location and value. These elements are referred
to as picture elements, image elements, and pixels.
 Pixel is the term most widely used to denote the elements of a digital
image
Pixel
f(x,y)=i(x,y)r(x,y)
where
1) i(x,y) the amount of illumination
incident to the scene
2) r(x,y) the reflectance from the
object
DIGITAL IMAGE
1
)
,
(
0
)
,
(
0





y
x
r
y
x
i
Digital Images(Storage requirements)
 0 ≤ f(x,y) ≤ L-1 for all (x,y)
 Usually L= 2k
 Dynamic Range : [0, L-1]
The number of bits required to store an image
b = M x N x k where k is the number of bits/pixel
N = number of rows
M= number of column
k = number of bits/pixel
• An image is represented by a rectangular array of integers.
MATLAB for Image Processing
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 your functions
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
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
More about the Workspace
• who, whos – current variables in the
workspace
• save – save workspace variables to *.mat
file
• load – load variables from *.mat file
• clear – clear workspace variables
Matrices in MATLAB
• Matrix is the main MATLAB data type
• How to build a matrix?
– A=[1 2 3; 4 5 6; 7 8 9];
– Creates matrix A of size 3 x 3
• Special matrices:
– zeros(n,m), ones(n,m), eye(n,m),
rand(),…. etc
• Numbers are always double (64 bits)
unless you specify a different data
type
Basic Operations on Matrices
• All operators in MATLAB are defined on
matrices: +, -, *, /, ^, sqrt,
sin, cos, etc.
• Element-wise operators defined with a
preceding dot: .*, ./, .^
• size(A) – size vector
• sum(A) – columns sums vector
• sum(sum(A)) – sum of all the elements
Variable Name in Matlab
• Variable naming rules
- must be unique in the first 63 characters
- must begin with a letter
- may not contain blank spaces or other types of punctuation
- may contain any combination of letters, digits, and
underscores
- are case-sensitive
- should not use Matlab keyword
• Pre-defined variable names
• pi
Logical Operators
• ==, <, >, (not equal) ~=, (not) ~
• find(‘condition’) – Returns indexes
of A’s elements that satisfy the condition
Logical Operators (cont.)
• Example:
>>A=[7 3 5; 6 2 1], Idx=find(A<4)
A=
7 3 5
6 2 1
Idx=
3
4
6
Flow Control
• MATLAB has five flow control constructs:
– if statement
– switch statement
– for loop
– while loop
– break statement
if
• IF statement condition
– The general form of the IF statement is
IF expression
statements
ELSEIF expression
statements
ELSE
statements
END
switch
• SWITCH – Switch among several cases based
on expression
• The general form of SWITCH statement is:
SWITCH switch_expr
CASE case_expr,
statement, …, statement
CASE {case_expr1, case_expr2, case_expr3, …}
statement, …, statement
…
OTHERWISE
statement, …, statement
END
switch (cont.)
• Note:
– Only the statements between the matching
CASE and the next CASE, OTHERWISE, or END
are executed
– Unlike C, the SWITCH statement does not fall
through (so BREAKs are unnecessary)
for
• FOR repeats statements a specific
number of times
• The general form of a FOR statement is:
FOR variable=expr
statements
END
while
• WHILE repeats statements an indefinite
number of times
• The general form of a WHILE statement is:
WHILE expression
statements
END
Visualization and Graphics
• plot(x,y),plot(x,sin(x)) – plot 1D function
• figure, figure(k) – open a new figure
• hold on, hold off – refreshing
• axis([xmin xmax ymin ymax]) – change axes
• title(‘figure titile’) – add title to figure
• mesh(x_ax,y_ax,z_mat) – view surface
• contour(z_mat) – view z as topo map
• subplot(3,1,2) – locate several plots in figure
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)
– XWD (X Window Dump)
– raw-data and other types of
image data
• Typically switch images to double
to perform any processing and
convert back to unsigned integer
• 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 integer)
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)
Image Import and Export
• Read and write images in Matlab
img = imread('apple.jpg');
dim = size(img);
figure;
imshow(img);
imwrite(img, 'output.bmp', 'bmp');
• Alternatives to imshow
imagesc(I)
imtool(I)
image(I)
Images and Matrices
Column 1 to 256
Row
1
to
256
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);
Images and Matrices
Binary Image:
row = 256;
col = 256;
img = rand(row, col);
img = round(img);
figure;
imshow(img);
size(im)
Image Display
• image - create and display image object
• imagesc - scale and display as image
• imshow - display image
Image Import and ExportRead and write images in Matlab
img= imread('football.jpg');
dim =size(img)
figure
imshow(img);
imwrite(img, 'output', 'bmp')
subplot(3,1,1), imagesc(img);
subplot (3,1,2), imtool(img)
subplot (3,1,3),image(img)

More Related Content

Similar to Lecture1_computer vision-2023.pdf

Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
Amr Rashed
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
joellivz
 
Matlab intro
Matlab introMatlab intro
Matlab intro
Chaitanya Banoth
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
reddyprasad reddyvari
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
minhtaispkt
 
Matlab dip
Matlab dipMatlab dip
Matlab dip
Jeevan Reddy
 
Image processing using matlab
Image processing using matlabImage processing using matlab
Image processing using matlab
dedik dafiyanto
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
aliraza2732
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
محمدعبد الحى
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
Arshit Rai
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
Ganesan Narayanasamy
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
ssuser772830
 
Intro matlab and convolution islam
Intro matlab and convolution islamIntro matlab and convolution islam
Intro matlab and convolution islamIslam Alabbasy
 
4413-lecture-09 Introduction Matlab lecture .ppt
4413-lecture-09 Introduction Matlab lecture .ppt4413-lecture-09 Introduction Matlab lecture .ppt
4413-lecture-09 Introduction Matlab lecture .ppt
aaaaboud1
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdf
UmarMustafa13
 

Similar to Lecture1_computer vision-2023.pdf (20)

Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
 
Intro matlab
Intro matlabIntro matlab
Intro matlab
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
Matlab dip
Matlab dipMatlab dip
Matlab dip
 
Image processing using matlab
Image processing using matlabImage processing using matlab
Image processing using matlab
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
Intro matlab and convolution islam
Intro matlab and convolution islamIntro matlab and convolution islam
Intro matlab and convolution islam
 
4413-lecture-09 Introduction Matlab lecture .ppt
4413-lecture-09 Introduction Matlab lecture .ppt4413-lecture-09 Introduction Matlab lecture .ppt
4413-lecture-09 Introduction Matlab lecture .ppt
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdf
 

More from ssuserff72e4

Lecture 6-2023.pdf
Lecture 6-2023.pdfLecture 6-2023.pdf
Lecture 6-2023.pdf
ssuserff72e4
 
Lecture 5-2023.pdf
Lecture 5-2023.pdfLecture 5-2023.pdf
Lecture 5-2023.pdf
ssuserff72e4
 
informationhiding-181103070958 (1).pdf
informationhiding-181103070958 (1).pdfinformationhiding-181103070958 (1).pdf
informationhiding-181103070958 (1).pdf
ssuserff72e4
 
chapter10-queue-161018120329.en.ar.pdf
chapter10-queue-161018120329.en.ar.pdfchapter10-queue-161018120329.en.ar.pdf
chapter10-queue-161018120329.en.ar.pdf
ssuserff72e4
 
cp264_lecture18_queue.ppt
cp264_lecture18_queue.pptcp264_lecture18_queue.ppt
cp264_lecture18_queue.ppt
ssuserff72e4
 
chapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdfchapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdf
ssuserff72e4
 
Parts of speech in English.pptx
Parts of speech in English.pptxParts of speech in English.pptx
Parts of speech in English.pptx
ssuserff72e4
 
Lecture 2-2023.pdf
Lecture 2-2023.pdfLecture 2-2023.pdf
Lecture 2-2023.pdf
ssuserff72e4
 
Lecture 2-2023.pdf
Lecture 2-2023.pdfLecture 2-2023.pdf
Lecture 2-2023.pdf
ssuserff72e4
 

More from ssuserff72e4 (13)

Lecture 6-2023.pdf
Lecture 6-2023.pdfLecture 6-2023.pdf
Lecture 6-2023.pdf
 
Lecture 5-2023.pdf
Lecture 5-2023.pdfLecture 5-2023.pdf
Lecture 5-2023.pdf
 
informationhiding-181103070958 (1).pdf
informationhiding-181103070958 (1).pdfinformationhiding-181103070958 (1).pdf
informationhiding-181103070958 (1).pdf
 
chapter10-queue-161018120329.en.ar.pdf
chapter10-queue-161018120329.en.ar.pdfchapter10-queue-161018120329.en.ar.pdf
chapter10-queue-161018120329.en.ar.pdf
 
Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
 
cp264_lecture18_queue.ppt
cp264_lecture18_queue.pptcp264_lecture18_queue.ppt
cp264_lecture18_queue.ppt
 
11.pptx
11.pptx11.pptx
11.pptx
 
Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
 
chapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdfchapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdf
 
11.pdf
11.pdf11.pdf
11.pdf
 
Parts of speech in English.pptx
Parts of speech in English.pptxParts of speech in English.pptx
Parts of speech in English.pptx
 
Lecture 2-2023.pdf
Lecture 2-2023.pdfLecture 2-2023.pdf
Lecture 2-2023.pdf
 
Lecture 2-2023.pdf
Lecture 2-2023.pdfLecture 2-2023.pdf
Lecture 2-2023.pdf
 

Recently uploaded

Memory Rental Store - The Chase (Storyboard)
Memory Rental Store - The Chase (Storyboard)Memory Rental Store - The Chase (Storyboard)
Memory Rental Store - The Chase (Storyboard)
SuryaKalyan3
 
ART FORMS OF KERALA: TRADITIONAL AND OTHERS
ART FORMS OF KERALA: TRADITIONAL AND OTHERSART FORMS OF KERALA: TRADITIONAL AND OTHERS
ART FORMS OF KERALA: TRADITIONAL AND OTHERS
Sandhya J.Nair
 
thGAP - BAbyss in Moderno!! Transgenic Human Germline Alternatives Project
thGAP - BAbyss in Moderno!!  Transgenic Human Germline Alternatives ProjectthGAP - BAbyss in Moderno!!  Transgenic Human Germline Alternatives Project
thGAP - BAbyss in Moderno!! Transgenic Human Germline Alternatives Project
Marc Dusseiller Dusjagr
 
Memory Rental Store - The Ending(Storyboard)
Memory Rental Store - The Ending(Storyboard)Memory Rental Store - The Ending(Storyboard)
Memory Rental Store - The Ending(Storyboard)
SuryaKalyan3
 
一比一原版(GU毕业证)格里菲斯大学毕业证成绩单
一比一原版(GU毕业证)格里菲斯大学毕业证成绩单一比一原版(GU毕业证)格里菲斯大学毕业证成绩单
一比一原版(GU毕业证)格里菲斯大学毕业证成绩单
zvaywau
 
一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理
一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理
一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理
beduwt
 
The Legacy of Breton In A New Age by Master Terrance Lindall
The Legacy of Breton In A New Age by Master Terrance LindallThe Legacy of Breton In A New Age by Master Terrance Lindall
The Legacy of Breton In A New Age by Master Terrance Lindall
BBaez1
 
Inter-Dimensional Girl Boards Segment (Act 3)
Inter-Dimensional Girl Boards Segment (Act 3)Inter-Dimensional Girl Boards Segment (Act 3)
Inter-Dimensional Girl Boards Segment (Act 3)
CristianMestre
 
2137ad - Characters that live in Merindol and are at the center of main stories
2137ad - Characters that live in Merindol and are at the center of main stories2137ad - Characters that live in Merindol and are at the center of main stories
2137ad - Characters that live in Merindol and are at the center of main stories
luforfor
 
Caffeinated Pitch Bible- developed by Claire Wilson
Caffeinated Pitch Bible- developed by Claire WilsonCaffeinated Pitch Bible- developed by Claire Wilson
Caffeinated Pitch Bible- developed by Claire Wilson
ClaireWilson398082
 
一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理
一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理
一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理
taqyed
 
CLASS XII- HISTORY-THEME 4-Thinkers, Bes
CLASS XII- HISTORY-THEME 4-Thinkers, BesCLASS XII- HISTORY-THEME 4-Thinkers, Bes
CLASS XII- HISTORY-THEME 4-Thinkers, Bes
aditiyad2020
 
The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎
The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎
The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎
iraqartsandculture
 
ashokathegreat project class 12 presentation
ashokathegreat project class 12 presentationashokathegreat project class 12 presentation
ashokathegreat project class 12 presentation
aditiyad2020
 
acting board rough title here lolaaaaaaa
acting board rough title here lolaaaaaaaacting board rough title here lolaaaaaaa
acting board rough title here lolaaaaaaa
angelicafronda7
 
Codes n Conventionss copy (2).pptx new new
Codes n Conventionss copy (2).pptx new newCodes n Conventionss copy (2).pptx new new
Codes n Conventionss copy (2).pptx new new
ZackSpencer3
 
IrishWritersCtrsPersonalEssaysMay29.pptx
IrishWritersCtrsPersonalEssaysMay29.pptxIrishWritersCtrsPersonalEssaysMay29.pptx
IrishWritersCtrsPersonalEssaysMay29.pptx
Aine Greaney Ellrott
 
Sundabet | Slot gacor dan terpercaya mudah menang
Sundabet | Slot gacor dan terpercaya mudah menangSundabet | Slot gacor dan terpercaya mudah menang
Sundabet | Slot gacor dan terpercaya mudah menang
Sundabet | Situs Slot gacor dan terpercaya
 
一比一原版(DU毕业证)迪肯大学毕业证成绩单
一比一原版(DU毕业证)迪肯大学毕业证成绩单一比一原版(DU毕业证)迪肯大学毕业证成绩单
一比一原版(DU毕业证)迪肯大学毕业证成绩单
zvaywau
 

Recently uploaded (20)

Memory Rental Store - The Chase (Storyboard)
Memory Rental Store - The Chase (Storyboard)Memory Rental Store - The Chase (Storyboard)
Memory Rental Store - The Chase (Storyboard)
 
ART FORMS OF KERALA: TRADITIONAL AND OTHERS
ART FORMS OF KERALA: TRADITIONAL AND OTHERSART FORMS OF KERALA: TRADITIONAL AND OTHERS
ART FORMS OF KERALA: TRADITIONAL AND OTHERS
 
thGAP - BAbyss in Moderno!! Transgenic Human Germline Alternatives Project
thGAP - BAbyss in Moderno!!  Transgenic Human Germline Alternatives ProjectthGAP - BAbyss in Moderno!!  Transgenic Human Germline Alternatives Project
thGAP - BAbyss in Moderno!! Transgenic Human Germline Alternatives Project
 
Memory Rental Store - The Ending(Storyboard)
Memory Rental Store - The Ending(Storyboard)Memory Rental Store - The Ending(Storyboard)
Memory Rental Store - The Ending(Storyboard)
 
一比一原版(GU毕业证)格里菲斯大学毕业证成绩单
一比一原版(GU毕业证)格里菲斯大学毕业证成绩单一比一原版(GU毕业证)格里菲斯大学毕业证成绩单
一比一原版(GU毕业证)格里菲斯大学毕业证成绩单
 
一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理
一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理
一比一原版UPenn毕业证宾夕法尼亚大学毕业证成绩单如何办理
 
The Legacy of Breton In A New Age by Master Terrance Lindall
The Legacy of Breton In A New Age by Master Terrance LindallThe Legacy of Breton In A New Age by Master Terrance Lindall
The Legacy of Breton In A New Age by Master Terrance Lindall
 
Inter-Dimensional Girl Boards Segment (Act 3)
Inter-Dimensional Girl Boards Segment (Act 3)Inter-Dimensional Girl Boards Segment (Act 3)
Inter-Dimensional Girl Boards Segment (Act 3)
 
2137ad - Characters that live in Merindol and are at the center of main stories
2137ad - Characters that live in Merindol and are at the center of main stories2137ad - Characters that live in Merindol and are at the center of main stories
2137ad - Characters that live in Merindol and are at the center of main stories
 
Caffeinated Pitch Bible- developed by Claire Wilson
Caffeinated Pitch Bible- developed by Claire WilsonCaffeinated Pitch Bible- developed by Claire Wilson
Caffeinated Pitch Bible- developed by Claire Wilson
 
一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理
一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理
一比一原版(qut毕业证)昆士兰科技大学毕业证如何办理
 
CLASS XII- HISTORY-THEME 4-Thinkers, Bes
CLASS XII- HISTORY-THEME 4-Thinkers, BesCLASS XII- HISTORY-THEME 4-Thinkers, Bes
CLASS XII- HISTORY-THEME 4-Thinkers, Bes
 
The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎
The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎
The Last Polymath: Muntadher Saleh‎‎‎‎‎‎‎‎‎‎‎‎
 
ashokathegreat project class 12 presentation
ashokathegreat project class 12 presentationashokathegreat project class 12 presentation
ashokathegreat project class 12 presentation
 
European Cybersecurity Skills Framework Role Profiles.pdf
European Cybersecurity Skills Framework Role Profiles.pdfEuropean Cybersecurity Skills Framework Role Profiles.pdf
European Cybersecurity Skills Framework Role Profiles.pdf
 
acting board rough title here lolaaaaaaa
acting board rough title here lolaaaaaaaacting board rough title here lolaaaaaaa
acting board rough title here lolaaaaaaa
 
Codes n Conventionss copy (2).pptx new new
Codes n Conventionss copy (2).pptx new newCodes n Conventionss copy (2).pptx new new
Codes n Conventionss copy (2).pptx new new
 
IrishWritersCtrsPersonalEssaysMay29.pptx
IrishWritersCtrsPersonalEssaysMay29.pptxIrishWritersCtrsPersonalEssaysMay29.pptx
IrishWritersCtrsPersonalEssaysMay29.pptx
 
Sundabet | Slot gacor dan terpercaya mudah menang
Sundabet | Slot gacor dan terpercaya mudah menangSundabet | Slot gacor dan terpercaya mudah menang
Sundabet | Slot gacor dan terpercaya mudah menang
 
一比一原版(DU毕业证)迪肯大学毕业证成绩单
一比一原版(DU毕业证)迪肯大学毕业证成绩单一比一原版(DU毕业证)迪肯大学毕业证成绩单
一比一原版(DU毕业证)迪肯大学毕业证成绩单
 

Lecture1_computer vision-2023.pdf

  • 1. Lecture 1: Introduction to Image Processing and MATLAB Computer Vision In MATLAB By. Assist. Prof. Ielaf O.Abdul Majjed 2022-2023
  • 2. Image Processing Refer to the operation that be applied on the information of the digital image such as (analysis , transformation ,enhancement )
  • 3. Image formation There are numerous ways to acquire images, but the objective is how to generate digital image from sensed data (physical image ).since the output of the most sensors is continuous. Converting continuous sensed data into digital form involves two processes , sampling and quantization
  • 4. Sampling f t A sampled function Sampling is the process of converting a signal (for example, a function of continuous time and/or space) into a numeric sequence (a function of discrete time and/or space). ∆𝑥 Hint: take enough samples so that the “continuous” image can be reconstructed from its samples.
  • 5. What is the effect of Δx?  Large Δx (i.e., few samples) results to overlapping • Smaller Δx (i.e., more samples) alleviates aliasing! How to choose Δx  The sampling period (Δx) Choose according to Nyquist criterion (should be smaller than or at the most equal to half of the period of the finest detail present within an image). Nyquist Theory where W is the max frequency of f(x)
  • 6. Image Sampling  To convert the image to digital we have to sample the function in both coordinates (x,y) Two dimensional sampling array ∆𝑦 where W is the max frequency
  • 7. Quantization f t 3 2 1 0 Quantization ∆𝑥 Quantization Conversion of the sampled analogue pixel intensities to discrete valued integer numbers is the process of quantization. Quantization involves assigning a single value to each sample in such a way that the image reconstructed from the quantized sample values
  • 8. Image Sampling & quantization 0 255
  • 9. Image Sampling & quantization
  • 10. Representing Digital Images The result of Sampling and Quantization is a matrix of integer numbers.
  • 11. Representing Digital Images                  ) 1 , 1 ( ... ... ) 1 , 0 ( ... ) 0 , 1 ( ... ... ... ) 1 , 1 ( ... ... ) 1 , 0 ( ) 0 , 0 ( ) , ( N M f N f M f f f f y x f f(x,y) where x,y denote spatial coordinates and the value of f at any point (x,y) is the intensity(gray-level) of image at that point Here we have an image f(x,y) Where x = 1,2 , ………….., M and M= number of rows Where y = 1,2 , ………….., N and N= number of column
  • 12. How are images represented in the computer? The image can now be represented as a matrix of integer values
  • 13. What is a Digital Image  Digital image is composed of a finite number of elements, each of which has a particular location and value. These elements are referred to as picture elements, image elements, and pixels.  Pixel is the term most widely used to denote the elements of a digital image Pixel
  • 14. f(x,y)=i(x,y)r(x,y) where 1) i(x,y) the amount of illumination incident to the scene 2) r(x,y) the reflectance from the object DIGITAL IMAGE 1 ) , ( 0 ) , ( 0      y x r y x i
  • 15. Digital Images(Storage requirements)  0 ≤ f(x,y) ≤ L-1 for all (x,y)  Usually L= 2k  Dynamic Range : [0, L-1] The number of bits required to store an image b = M x N x k where k is the number of bits/pixel N = number of rows M= number of column k = number of bits/pixel • An image is represented by a rectangular array of integers.
  • 16. MATLAB for Image Processing
  • 17. 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 your functions
  • 18. 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
  • 19. 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
  • 20. More about the Workspace • who, whos – current variables in the workspace • save – save workspace variables to *.mat file • load – load variables from *.mat file • clear – clear workspace variables
  • 21. Matrices in MATLAB • Matrix is the main MATLAB data type • How to build a matrix? – A=[1 2 3; 4 5 6; 7 8 9]; – Creates matrix A of size 3 x 3 • Special matrices: – zeros(n,m), ones(n,m), eye(n,m), rand(),…. etc • Numbers are always double (64 bits) unless you specify a different data type
  • 22. Basic Operations on Matrices • All operators in MATLAB are defined on matrices: +, -, *, /, ^, sqrt, sin, cos, etc. • Element-wise operators defined with a preceding dot: .*, ./, .^ • size(A) – size vector • sum(A) – columns sums vector • sum(sum(A)) – sum of all the elements
  • 23. Variable Name in Matlab • Variable naming rules - must be unique in the first 63 characters - must begin with a letter - may not contain blank spaces or other types of punctuation - may contain any combination of letters, digits, and underscores - are case-sensitive - should not use Matlab keyword • Pre-defined variable names • pi
  • 24. Logical Operators • ==, <, >, (not equal) ~=, (not) ~ • find(‘condition’) – Returns indexes of A’s elements that satisfy the condition
  • 25. Logical Operators (cont.) • Example: >>A=[7 3 5; 6 2 1], Idx=find(A<4) A= 7 3 5 6 2 1 Idx= 3 4 6
  • 26. Flow Control • MATLAB has five flow control constructs: – if statement – switch statement – for loop – while loop – break statement
  • 27. if • IF statement condition – The general form of the IF statement is IF expression statements ELSEIF expression statements ELSE statements END
  • 28. switch • SWITCH – Switch among several cases based on expression • The general form of SWITCH statement is: SWITCH switch_expr CASE case_expr, statement, …, statement CASE {case_expr1, case_expr2, case_expr3, …} statement, …, statement … OTHERWISE statement, …, statement END
  • 29. switch (cont.) • Note: – Only the statements between the matching CASE and the next CASE, OTHERWISE, or END are executed – Unlike C, the SWITCH statement does not fall through (so BREAKs are unnecessary)
  • 30. for • FOR repeats statements a specific number of times • The general form of a FOR statement is: FOR variable=expr statements END
  • 31. while • WHILE repeats statements an indefinite number of times • The general form of a WHILE statement is: WHILE expression statements END
  • 32. Visualization and Graphics • plot(x,y),plot(x,sin(x)) – plot 1D function • figure, figure(k) – open a new figure • hold on, hold off – refreshing • axis([xmin xmax ymin ymax]) – change axes • title(‘figure titile’) – add title to figure • mesh(x_ax,y_ax,z_mat) – view surface • contour(z_mat) – view z as topo map • subplot(3,1,2) – locate several plots in figure
  • 33. 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) – XWD (X Window Dump) – raw-data and other types of image data • Typically switch images to double to perform any processing and convert back to unsigned integer • 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 integer)
  • 34. 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)
  • 35. Image Import and Export • Read and write images in Matlab img = imread('apple.jpg'); dim = size(img); figure; imshow(img); imwrite(img, 'output.bmp', 'bmp'); • Alternatives to imshow imagesc(I) imtool(I) image(I)
  • 36. Images and Matrices Column 1 to 256 Row 1 to 256 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);
  • 37. Images and Matrices Binary Image: row = 256; col = 256; img = rand(row, col); img = round(img); figure; imshow(img); size(im)
  • 38. Image Display • image - create and display image object • imagesc - scale and display as image • imshow - display image
  • 39. Image Import and ExportRead and write images in Matlab img= imread('football.jpg'); dim =size(img) figure imshow(img); imwrite(img, 'output', 'bmp') subplot(3,1,1), imagesc(img); subplot (3,1,2), imtool(img) subplot (3,1,3),image(img)