CS482 CS482
Selected Topics in Digital Image Selected Topics in Digital Image ProcessingProcessing
الرحيم الرحمن الله الرحيم بسم الرحمن الله بسم
Instructor: Dr. Abdullah Basuhail ,CSD, FCIT, KAU, 1432H
Chapter 2: Chapter 2: Digital Image Digital Image FundamentalsFundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 2
Visual PerceptionVisual Perception Mach bands: visual system tends to
undershoot or overshoot around the boundary of regions of different intensities
Simultaneous contrast: region’s perceived brightness does not depend on its intensity
Optical illusions: eye fills in nonexisting information or wrongly perceives geometrical properties of objects
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 6
Representing Digital ImagesRepresenting Digital Images Digital image
M N array L discrete intensities – power of 2
L = 2k
Integers in the interval [0, L - 1] Dynamic range: ratio of maximum / minimum intensity
Low: image has a dull, washed-out gray look Contrast: difference between highest and lowest
intensity High: image have high contrast
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 8
Representing Digital ImagesRepresenting Digital Images Digital image
# bits to store : b = M N k When M = N: b = N2k k-bit image: e.g. an image with 256 possible
discrete intensity values is called an 8-bit image
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 10
Spatial and Intensity Spatial and Intensity ResolutionResolution Resolution: dots (pixels) per unit distance dpi: dots per inch
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 12
Variation of Number of Intensity Variation of Number of Intensity LevelsLevels Reducing the number of bits from k=7 to
k=1 while keeping the image size constant Insufficient number of intensity levels in smooth
areas of digital image leads to false contouring
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 15
Image InterpolationImage Interpolation Using known data to estimate values at unknown
locations Used for zooming, shrinking, rotating, and geometric
corrections Nearest Neighbor interpolation
Use closest pixel to estimate the intensity simple but has tendency to produce artifact
Bilinear interpolation use 4 nearest neighbor to estimate the intensity Much better result
Bicubic interpolation Use 16 nearest neighbors of a point
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
16
Interpolation works by using known data to estimate values at unknown points .For example: if you wanted to know the temperature at noon, but only measured it
at 11AM and 1PM, you could estimate its value by performing a linear interpolation:
If you had an additional measurement at 11:30AM, you could see that the bulk of the temperature rise occurred before noon, and could use this additional data point
to perform a quadratic interpolation:
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
The more temperature measurements you have which are close to noon, the more sophisticated (and hopefully more accurate) your interpolation algorithm can be.
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Nearest neighbor is the most basic and requires the least processing time of all the interpolation algorithms because it only considers one pixel — the closest one
to the interpolated point. This has the effect of simply making each pixel bigger.
NEAREST NEIGHBOR INTERPOLATION
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
BILINEAR INTERPOLATION
Bilinear interpolation considers the closest 2x2 neighborhood of known pixel values surrounding the unknown pixel. It then takes a weighted average of
these 4 pixels to arrive at its final interpolated value .
This results in much smoother looking images than nearest neighbor.
The diagram to the left is for a case when all known pixel distances are equal, so the interpolated value is simply their sum divided by four.
dcxybyaxyxv ),(
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
BICUBIC INTERPOLATION
Bicubic goes one step beyond bilinear by considering the closest 4x4 neighborhood of known pixels — for a total of 16 pixels.
Since these are at various distances from the unknown pixel, closer pixels are given a higher weighting in the calculation .
Bicubic produces noticeably sharper images than the previous two methods, and is perhaps the ideal combination of processing time and output quality.
For this reason it is a standard in many image editing programs (including Adobe Photoshop), printer drivers and in-camera interpolation.
ji
i jij yxayxv
3
0
3
0
),(
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
The intensity value assigned to point (x,y) is obtained by equation where the sixteen coefficients are determined from the sixteen equations in sixteen unknowns that can be written using the sixteen nearest neighbours of point (x,y)
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 23
Arithmetic OperationsArithmetic Operations Array operations between images Carried out between corresponding pixel
pairs Four arithmetic
s(x, y) = f(x, y) + g(x, y)
d(x, y) = f(x, y) – g(x, y)
p(x, y) = f(x, y) g(x, y)
v(x, y) = f(x, y) ÷ g(x, y)
e.g. Averaging K different noisy images can decrease noise Used in the field of astronomy
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Averaging K different noisy images can decrease noise. Used in astronomy
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Enhancement of difference between images using image subtraction
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Mask mode radiography
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Shading correction by image multiplication (and division)
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Masking (ROI) using image multiplication
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 29
Arithmetic OperationsArithmetic Operations To guarantee that the full range of an
arithmetic operation between images is captured into a fixed number of bits, the following approach is performed on image f
fm = f – min(f)
which creates an image whose minimum value is 0. Then the scaled image is
fs = K [ fm / max(fm)]
whose value is in the range [0, K]
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 30
Set and Logical OperationsSet and Logical Operations Sets can be used to let the elements of sets
be the coordinates of pixels (ordered pairs of integers) representing regions (objects) in an image Union Intersection Complement Difference
Logical operations OR AND NOT XOR
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 34
Spatial OperationsSpatial Operations Single-pixel operations
For example, transformation to obtain the negative of an 8-bit image
S = T (z)
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 36
Spatial OperationsSpatial Operations Neighborhood operations
For example, compute the average value of the pixels in a rectangular neighborhood of size m n centered on (x, y)
xyScr
crfmn
yxg),(
),(1
),(
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 38
Spatial OperationsSpatial Operations Geometric spatial transformations
Called rubber-sheet transformations Consists of two operations
Spatial transformation of coordinatese.g. (x, y) = T { ( v, w) } = ( v/2, w/2) Affine transform: scale, rotate, transform, or sheer a
set of points Intensity interpolation
1
0t
0tt
1] w[v T 1] w[]1 [
3231
2221
1211
tt
tvyx
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 42
Vector and Matrix OperationsVector and Matrix Operations RGB images Multispectral images
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
CS382, CSD, FCIT, KAU, KSA Based on textbook: Digital Image Processing, 3rd Edition, by Gonzalez and Woods Compiled by: Dr. Abdullah Basuhail , 1432H 44
Image TransformsImage Transforms Image processing tasks are best
formulated by Transforming the images Carrying the specified task un a transform
domain Applying the inverse transform
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.
www.ImageProcessingPlace.com
© 1992–2008 R. C. Gonzalez & R. E. Woods
Gonzalez & Woods
Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals