SlideShare a Scribd company logo
Image processing
Lab 3
By: Eng Noha Abd-Elkareem
Histogram processing
• Histogram: gray level against number of pixel for gray level
• provide distribution of pixel values.
• Illustrate brightness and contrast of image
MATLAB code
• For gray &binary image imhist(image) display histogram of 2d image
• For RGB image imhist(RGB(:,:,1)) imhist(RGB(:,:,2)) imhist(RGB(:,:,3))
• Task1
• Create function that get gray or RGB image and return histogram
•
NI=I-127
N=I/2
N=I+127
Basic intensity transformation functions
• There are three basic Types of functions:
Linear(negative and Identity transformation).
Logarithmic (Log and invers-log transformation).
Power-low(nth-power and nth-root transformation).
Image processinglab image processing  image processing
Logarithmic transformation
• General form:
s = c * log𝟐(𝟏 + 𝒓)
The log transformation maps a narrow range of low input grey level values into
a wider range of output values .(brights images).
• The inverse log transformation performs the opposite transformation .
S=exp(r)
• The negative of the image with intensity level in the range [0,L-1]
is given by the expression: S=L-1-r
• Power-law (gamma) transformation
s= 𝑐 ∗ 𝑟𝑦
Task2(Practical)
Log, inverse log .
power, root and negative(imcomplement(I))
(im2double&im2uint8)
Q)A 4x4 , 4bits/pixel image passes through appoint-wise intensity transformation given
by
S=T(r) = αlog2 1 + 𝑟 + 𝛽
Where α and 𝛽 are unknown parameters. Only a few pixels are available in the input
and output images , as shown below
(a) Find α and 𝛽
(b)what is the value of the pixel with the “?” mark in the output image.
(c)what is the value of the pixel with the “?” mark in the input image.
3
15
?
1 3
5
11
8
? 5
T(r)
Q) A4x4,4bits/pixel image (shown below) passes through one
point-wise intensity transformations given by
S=T(r)= round(5 𝑟 )
7 3 4 1
1 2 0 3
4 2 2 1
0 3 5 1
T(r)
Piecewise Linear Transformation Functions
• Contrast stretching.
• Equation
• New value=
𝑣𝑎𝑙𝑢𝑒−𝑜𝑙𝑑𝑚𝑖𝑛
𝑜𝑙𝑑𝑚𝑎𝑥−𝑜𝑙𝑑𝑚𝑖𝑛
∗ 𝑛𝑒𝑤 𝑚𝑎𝑥 − 𝑛𝑒𝑤 𝑚𝑖𝑛 + 𝑛𝑒𝑤 𝑚𝑖𝑛
Contrast stretching example
• Q) A4*4, 4bits/pixel original image is given by
Apply full-scale contrast stretch to the image . show your work and sketch the
resulting image
• old min=6 old max=14
• new min=0 new max=15
• New value=
6−6
14−6
∗ 15 − 0 + 0 = 0
• New value=
13−6
14−6
∗ 15 − 0 + 0 =13
Contrast stretching matlab code
• Imadjust(I,[oldmin oldmax],[newmin newmax])
• Task3
Contrast stretching mfile that take gray or RGB image
Min(min(I))
Max(max(I))
Intensity level slicing
• Highlights a specific range of grey levels.
Bit Plane Slicing
• Often by isolating particular bits of the pixel values in an image we can
highlight interesting aspects of that image
• 10110011
most
• most least
• significant significant
Bit Plane Slicing example
255 13 127 7
55 40 150 255
160 20 200 14
170 90 255 9
1 1
1
1
1 1
1
1
1 0
1
1
1 1
1
1
1 0
1
1
1 0
1
1
1 0
1
1
1 0
1
1
Plane 4 Plane 5
Plane 3
Plane 1
Plane 0 Plane 2
Plane 7
Plane 6
13=0000 1101
Thank You

More Related Content

PPTX
UNIT-2-PPT1-Image Enhancement in Spatial Domain.pptx
PDF
DIP Lecture 7-9.pdf
PPT
Image Enhancement in the Spatial Domain1.ppt
PPT
Image enhancement in the spatial domain1
PDF
Gonzalez, rafael,c.digitalimageprocessingusing matlab
PPTX
Dip day1&2
PPTX
Lightening & Darkening of Grayscale Image
PPTX
Chapter 3 image enhancement (spatial domain)
UNIT-2-PPT1-Image Enhancement in Spatial Domain.pptx
DIP Lecture 7-9.pdf
Image Enhancement in the Spatial Domain1.ppt
Image enhancement in the spatial domain1
Gonzalez, rafael,c.digitalimageprocessingusing matlab
Dip day1&2
Lightening & Darkening of Grayscale Image
Chapter 3 image enhancement (spatial domain)

Similar to Image processinglab image processing image processing (20)

PPTX
Intensity Transformation and Spatial filtering
PPTX
Intensity transformation & histogram processing
PPT
Intensity Transformation and Spatial Filtering -Gonzales Chapter 3.1-3.3 (4).ppt
PPTX
IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN.pptx
PDF
Computer graphics is drawing pictures by using computer aided methods and alg...
PPTX
Image Processing - Unit II - Image Enhancement discussed
PPTX
Image Enhancement in Spatial Domain and Frequency Domain
PPT
Digital Image through Scanner, Digital Camera. Concept of Gray Levels.
PPT
Chap5 imange enhancemet
PPT
image enhancement
PPTX
Module 2
PPTX
Image Enhancement in Spatial Domain
PPT
Image Enhancement in the Spatial Domain U2.ppt
PPT
Image enhancement
PDF
4.intensity transformations
PPTX
Unit 2. Image Enhancement in Spatial Domain.pptx
PPTX
Intensity Transformation Functions of image with Matlab
PPT
Digital Image Processing_ ch2 enhancement spatial-domain
DOCX
Digtial Image Processing Q@A
PPTX
Images in matlab
Intensity Transformation and Spatial filtering
Intensity transformation & histogram processing
Intensity Transformation and Spatial Filtering -Gonzales Chapter 3.1-3.3 (4).ppt
IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN.pptx
Computer graphics is drawing pictures by using computer aided methods and alg...
Image Processing - Unit II - Image Enhancement discussed
Image Enhancement in Spatial Domain and Frequency Domain
Digital Image through Scanner, Digital Camera. Concept of Gray Levels.
Chap5 imange enhancemet
image enhancement
Module 2
Image Enhancement in Spatial Domain
Image Enhancement in the Spatial Domain U2.ppt
Image enhancement
4.intensity transformations
Unit 2. Image Enhancement in Spatial Domain.pptx
Intensity Transformation Functions of image with Matlab
Digital Image Processing_ ch2 enhancement spatial-domain
Digtial Image Processing Q@A
Images in matlab
Ad

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation theory and applications.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
cuic standard and advanced reporting.pdf
Empathic Computing: Creating Shared Understanding
Advanced methodologies resolving dimensionality complications for autism neur...
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Machine learning based COVID-19 study performance prediction
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation theory and applications.pdf
Ad

Image processinglab image processing image processing

  • 1. Image processing Lab 3 By: Eng Noha Abd-Elkareem
  • 2. Histogram processing • Histogram: gray level against number of pixel for gray level • provide distribution of pixel values. • Illustrate brightness and contrast of image
  • 3. MATLAB code • For gray &binary image imhist(image) display histogram of 2d image • For RGB image imhist(RGB(:,:,1)) imhist(RGB(:,:,2)) imhist(RGB(:,:,3)) • Task1 • Create function that get gray or RGB image and return histogram •
  • 6. Basic intensity transformation functions • There are three basic Types of functions: Linear(negative and Identity transformation). Logarithmic (Log and invers-log transformation). Power-low(nth-power and nth-root transformation).
  • 8. Logarithmic transformation • General form: s = c * log𝟐(𝟏 + 𝒓) The log transformation maps a narrow range of low input grey level values into a wider range of output values .(brights images). • The inverse log transformation performs the opposite transformation . S=exp(r)
  • 9. • The negative of the image with intensity level in the range [0,L-1] is given by the expression: S=L-1-r • Power-law (gamma) transformation s= 𝑐 ∗ 𝑟𝑦
  • 10. Task2(Practical) Log, inverse log . power, root and negative(imcomplement(I)) (im2double&im2uint8)
  • 11. Q)A 4x4 , 4bits/pixel image passes through appoint-wise intensity transformation given by S=T(r) = αlog2 1 + 𝑟 + 𝛽 Where α and 𝛽 are unknown parameters. Only a few pixels are available in the input and output images , as shown below (a) Find α and 𝛽 (b)what is the value of the pixel with the “?” mark in the output image. (c)what is the value of the pixel with the “?” mark in the input image. 3 15 ? 1 3 5 11 8 ? 5 T(r)
  • 12. Q) A4x4,4bits/pixel image (shown below) passes through one point-wise intensity transformations given by S=T(r)= round(5 𝑟 ) 7 3 4 1 1 2 0 3 4 2 2 1 0 3 5 1 T(r)
  • 13. Piecewise Linear Transformation Functions • Contrast stretching. • Equation • New value= 𝑣𝑎𝑙𝑢𝑒−𝑜𝑙𝑑𝑚𝑖𝑛 𝑜𝑙𝑑𝑚𝑎𝑥−𝑜𝑙𝑑𝑚𝑖𝑛 ∗ 𝑛𝑒𝑤 𝑚𝑎𝑥 − 𝑛𝑒𝑤 𝑚𝑖𝑛 + 𝑛𝑒𝑤 𝑚𝑖𝑛
  • 14. Contrast stretching example • Q) A4*4, 4bits/pixel original image is given by Apply full-scale contrast stretch to the image . show your work and sketch the resulting image • old min=6 old max=14 • new min=0 new max=15 • New value= 6−6 14−6 ∗ 15 − 0 + 0 = 0 • New value= 13−6 14−6 ∗ 15 − 0 + 0 =13
  • 15. Contrast stretching matlab code • Imadjust(I,[oldmin oldmax],[newmin newmax]) • Task3 Contrast stretching mfile that take gray or RGB image Min(min(I)) Max(max(I))
  • 16. Intensity level slicing • Highlights a specific range of grey levels.
  • 17. Bit Plane Slicing • Often by isolating particular bits of the pixel values in an image we can highlight interesting aspects of that image • 10110011 most • most least • significant significant
  • 18. Bit Plane Slicing example 255 13 127 7 55 40 150 255 160 20 200 14 170 90 255 9 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 Plane 4 Plane 5 Plane 3 Plane 1 Plane 0 Plane 2 Plane 7 Plane 6 13=0000 1101