SlideShare a Scribd company logo
ENG/TA : MAiADA ALAA
VISION
COMPUTE
R
• P(I) =
Probability Mass Function
(PMF)
𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑝𝑖𝑥𝑒𝑙𝑠 𝑜𝑓 𝑖𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦 𝑣𝑎𝑙𝑢𝑒
𝑡𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑝𝑖𝑥𝑒𝑙𝑠 𝑖𝑛 h
𝑡 𝑒𝑖𝑚𝑎𝑔𝑒
0 < p ( ) < 1
𝐼
= 1
As an example:
𝑃 5 = 0 + 1 + 2 + 3 + 4 +
𝑝 𝑝 𝑝 𝑝 𝑝 𝑝
5
Cumulative Dentistry
Function (CDF)
𝑃 ( 𝑟 )=∑
𝐼 =0
𝑟
𝑝 ( 𝐼 )
a) Calculate and Plot Histogram/
PMF(pr(r)) of the gray levels.
b) Calculate and Plot the CDF (pr(r))
of the gray levels.
r 1 2 3 4 5 6 7 8 9
# 8 7 12 8 8 9 9 12 17
Pr(r) 8/90 7/90 12/9
0
8/90 8/90 9/90 9/90 12/9
0
17/9
0
Calculate and Plot Histogram/ PMF(pr(r))
of the gray levels.
r 1 2 3 4 5 6 7 8 9
# 8 7 12 8 8 9 9 12 17
Pr(r) 8/90 7/90 12/9
0
8/90 8/90 9/90 9/90 12/9
0
17/9
0
Histogram
1 2 3 4 5 6 7 8 9
0
2
4
6
8
10
12
14
16
18
r 1 2 3 4 5 6 7 8 9
# 8 7 12 8 8 9 9 12 17
Pr(r) 8/90 7/90 12/9
0
8/90 8/90 9/90 9/90 12/9
0
17/9
0
Pr(r) 8/90 15/9
0
27/9
0
35/9
0
43/9
0
52/9
0
61/9
0
73/9
0
90/9
0
+
Calculate and Plot the CDF (pr(r)) of the
gray levels.
CDF Plot
r 1 2 3 4 5 6 7 8 9
# 8 7 12 8 8 9 9 12 17
Pr(r) 8/90 7/90 12/9
0
8/90 8/90 9/90 9/90 12/9
0
17/9
0
Pr(r) 8/90 15/9
0
27/9
0
35/9
0
43/9
0
52/9
0
61/9
0
73/9
0
90/9
0
0 1 2 3 4 5 6 7 8 9
0
0.2
0.4
0.6
0.8
1
1.2
Histogram / PMF (pr(r))
r 8 9 10 11 12 13 14 15
# 10 4 3 7 5 3 2 1
Pr(r) 10/3
5
4/35 3/35 7/35 5/35 3/35 2/35 1/35
Histogram / PMF (pr(r)) r 8 9 10 11 12 13 14 15
# 10 4 3 7 5 3 2 1
Pr(r) 10/3
5
4/35 3/35 7/35 5/35 3/35 2/35 1/35
Histogram / CDF (pr(r))
r 8 9 10 11 12 13 14 15
# 10 4 3 7 5 3 2 1
Pr(r) 10/3
5
4/35 3/35 7/35 5/35 3/35 2/35 1/35
Pr(r) 10/3
5
14/3
5
17/3
5
24/3
5
29/3
5
32/3
5
34/3
5
35/3
5
Computer vision labs for improving in the subject
rk nk P(rk) CDF Sk = T(rk) Equalizat
ion level
0 790 0.192 0.192 0.536 1
1 1023 0.25 0.442 2.5 3
2 850 0.21 0.652 4.2 5
3 656 0.16 0.812 5.5 6
4 329 0.08 0.892 6.136 7
5 245 0.06 0.952 6.6 7
6 122 0.03 0.982 6.8 7
7 81 0.02 1 7 7
Sk = T(rk) = L x CDF -1
sk 1 3 5 6 7
P(sk) 0.192 0.25 0.21 0.16 0.19
SUM
Probabilit
y
Histogram Equalization
Make all pixels have
same frequencies
Histogram Equalization
1) Assume that an image of 32x32 with 32 gray levels distributed as
follows:
a) Draw the image histogram.
b) Find the equalized histogram.
c) Find the specified histogram according to the following
values
a) Draw the image histogram.
b) Find the equalized histogram.
31
c) Find the specified histogram according to the following
values.
Histogram between z and p(r)
Lab Example
Histogram Code
import cv2
from matplotlib import pyplot as plt
import numpy as np
img = cv2.imread("lena.jpg",1)
print(img.shape)
cv2.imshow("image",img)
# cv2.waitKey()
# Calculate histogram
hist = cv2.calcHist([img], [0], None, [256], [0, 256])
# Plot the histogram
plt.figure()
plt.title("Grayscale Histogram")
plt.xlabel("Intensity Value")
plt.plot(hist)
plt.show()
Output
Task
1. What is the main purpose of image acquisition in the field of
computer vision?
A. To detect edges in an image
B. To acquire a digital image from a sensor or camera
C. To improve the brightness of an image
D. To enhance image resolution
2. Which of the following statements about histogram
equalization is true?
A. It reduces the size of the image
B. It equalizes the pixel intensities across the image
C. It applies a color transformation
D. It applies a high-pass filter
3. What does a histogram represent in the context of image
processing?
A. The spatial frequency of image edges
B. The color balance of an image
C. The distribution of pixel intensities
D. The size of the image
4. What is the effect of increasing brightness during image
enhancement?
A. It shifts the histogram to the right
B. It compresses the histogram
C. It enhances the noise
D. It reduces the contrast
5. In histogram equalization, which transformation is applied
to the intensity values?
A. Linear transformation
B. Logarithmic transformation
C. Cumulative distribution function (CDF)
D. Discrete Fourier Transform (DFT)
THANK
YOU

More Related Content

PPTX
Histogram problem Ppt.pptx
PDF
Histogram Operation in Image Processing
PPTX
Histogram Processing
PPTX
ch-2.2 histogram image processing .pptx
PPTX
Image Enhacement for the image improvement
PPT
Histogram.ppt Histogram equilization to improve the image quality
PPTX
Discrete fourier and cosine transform (DCT,DFT)
Histogram problem Ppt.pptx
Histogram Operation in Image Processing
Histogram Processing
ch-2.2 histogram image processing .pptx
Image Enhacement for the image improvement
Histogram.ppt Histogram equilization to improve the image quality
Discrete fourier and cosine transform (DCT,DFT)

Similar to Computer vision labs for improving in the subject (20)

PPT
ModuleII.ppt
PPT
ModuleII.ppt
PPT
ModuleII.ppt
PPTX
it is dip slide made for bs student an easy way to explain dfdfdfffffff
PPTX
HISTOGRAM_EQUALİZATİON FOR UNDERGRADUATE .pptx
PPT
Histogram power point presentation for students
PPT
_Histogram.ppt............................
PPTX
Identification of image in class hist.pptx
PPTX
PDF
ModuleII090.pdf
PDF
CE344L-200365-Lab8.pdf
PDF
Image-Processing-ch3-part-3.pdf
PPT
Computer vision 3 4
PPTX
Histogram based Enhancement
PPTX
Histogram based enhancement
PPT
annotated-chap-3-gw.ppt
PDF
Image processing lab4.pdf image processing
PDF
DIP_Lecture5.pdf
PDF
DIP_Lecture5.pdf
PDF
ModuleII.ppt
ModuleII.ppt
ModuleII.ppt
it is dip slide made for bs student an easy way to explain dfdfdfffffff
HISTOGRAM_EQUALİZATİON FOR UNDERGRADUATE .pptx
Histogram power point presentation for students
_Histogram.ppt............................
Identification of image in class hist.pptx
ModuleII090.pdf
CE344L-200365-Lab8.pdf
Image-Processing-ch3-part-3.pdf
Computer vision 3 4
Histogram based Enhancement
Histogram based enhancement
annotated-chap-3-gw.ppt
Image processing lab4.pdf image processing
DIP_Lecture5.pdf
DIP_Lecture5.pdf
Ad

Recently uploaded (20)

PDF
A systematic review of self-coping strategies used by university students to ...
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Classroom Observation Tools for Teachers
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Cell Types and Its function , kingdom of life
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Cell Structure & Organelles in detailed.
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Lesson notes of climatology university.
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
A systematic review of self-coping strategies used by university students to ...
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Classroom Observation Tools for Teachers
Supply Chain Operations Speaking Notes -ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Cell Types and Its function , kingdom of life
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Cell Structure & Organelles in detailed.
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Abdominal Access Techniques with Prof. Dr. R K Mishra
2.FourierTransform-ShortQuestionswithAnswers.pdf
01-Introduction-to-Information-Management.pdf
Lesson notes of climatology university.
O5-L3 Freight Transport Ops (International) V1.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Ad

Computer vision labs for improving in the subject

  • 1. ENG/TA : MAiADA ALAA VISION COMPUTE R
  • 2. • P(I) = Probability Mass Function (PMF) 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑝𝑖𝑥𝑒𝑙𝑠 𝑜𝑓 𝑖𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦 𝑣𝑎𝑙𝑢𝑒 𝑡𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑝𝑖𝑥𝑒𝑙𝑠 𝑖𝑛 h 𝑡 𝑒𝑖𝑚𝑎𝑔𝑒 0 < p ( ) < 1 𝐼 = 1
  • 3. As an example: 𝑃 5 = 0 + 1 + 2 + 3 + 4 + 𝑝 𝑝 𝑝 𝑝 𝑝 𝑝 5 Cumulative Dentistry Function (CDF) 𝑃 ( 𝑟 )=∑ 𝐼 =0 𝑟 𝑝 ( 𝐼 )
  • 4. a) Calculate and Plot Histogram/ PMF(pr(r)) of the gray levels. b) Calculate and Plot the CDF (pr(r)) of the gray levels.
  • 5. r 1 2 3 4 5 6 7 8 9 # 8 7 12 8 8 9 9 12 17 Pr(r) 8/90 7/90 12/9 0 8/90 8/90 9/90 9/90 12/9 0 17/9 0 Calculate and Plot Histogram/ PMF(pr(r)) of the gray levels.
  • 6. r 1 2 3 4 5 6 7 8 9 # 8 7 12 8 8 9 9 12 17 Pr(r) 8/90 7/90 12/9 0 8/90 8/90 9/90 9/90 12/9 0 17/9 0 Histogram 1 2 3 4 5 6 7 8 9 0 2 4 6 8 10 12 14 16 18
  • 7. r 1 2 3 4 5 6 7 8 9 # 8 7 12 8 8 9 9 12 17 Pr(r) 8/90 7/90 12/9 0 8/90 8/90 9/90 9/90 12/9 0 17/9 0 Pr(r) 8/90 15/9 0 27/9 0 35/9 0 43/9 0 52/9 0 61/9 0 73/9 0 90/9 0 + Calculate and Plot the CDF (pr(r)) of the gray levels.
  • 8. CDF Plot r 1 2 3 4 5 6 7 8 9 # 8 7 12 8 8 9 9 12 17 Pr(r) 8/90 7/90 12/9 0 8/90 8/90 9/90 9/90 12/9 0 17/9 0 Pr(r) 8/90 15/9 0 27/9 0 35/9 0 43/9 0 52/9 0 61/9 0 73/9 0 90/9 0 0 1 2 3 4 5 6 7 8 9 0 0.2 0.4 0.6 0.8 1 1.2
  • 9. Histogram / PMF (pr(r)) r 8 9 10 11 12 13 14 15 # 10 4 3 7 5 3 2 1 Pr(r) 10/3 5 4/35 3/35 7/35 5/35 3/35 2/35 1/35
  • 10. Histogram / PMF (pr(r)) r 8 9 10 11 12 13 14 15 # 10 4 3 7 5 3 2 1 Pr(r) 10/3 5 4/35 3/35 7/35 5/35 3/35 2/35 1/35
  • 11. Histogram / CDF (pr(r)) r 8 9 10 11 12 13 14 15 # 10 4 3 7 5 3 2 1 Pr(r) 10/3 5 4/35 3/35 7/35 5/35 3/35 2/35 1/35 Pr(r) 10/3 5 14/3 5 17/3 5 24/3 5 29/3 5 32/3 5 34/3 5 35/3 5
  • 13. rk nk P(rk) CDF Sk = T(rk) Equalizat ion level 0 790 0.192 0.192 0.536 1 1 1023 0.25 0.442 2.5 3 2 850 0.21 0.652 4.2 5 3 656 0.16 0.812 5.5 6 4 329 0.08 0.892 6.136 7 5 245 0.06 0.952 6.6 7 6 122 0.03 0.982 6.8 7 7 81 0.02 1 7 7 Sk = T(rk) = L x CDF -1 sk 1 3 5 6 7 P(sk) 0.192 0.25 0.21 0.16 0.19 SUM Probabilit y
  • 14. Histogram Equalization Make all pixels have same frequencies
  • 16. 1) Assume that an image of 32x32 with 32 gray levels distributed as follows: a) Draw the image histogram. b) Find the equalized histogram. c) Find the specified histogram according to the following values
  • 17. a) Draw the image histogram.
  • 18. b) Find the equalized histogram. 31
  • 19. c) Find the specified histogram according to the following values. Histogram between z and p(r)
  • 21. Histogram Code import cv2 from matplotlib import pyplot as plt import numpy as np img = cv2.imread("lena.jpg",1) print(img.shape) cv2.imshow("image",img) # cv2.waitKey() # Calculate histogram hist = cv2.calcHist([img], [0], None, [256], [0, 256]) # Plot the histogram plt.figure() plt.title("Grayscale Histogram") plt.xlabel("Intensity Value") plt.plot(hist) plt.show() Output
  • 22. Task
  • 23. 1. What is the main purpose of image acquisition in the field of computer vision? A. To detect edges in an image B. To acquire a digital image from a sensor or camera C. To improve the brightness of an image D. To enhance image resolution 2. Which of the following statements about histogram equalization is true? A. It reduces the size of the image B. It equalizes the pixel intensities across the image C. It applies a color transformation D. It applies a high-pass filter
  • 24. 3. What does a histogram represent in the context of image processing? A. The spatial frequency of image edges B. The color balance of an image C. The distribution of pixel intensities D. The size of the image 4. What is the effect of increasing brightness during image enhancement? A. It shifts the histogram to the right B. It compresses the histogram C. It enhances the noise D. It reduces the contrast 5. In histogram equalization, which transformation is applied to the intensity values? A. Linear transformation B. Logarithmic transformation C. Cumulative distribution function (CDF) D. Discrete Fourier Transform (DFT)