Machine Vision for Robotic Systems
METE 4500U
Digital Image Basics
Topics
• Image Sensing & Acquisition
• Digital Image Resolution
• Interpolation
• Basic Image Processing Tasks using Arithmetic
• Basic Image Processing Tasks using Logical Operation
Image Sensing &
Acquisition
Pinhole Camera
Digital Camera and Sensor Technologies
• Single sensor: often uses a photodiode
converting light to voltage
• Sensor strip: one-dimension sensor
combined with motion for scanning
• Sensor array: 2D capture using CCD
(Charge-Coupled Device) or CMOS active
pixel sensors (e.g., webcams, phone
cameras)
Digital Camera and Sensor Technologies
Combining a single sensing element
with mechanical motion to generate a
2-D image.
(a) Image acquisition using a linear
sensor strip. (b) Image acquisition
using a circular sensor strip.
Digital Camera and Sensor Technologies
• Images result from the interaction of
illumination i(x, y) and surface
reflectance r(x, y):
๐(๐ฅ, ๐ฆ) = ๐(๐ฅ, ๐ฆ) ∗ ๐(๐ฅ, ๐ฆ)
A Different
vision
• Extracting information
from a matrix of
numbers
Digital Image Resolutions
A Digital Image
• A digital image is composed of a finite
number of elements, each of which
has a particular location and value.
These elements are called picture
elements, image elements, pels, and
pixels.
• When, both spatial coordinates
๐ฅ, ๐ฆ and the intensity values of ๐ are all
finite, discrete quantities, we call the
image a digital image
Image Digitization
• Spatial Digitizing: Sampling
โช Converting continuous spatial information into
discrete pixels
โช Sampling interval ≤ 1/(2 × Maximum frequency)
โช Insufficient sampling causes aliasing at edges
• Intensity Digitizing: Quantization
โช Converting continuous intensity values into
discrete levels
โช 8-bit grayscale: 256 possible values (0-255)
โช 24-bit color: 16.7 million possible combinations
Spatial Digitizing (Sampling)
Intensity Digitizing (Quantization)
Resolution Types
• Spatial Resolution: Column (C) by row (R) dimensions
defining the number of pixels covering the visual space
(e.g., 640×480, 1024×768),
• Intensity resolution (Bit Resolution): the smallest
discernible change in gray level, Number of possible
intensity/color values per pixel (e.g., binary: 2 bit,
grayscale: 8 bit, 16 bits or color: 24 bit), [0, ๐ฟ − 1] with
๐ฟ = 2๐ gray levels. false contouring if too few levels.
• Temporal Resolution: For video capture, the number of
images captured in each period, measured in frames
per second (fps)
• Contrast: difference between maximum and minimum
intensity values
Number of megabytes required to store
images with N*N spatial resolution and K bit
Spatial
Resolution
• Column (C) by row (R) dimensions
(e.g., 640×480, 1024×768),
• Dpi (dots per inch), measured in line
pairs per unit distance
Effects of reducing spatial resolution. The
images shown are at: (a) 930 dpi, (b) 300
dpi, (c) 150 dpi, and (d) 72 dpi.
Intensity
Resolution
(e)-(h) Image
displayed in 16,
8, 4, and 2
intensity levels.
(Original image
courtesy of the
National Cancer
Institute.)
(a ) 2022 × 1800,
256-level image. (b)-(d) Image displayed in 128,
64, and 32 intensity levels, while keeping the image
size constant. (Original image courtesy of the National
Cancer Institute.)
Image Types based on Intensity
Resolution
Binary Images
Grayscale Images
RGB Images
2-D arrays with values from set {0,1}.
2-D arrays with one numerical value per
3-D arrays with three values per pixel
Black (0) represents background pixels,
pixel representing intensity, typically 8-
(red, green, blue channels), typically 24-
white (1) represents foreground pixels.
bit (256 levels).
bit total.
Level of details
(a) Image with a low level of detail. (b) Image with a
medium level of detail. (c) Image with a relatively large
amount of detail. (Image (b) courtesy of the
Massachusetts Institute of Technology.)
Image Representation in MATLAB
Image I/O and Display
1
• I = imread(‘file name');
•
imshow(I);
•
imwrite(I, ‘file name');
• Data types: Images often stored as uint8, uint16, double.
Image View Tools
1
Interpolation
Interpolation
• Interpolation is used in tasks such as zooming, shrinking, rotating,
and geometrically correcting digital images.
• Interpolation is the process of using known data to estimate
values at unknown locations.
Interpolation methods
• Nearest neighbor: simplest, but may distort edges
• Bilinear: linear interpolation between 4 nearest neighbors
๐ ๐ฅ, ๐ฆ = ๐๐ฅ + ๐๐ฆ + ๐๐ฅ๐ฆ + ๐
The coefficient ๐, ๐, ๐, ๐ are obtained from 4 nearest neighbors
• Bicubic: uses 16 neighbors with derivatives for smooth results. It
is common in image editing software
3
๐ ๐ฅ, ๐ฆ = เท
3
เท
๐=0
๐=0
๐๐๐ ๐ฅ ๐ ๐ฆ ๐
Where teh coefficient ๐๐๐ are obtained from 4 nearest neighbors
Example
(a) Image reduced to 72 dpi and zoomed back to its original 930 dpi
using nearest neighbor interpolation. This figure is the same as Fig.
2.23(d). (b) Image reduced to 72 dpi and zoomed using bilinear
interpolation. (c) Same as (b) but using bicubic interpolation.
Basic Image Processing
Tasks using Arithmetic
Linear versus Non-linear Operations
• Linear operation:
๐ ๐๐ ๐ฅ, ๐ฆ + ๐๐ ๐ฅ, ๐ฆ
Otherwise, it is nonlinear.
= ๐๐ ๐ ๐ฅ, ๐ฆ
+ ๐๐[๐ ๐ฅ, ๐ฆ ]
Elementwise versus Matrix Operation
• Matrix:
๐
๐
๐
๐
×
๐
๐
๐๐ + ๐๐
๐
=
โ
๐๐ + ๐๐
• Elementwise operation:
๐
๐ ๐
โ
๐
๐ ๐
๐
๐๐
=
โ
๐๐
Note: We mostly deal with elementwise operation.
๐๐ + ๐โ
๐๐ + ๐โ
๐๐
๐โ
Arithmetic Operations between images
For two M × N matrix :
๐ ๐ฅ, ๐ฆ = ๐ ๐ฅ, ๐ฆ + ๐ ๐ฅ, ๐ฆ
๐ ๐ฅ, ๐ฆ = ๐ ๐ฅ, ๐ฆ − ๐ ๐ฅ, ๐ฆ
๐ ๐ฅ, ๐ฆ = ๐ ๐ฅ, ๐ฆ × ๐ ๐ฅ, ๐ฆ
๐ฃ ๐ฅ, ๐ฆ = ๐ ๐ฅ, ๐ฆ ÷ ๐ ๐ฅ, ๐ฆ
These are elementwise operation
Example, Averaging for noise cancelation
(a) Sample noisy image of the Sombrero Galaxy. (b)-(f) Result of averaging 10, 50, 100, 500, and 1,000
noisy images, respectively. All images are of size 1548×2238 pixels, and all were scaled so that their
intensities would span the full [0, 255] intensity scale. (Discovered in 1767, the Sombrero Galaxy is 28
light years from Earth. Original image courtesy of NASA.)
Example, Subtraction for comparing
(a) Infrared image of the Washington, D.C. area. (b) Image resulting from setting to zero the least
significant bit of every pixel in (a). (c) Difference of the two images, scaled to the range [0, 255]
for clarity. (Original image courtesy of NASA.)
Example, Subtraction for comparing
Digital subtraction angiography. (a)
Mask image. (b) A live image. (c)
Difference between (a) and (b). (d)
Enhanced difference image.
(Figures (a) and (b) courtesy of the
Image Sciences Institute,
University Medical Center, Utrecht,
The Netherlands.)
Example, Multiplication for Shading
correction
Shading correction. (a) Shaded test pattern. (b) Estimated shading pattern. (c)
Product of (a) by the reciprocal of (b). (See Section 3.5 for a discussion of how (b) was
estimated.)
Example, Multiplication
(a) Digital dental X-ray image. (b) ROI mask for isolating teeth with fillings (white
corresponds to 1 and black corresponds to 0). (c) Product of (a) and (b).
Basic Image Processing
Tasks using Logical
Operation
Illustration of
logical operations
Illustration of logical operations
involving foreground (white)
pixels. Black represents binary
0’s and white binary 1’s. The
dashed lines are shown for
reference only. They are not part
of the result.
References
• Digital Image Processing Using MATLAB, 3rd Edition, Rafael Gonzalez, Richard Woods, and
Steven Eddins, Gatesmark Publishing, 2020, ISBN: 9780982085417, book website:
https://www.imageprocessingplace.com/index.htm
• Digital Image Processing, 4th Edition, Rafael Gonzalez and Richard Woods, Pearson, 2018,
ISBN: 9780133356724, book
website: https://www.imageprocessingplace.com/index.htmLinks to an external site.
• Figures and images in this lecture materials are taken from the referenced textbooks listed
above. They are used solely for educational and illustrative purposes.