![Page 2: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/2.jpg)
ME5286 – Lecture 4
Reminder• 2nd Quiz on the manipulator Part is this Fri, April 17
2015, 11:15 AM to 1:10 PM• Open Book, Open Notes, Focus on the material covered
since the 1st Quiz• All the videos of the lectures are available• The Students will be split in 2 locations, Students with
last name starting at:– A-K, should come to ME 102– L-Z come to ME 18– Unite students take the quiz at their own location
• Conflict with Friday slot, Email Prof Donath ASAP
#2
![Page 3: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/3.jpg)
ME5286 – Lecture 4
#3
Last Vision Lecture
• Digital Image Representation– Sampling – Quantization
• Color Fundamentals– Color Spaces
• Digital Cameras– 2 types of Sensors– Single Sensor for 3 Color Planes
![Page 4: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/4.jpg)
ME5286 – Lecture 4
#4
Any Questions for HW#1
?Office Hours:1:15 – 1:50
Today Only
![Page 5: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/5.jpg)
ME5286 – Lecture 4
#5
Outline of this Lecture
• Spatial Domain Transformation– Point Processing Transformations
• Pixel Mapping• Histogram Processing
– Area/Mask Processing Transformations• Image Filtering
– Frame Processing Transformations– Geometric Transformations
![Page 6: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/6.jpg)
ME5286 – Lecture 4
Digital Image Processing
• Pixel Processing: change range of image• g(x) = h(f(x))
f
x
hf
x
f
x
hf
x
• Geometric Transform: change domain of imageg(x) = f(h(x))
![Page 7: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/7.jpg)
ME5286 – Lecture 4
Digital Image Processing
h
h
f
f g
g
• Pixel Processing : change range of image• g(x) = h(f(x))
• Geometric Transform : change domain of imageg(x) = f(h(x))
![Page 8: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/8.jpg)
ME5286 – Lecture 4
Spatial Domain Methods
Point Processing
Area/Mask Processing
![Page 9: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/9.jpg)
ME5286 – Lecture 4
Point Processing• The simplest kind of range transformations are
independent of the position x,y:• g = t(f)
• This is called point processing.
• What can they do?• What’s the form of t?
• Important: every pixel is mapped independently – spatial information completely lost!
![Page 10: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/10.jpg)
ME5286 – Lecture 4
#10
Point Processing Methods• The most primitive, yet essential, image processing operations.• Intensity transformations that convert an old pixel into a new
pixel based on some predefined function.• Operate on a pixel based solely on that pixel’s value.• Used primarily for image enhancement.
Transformation function
![Page 11: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/11.jpg)
ME5286 – Lecture 4
Identity Transformation
![Page 12: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/12.jpg)
ME5286 – Lecture 4
Negative Image
• O(r,c) = 255-I(r,c)
![Page 13: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/13.jpg)
ME5286 – Lecture 4
Negative Image
![Page 14: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/14.jpg)
ME5286 – Lecture 4
Contrast Stretching or Compression
• Stretch gray-level ranges where we desire more information (slope > 1).
• Compress gray-level ranges thatare of little interest(0 < slope < 1).
![Page 15: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/15.jpg)
ME5286 – Lecture 4
Point Pocessing Methods• Thresholding: Special case of contrast compression
![Page 16: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/16.jpg)
ME5286 – Lecture 4
#16
Point Processing Methods• Intensity-level
slicing– Highlight a specific
range of gray-levels only
– Acts as double thresholding
![Page 17: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/17.jpg)
ME5286 – Lecture 4
Bit-level Slicing• Highlighting the contribution made by a
specific bit.• For pgm images, each pixel is represented
by 8 bits.• Each bit-plane is a binary image
![Page 18: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/18.jpg)
ME5286 – Lecture 4
![Page 19: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/19.jpg)
ME5286 – Lecture 4
Logarithmic transformation• Non-linear transformations
– We may use any function, provided that is gives a one-to-one or many-to-one (i.e., single-valued) mapping.
• Enhance details in the darker regions of an image at the expense of detail in brighter regions.
rcrTs 1logcompress
stretch
![Page 20: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/20.jpg)
ME5286 – Lecture 4
Log Stretching
![Page 21: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/21.jpg)
ME5286 – Lecture 4
Exponential transformation• Reverse effect of that obtained using logarithmic
mapping.
compress
stretch
![Page 22: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/22.jpg)
ME5286 – Lecture 4
Basic Point Processing
![Page 23: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/23.jpg)
ME5286 – Lecture 4
Power-law transformations
![Page 24: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/24.jpg)
ME5286 – Lecture 4
Image Enhancement
![Page 25: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/25.jpg)
ME5286 – Lecture 4
Contrast Stretching
![Page 26: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/26.jpg)
ME5286 – Lecture 4
Image Histogram
#26
![Page 27: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/27.jpg)
ME5286 – Lecture 4
#27
Image Intensity Histogram
• The histogram of a digital image with gray levels from 0 to L-1 is a discrete function h(rk)=nk, where:
– rk is the kth gray level– nk is the # pixels in the image with that gray level– n is the total number of pixels in the image– k = 0, 1, 2, …, L-1
• Normalized histogram: p(rk)=nk/n– sum of all components = 1
![Page 28: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/28.jpg)
ME5286 – Lecture 4
#28
Building Distributions
50 70 100 110 150
60
80
70
40
Number of Pixels
Intensity of Green Channel
0
80 80( 100) 0.2540 60 2 70 80 320GP t
![Page 29: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/29.jpg)
ME5286 – Lecture 4
Example: Image Histograms
• An image histogram is a plot of the gray-level frequencies (i.e., the number of pixels in the image that have that gray level).
![Page 30: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/30.jpg)
ME5286 – Lecture 4
Example: Image Histograms
• Divide frequencies by total number of pixels to represent as probabilities.
Nnp kk /
![Page 31: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/31.jpg)
ME5286 – Lecture 4
Image Histograms
![Page 32: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/32.jpg)
ME5286 – Lecture 4
Properties of Image Histograms
• Histograms clustered at the low end correspond to dark images.• Histograms clustered at the high end correspond to bright
images.
![Page 33: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/33.jpg)
ME5286 – Lecture 4
Properties of Image Histograms• Histograms with small spread correspond to low contrast
images (i.e., mostly dark, mostly bright, or mostly gray).• Histograms with wide spread correspond to high contrast
images.
![Page 34: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/34.jpg)
ME5286 – Lecture 4
Properties of Image HistogramsLow contrast High contrast
![Page 35: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/35.jpg)
ME5286 – Lecture 4
#35
Histogram Processing
• The shape of the histogram of an image does provide useful info about the possibility for contrast enhancement.
• Types of processing:
Histogram equalizationHistogram matching (specification)Local enhancement
![Page 36: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/36.jpg)
ME5286 – Lecture 4
#36
Point Processing Methods• Histogram equalization
– Low contrast images are usually mostly dark, mostly light, or mostly gray.
– High contrast images have large regions of dark and large regions of white.
– Good contrast images exhibit a wide range of pixel values (i.e., no single gray level dominates the image).
![Page 37: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/37.jpg)
ME5286 – Lecture 4
#37
Point Processing Methods• Histogram equalization
– is a transformation that stretches the contrast by redistributing the gray-level values uniformly.
– is fully automatic compared to other contrast stretching techniques.
![Page 38: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/38.jpg)
ME5286 – Lecture 4
#38
Histogram Equalization• As mentioned above, for gray levels that take on
discrete values, we deal with probabilities: pr(rk)=nk/n, k=0,1,.., L-1
nk is the number of pixels with rk gray leveln is the total number of pixelsk= 0,1,…,255
– The plot of pr(rk) versus rk is called a histogram and the technique used for obtaining a uniform histogram is known as histogram equalization (or histogram linearization).
![Page 39: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/39.jpg)
ME5286 – Lecture 4
How do we determine this grey scale transformation function?
Assume our grey levels are continuous and have been normalized to lie between 0 (black) and 1 (white).
We must find a transformation T that maps grey values r in the input image F to grey values s = T(r) in the transformed image .
It is assumed that
T is single valued and monotonically increasing, and
for
The inverse transformation from s to r is given by :
r = T-1(s).
![Page 40: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/40.jpg)
ME5286 – Lecture 4
An example of such a transfer function is illustrated in the Figure
![Page 41: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/41.jpg)
ME5286 – Lecture 4
#41
Histogram Equalization
• Histogram equalization(HE) results are similar to contrast stretching but offer the advantage of full automation, since HE automatically determines a transformation function to produce a new image with a uniform histogram.
)()(0 0
j
k
j
k
jr
jkk rp
nn
rTs
http://homepages.inf.ed.ac.uk/rbf/HIPR2/histeq.htm
![Page 42: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/42.jpg)
ME5286 – Lecture 4
Histogram Equalization
• A fully automatic gray-level stretching technique.
![Page 43: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/43.jpg)
ME5286 – Lecture 4
#43
Point Processing Methods• Histogram equalization
– In practice, the histogram might not become totally flat !
![Page 44: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/44.jpg)
ME5286 – Lecture 4
#44
Histogram Specification
• Histogram equalization does not allow interactive image enhancement and generates only one result: an approximation to a uniform histogram.
• Sometimes though, we need to be able to specify particular histogram shapes capable of highlighting certain gray-level ranges.
![Page 45: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/45.jpg)
ME5286 – Lecture 4
#45
Histogram Specification
• The procedure for histogram-specification based enhancement is:
– Equalize the levels of the original image using:
k
j
jk n
nrTs
0
)(
n: total number of pixels,
nj: number of pixels with gray level rj,
L: number of discrete gray levels
![Page 46: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/46.jpg)
ME5286 – Lecture 4
#46
Histogram Specification
– Specify the desired density function and obtain the transformation function G(z):
z
i
iz
z nnwpzGv
00
)()(
– Apply the inverse transformation function z=G-1(s) to the levels obtained in step 1.
pz: specified desirable PDF for output
![Page 47: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/47.jpg)
ME5286 – Lecture 4
#47
Histogram Specification
• The new, processed version of the original image consists of gray levels characterized by the specified density pz(z).
)]([ )( 11 rTGzsGz In essence:
![Page 48: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/48.jpg)
ME5286 – Lecture 4
#48
Histogram Specification
• The principal difficulty in applying the histogram specification method to image enhancement lies in being able to construct a meaningful histogram. So…
![Page 49: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/49.jpg)
ME5286 – Lecture 4
#49
Histogram Specification
– Either a particular probability density function (such as a Gaussian density) is specified and then a histogram is formed by digitizing the given function,
– Or a histogram shape is specified on a graphic device and then is fed into the processor executing the histogram specification algorithm.
![Page 50: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/50.jpg)
ME5286 – Lecture 4
#50
Local Enhancement
– Desire to enhance a local region– Local Enhancement is achieved by applying
histogram processing ( Equalization ) on a local region instead of the whole image
![Page 51: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/51.jpg)
ME5286 – Lecture 4
Histogram Color Processing
• can apply histogram equalization to color images
• don't want to apply it using the RGB color model - equalizing R, G, and B bands independently causes color shifts
• must convert to a color model that separates intensity information from color information (e.g. HSI)
• can then apply histogram equalization on the intensity band
![Page 52: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/52.jpg)
ME5286 – Lecture 4
Area Mask ProcessingOR
Image Filtering
#52
![Page 53: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/53.jpg)
ME5286 – Lecture 4
Spatial Domain Methods
Point Processing
Area/Mask Processing
![Page 54: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/54.jpg)
ME5286 – Lecture 4
#54
Area/Mask Processing Methods• A pixel value is computed from its old value and the
values of pixels in its vicinity.• More costly operations than simple point processes, but
more powerful.• What is a Mask?
– A mask is a small matrix whose values are called weights.– Each mask has an origin, which is usually one of its positions.– The origins of symmetric masks are usually their center pixel
position.
![Page 55: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/55.jpg)
ME5286 – Lecture 4
#55
Area/Mask Processing Methods• Examples:
• Applying masks to images (filtering)– The application of a mask to an input image produces an
output image of the same size as the input.– For linear filters, the operation is a linear operation on the
image pixels
![Page 56: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/56.jpg)
ME5286 – Lecture 4
Linear Mask Processing Methods
• Two main linear Mask Operation or Spatial Filtering methods:– Correlation– Convolution
![Page 57: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/57.jpg)
ME5286 – Lecture 4
#57
Area/Mask Processing Methods• Cross Correlation
– Correlation applies the mask directly to the image without flipping it.– It is often used in applications where it is necessary to measure the
similarity between images or parts of images.– If the mask is symmetric (i.e., the flipped mask is the same as the original
one) then the results of convolution and correlation are the same.
![Page 58: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/58.jpg)
ME5286 – Lecture 4
Correlation
OutputImage
w(i,j)
f(i,j)
/2 /2
/2 /2( , ) ( , ) ( , ) ( , ) ( , )
K K
s K t Kg x y w x y f x y w s t f x s y t
g(i,j)
![Page 59: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/59.jpg)
ME5286 – Lecture 4
Convolution
• Similar to correlation except that the mask is first flipped both horizontally and vertically.
Note: if w(x,y) is symmetric, that is w(x,y)=w(-x,-y), then convolution is equivalent to correlation!
/2 /2
/2 /2( , ) ( , ) ( , ) ( , ) ( , )
K K
s K t Kg x y w x y f x y w s t f x s y t
![Page 60: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/60.jpg)
ME5286 – Lecture 4
#60
Area/Mask Processing Methods• Convolution
1) For each pixel in the input image, the mask is conceptually placed on top of the image with its origin lying on that pixel.
2) The values of each input image pixel under the mask are multiplied by the values of the corresponding mask weights.
3) The results are summed together to yield a single output value that is placed in the output image at the location of the pixel being processed on the input.
![Page 61: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/61.jpg)
ME5286 – Lecture 4
Example
Correlation:
Convolution:
![Page 62: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/62.jpg)
ME5286 – Lecture 4
#62
Area/Mask Processing Methods• Normalization of mask weights
• Practical problems– How to treat the image borders?– Time increases exponentially with
mask size.
– The sum of weights in the convolution mask affect the overall intensity of the resulting image.
– Many convolution masks have coefficients that sum to 1 (convolved image will have the same average intensity as the original one).
– Some masks have negative weights and sum to 0.– Pixels with negative values may be generated using masks with negative weights.– Negative values are mapped to the positive range through appropriate
normalization.
![Page 63: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/63.jpg)
ME5286 – Lecture 4
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
Credit: S. Seitz
],[],[],[,
lnkmflkgnmhlk
[.,.]h[.,.]f
Image filtering111
111
111
],[g
![Page 64: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/64.jpg)
ME5286 – Lecture 4
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
[.,.]h[.,.]f
Image filtering111
111
111
],[g
Credit: S. Seitz
],[],[],[,
lnkmflkgnmhlk
![Page 65: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/65.jpg)
ME5286 – Lecture 4
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
[.,.]h[.,.]f
Image filtering111
111
111
],[g
Credit: S. Seitz
],[],[],[,
lnkmflkgnmhlk
![Page 66: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/66.jpg)
ME5286 – Lecture 4
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
[.,.]h[.,.]f
Image filtering111
111
111
],[g
Credit: S. Seitz
],[],[],[,
lnkmflkgnmhlk
![Page 67: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/67.jpg)
ME5286 – Lecture 4
0 10 20 30 30
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
[.,.]h[.,.]f
Image filtering111
111
111
],[g
Credit: S. Seitz
],[],[],[,
lnkmflkgnmhlk
![Page 68: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/68.jpg)
ME5286 – Lecture 4
0 10 20 30 30
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
[.,.]h[.,.]f
Image filtering111
111
111
],[g
Credit: S. Seitz
?
],[],[],[,
lnkmflkgnmhlk
![Page 69: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/69.jpg)
ME5286 – Lecture 4
0 10 20 30 30
50
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
[.,.]h[.,.]f
Image filtering111
111
111
],[g
Credit: S. Seitz
?
],[],[],[,
lnkmflkgnmhlk
![Page 70: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/70.jpg)
ME5286 – Lecture 4
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20 40 60 60 60 40 20
0 30 60 90 90 90 60 30
0 30 50 80 80 90 60 30
0 30 50 80 80 90 60 30
0 20 30 50 50 60 40 20
10 20 30 30 30 30 20 10
10 10 10 0 0 0 0 0
[.,.]h[.,.]f
Image filtering111111111],[g
Credit: S. Seitz
],[],[],[,
lnkmflkgnmhlk
![Page 71: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/71.jpg)
ME5286 – Lecture 4
What does it do?• Replaces each pixel with an
average of its neighborhood
• Achieve smoothing effect (remove sharp features)
111
111
111
Slide credit: David Lowe (UBC)
],[g
Box Filter
![Page 72: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/72.jpg)
ME5286 – Lecture 4
Smoothing with box filter
![Page 73: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/73.jpg)
ME5286 – Lecture 4
Practice with linear filters
000010000
Original
?
Source: D. Lowe
![Page 74: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/74.jpg)
ME5286 – Lecture 4
Practice with linear filters
000010000
Original Filtered (no change)
Source: D. Lowe
![Page 75: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/75.jpg)
ME5286 – Lecture 4
Practice with linear filters
000100000
Original
?
Source: D. Lowe
![Page 76: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/76.jpg)
ME5286 – Lecture 4
Practice with linear filters
000100000
Original Shifted leftBy 1 pixel
Source: D. Lowe
![Page 77: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/77.jpg)
ME5286 – Lecture 4
#77
Area/Mask Processing Methods• Smoothing (or Low-Pass) Filters
• Averaging or mean filter– Elements of mask must be positive.– Size of mask degree of smoothing.
– Useful for noise reduction and image blurring.– Remove the finer details of an image.
![Page 78: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/78.jpg)
ME5286 – Lecture 4
Practice with linear filters
Original
111111111
000020000 - ?
(Note that filter sums to 1)
Source: D. Lowe
![Page 79: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/79.jpg)
ME5286 – Lecture 4
Practice with linear filters
Original
111111111
000020000 -
Sharpening filter- Accentuates differences with local average
Source: D. Lowe
![Page 80: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/80.jpg)
ME5286 – Lecture 4
Sharpening
Source: D. Lowe
![Page 81: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/81.jpg)
ME5286 – Lecture 4
Other filters
-101
-202
-101
Vertical Edge(absolute value)
Other Filter
![Page 82: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/82.jpg)
ME5286 – Lecture 4
Other filters
-1-2-1
000
121
Horizontal Edge(absolute value)
OtherFilter
![Page 83: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/83.jpg)
ME5286 – Lecture 4
Basic gradient filters
000
10-1
000
0-10
000
010
10-1
or
Horizontal Gradient Vertical Gradient
1
0
-1
or
![Page 84: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/84.jpg)
ME5286 – Lecture 4
#84
Area/Mask Processing Methods• Averaging or mean filter – cont.
– Not the best choice
![Page 85: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/85.jpg)
ME5286 – Lecture 4
#85
Area/Mask Processing Methods• Gaussian filters – properties:
– Most common natural model (there are cells in eye that perform Gaussian filtering)
– Smooth function, it has infinite number of derivatives– Fourier Transform of Gaussian is Gaussian.– Convolution of a Gaussian with itself is a Gaussian.– Gaussian smoothing can be implemented efficiently because
the kernel is separable
![Page 86: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/86.jpg)
ME5286 – Lecture 4
Gaussian filter
* =Input image f
Filter hOutput image g
Compute empirically
![Page 87: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/87.jpg)
ME5286 – Lecture 4
Gaussian vs. mean filters
What does real blur look like?
![Page 88: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/88.jpg)
ME5286 – Lecture 4
• Spatially-weighted average
0.003 0.013 0.022 0.013 0.0030.013 0.059 0.097 0.059 0.0130.022 0.097 0.159 0.097 0.0220.013 0.059 0.097 0.059 0.0130.003 0.013 0.022 0.013 0.003
5 x 5, = 1
Slide credit: Christopher Rasmussen
Important filter: Gaussian
![Page 89: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/89.jpg)
ME5286 – Lecture 4
Gaussian filters• What parameters matter here?• Variance of Gaussian: determines extent of
smoothing
Source: K. Grauman
![Page 90: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/90.jpg)
ME5286 – Lecture 4
#90
Area/Mask Processing Methods• The value of determines the degree of smoothing.• As increases, the size of the mask must also increase
if we are to sample the Gaussian satisfactorily.• Rule – choose:
height = width = 5 (subtends 98.76% of the area)
![Page 91: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/91.jpg)
ME5286 – Lecture 4
Smoothing with box filter
![Page 92: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/92.jpg)
ME5286 – Lecture 4
Smoothing with Gaussian filter
![Page 93: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/93.jpg)
ME5286 – Lecture 4
Smoothing with a Gaussian
…
Parameter σ is the “scale” / “width” / “spread” of the Gaussian kernel, and controls the amount of smoothing.
Source: K. Grauman
![Page 94: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/94.jpg)
ME5286 – Lecture 4
#94
Area/Mask Processing Methods• Sharpening (or High-Pass) Filters
– Used to emphasize the fine details of an image (has the opposite effect of smoothing).
– Points of high contrast can be detected by computing intensity differences in local image regions.
– Weights of the mask are both positive and negative.– When the mask is over an area of constant or slowly varying
gray level, the result of convolution will be close to zero.– When gray level is varying rapidly within the neighborhood,
the result of convolution will be a large number.– Typically, such points form the border between different
objects or scene parts
![Page 95: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/95.jpg)
ME5286 – Lecture 4
#95
Area/Mask Processing Methods• Sharpening (or High-Pass) Filters – cont.
![Page 96: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/96.jpg)
ME5286 – Lecture 4
#96
Area/Mask Processing Methods• Sharpening using derivatives
• Computing the derivative of an image has as a result the sharpening of the image.
• The most common way to differentiate an image is by using the gradient.
![Page 97: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/97.jpg)
ME5286 – Lecture 4
#97
Area/Mask Processing Methods• Sharpening using derivatives – cont.
• The gradient can be approximated by finite differences which can be implemented efficiently as masks.
• Examples of masks based on gradient approximations with finite differences:
![Page 98: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/98.jpg)
ME5286 – Lecture 4
How do we choose the elements of a mask?
• Typically, by sampling certain functions.
Gaussian1st derivativeof Gaussian
2nd derivativeof Gaussian
![Page 99: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/99.jpg)
ME5286 – Lecture 4
Filters
• Smoothing (i.e., low-pass filters)– Reduce noise and eliminate small details.– The elements of the mask must be positive.– Sum of mask elements is 1 (after
normalization)
Gaussian
![Page 100: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/100.jpg)
ME5286 – Lecture 4
Filters• Sharpening (i.e., high-pass filters)
– Highlight fine detail or enhance detail that has been blurred.
– The elements of the mask contain both positiveand negative weights.
– Sum of the mask weights is 0 (after normalization)
1st derivativeof Gaussian
2nd derivativeof Gaussian
![Page 101: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/101.jpg)
ME5286 – Lecture 4
Sharpening Filters (High Pass Filtering)
• Useful for emphasizing transitions in image intensity (e.g., edges).
![Page 102: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/102.jpg)
ME5286 – Lecture 4
Sharpening Filters
• Note that the response of high-pass filtering might be negative.• Values must be re-mapped to [0, 255]
sharpened imagesoriginal image
![Page 103: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/103.jpg)
ME5286 – Lecture 4
Sharpening Filters: Unsharp Masking
• Obtain a sharp image by subtracting a lowpass filtered (i.e., smoothed) image from the original image:
- =
![Page 104: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/104.jpg)
ME5286 – Lecture 4
Sharpening Filters: Derivatives
• Taking the derivative of an image results in sharpening the image.
• The derivative of an image can be computed using the gradient.
![Page 105: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/105.jpg)
ME5286 – Lecture 4
Sharpening Filters: Derivatives
• The gradient is a vector which has magnitude and direction:
| | | |f fx y
or
(approximation)
![Page 106: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/106.jpg)
ME5286 – Lecture 4
Sharpening Filters: Derivatives• Magnitude: provides information about
edge strength.
• Direction: perpendicular to the direction of the edge.
![Page 107: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/107.jpg)
ME5286 – Lecture 4
Sharpening Filters: Gradient Computation
• Approximate gradient using finite differences:
sensitive to horizontal edges
sensitive to vertical edges
Δx
![Page 108: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/108.jpg)
ME5286 – Lecture 4
Sharpening Filters: Gradient Computation (cont’d)
![Page 109: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/109.jpg)
ME5286 – Lecture 4
Example
fx
fy
![Page 110: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/110.jpg)
ME5286 – Lecture 4
Sharpening Filters: Gradient Computation (cont’d)
• We can implement and using masks:
• Example: approximate gradient at z5
(x+1/2,y)
(x,y+1/2) **
good approximationat (x+1/2,y)
good approximationat (x,y+1/2)
![Page 111: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/111.jpg)
ME5286 – Lecture 4
Sharpening Filters: Gradient Computation (cont’d)
• A different approximation of the gradient:
•We can implement and using the following masks:
*
(x+1/2,y+1/2)good approximation
![Page 112: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/112.jpg)
ME5286 – Lecture 4
Sharpening Filters: Gradient Computation (cont’d)
• Example: approximate gradient at z5
• Other approximations
Sobel
![Page 113: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/113.jpg)
ME5286 – Lecture 4
Example
fy
fx
![Page 114: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/114.jpg)
ME5286 – Lecture 4
Sharpening Filters: Laplacian
The Laplacian (2nd derivative) is defined as:
(dot product)
Approximatederivatives:
![Page 115: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/115.jpg)
ME5286 – Lecture 4
Sharpening Filters: LaplacianLaplacian Mask
![Page 116: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/116.jpg)
ME5286 – Lecture 4
Handling Pixels Close to Boundaries
pad with zeroes
or
0 0 0 ……………………….0
0 0 0 ……
……
……
……
….0
![Page 117: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/117.jpg)
ME5286 – Lecture 4
Handling Pixels Close to Boundaries
What to do about image borders:
black fixed periodic reflected
![Page 118: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/118.jpg)
ME5286 – Lecture 4
Linear vs Non-Linear Spatial Filtering
• A filtering method is linear when the output is a weighted sum of the input pixels.
• Methods that do not satisfy the above property are called non-linear.– e.g.,
![Page 119: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/119.jpg)
ME5286 – Lecture 4
#119
Area/Mask Processing Methods• Median filter (non-linear filter) .
– Replace each pixel value by the median of the gray-levels in the neighborhood of the pixels
![Page 120: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/120.jpg)
ME5286 – Lecture 4
Smoothing Filters: Median Filtering(non-linear)
• Very effective for removing “salt and pepper” noise (i.e., random occurrences of black and white pixels).
averagingmedian filtering
![Page 121: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/121.jpg)
ME5286 – Lecture 4
Remember• Intensity operations can yield pixel values
outside of the range [0 – 255].• You should convert values back to the range
[0 – 255] to ensure that the image is displayed properly.
• Consider the following mapping?
[fmin – fmax] [ 0 – 255]
![Page 122: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/122.jpg)
ME5286 – Lecture 4
Frame Processing
#122
![Page 123: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/123.jpg)
ME5286 – Lecture 4
#123
Frame Processing Methods• Generate a pixel value based on an operation involving two or
more images or Frames.• Each output pixel is usually located at the same position in the
input image.• Attractive in Video Processing
– Useful for combining information in two images.
![Page 124: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/124.jpg)
ME5286 – Lecture 4
#124
Frame Processing Methods• Subtraction
O(r, c) = |I1(r, c) - I2(r, c)|
– Useful for "change detection“
![Page 125: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/125.jpg)
ME5286 – Lecture 4
#125
Frame Processing Methods• Averaging
– Image quality can be improved by averaging a number of images together.
![Page 126: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/126.jpg)
ME5286 – Lecture 4
#126
Frame Processing Methods• Logical Operators
![Page 127: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/127.jpg)
ME5286 – Lecture 4
#127
Frame Processing Methods
![Page 128: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/128.jpg)
ME5286 – Lecture 4
Geometric Transformations
#128
![Page 129: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/129.jpg)
ME5286 – Lecture 4
#129
Geometric Transformations• Modify the arrangement of pixels based on some
geometric transformation.
![Page 130: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/130.jpg)
ME5286 – Lecture 4
What are geometric transformations?
![Page 131: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/131.jpg)
ME5286 – Lecture 4
Translation
![Page 132: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/132.jpg)
ME5286 – Lecture 4
Translation and rotation
![Page 133: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/133.jpg)
ME5286 – Lecture 4
Scale
![Page 134: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/134.jpg)
ME5286 – Lecture 4
Similarity transformations
Similarity transform (4 DoF) = translation + rotation + scale
![Page 135: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/135.jpg)
ME5286 – Lecture 4
Aspect ratio
![Page 136: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/136.jpg)
ME5286 – Lecture 4
Shear
![Page 137: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/137.jpg)
ME5286 – Lecture 4
Affine transformations
Affine transform (6 DoF) = translation + rotation + scale + aspect ratio + shear
![Page 138: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/138.jpg)
ME5286 – Lecture 4
Geometric Transformations
100
]1[]1[
3231
2221
1211
tttttt
wvyx
Affine Transformationy=v sinθ + w cosθ
![Page 139: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/139.jpg)
ME5286 – Lecture 4
#139
Geometric Transformations• Some Practical Problems
1) Transformed pixel coordinates might not lie within the bounds of the image.
2) Transformed pixel coordinates can be non-integer.3) There might be no pixels in the input image that map to
certain pixel locations in the transformed image (one-to-one correspondence can be lost).
![Page 140: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/140.jpg)
ME5286 – Lecture 4
#140
Geometric Transformations• Problem (3): Forward vs. Inverse Mapping
– To guarantee that a value is generated for every pixel in the output image, we must consider each output pixel in turn and use the inverse mapping to determine the position in the input image.
![Page 141: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/141.jpg)
ME5286 – Lecture 4
#141
Geometric Transformations• Problem (2): Image Interpolation
– Interpolation is the process of generating integer coordinates for a transformed pixel by examining its surrounding pixels.
• Zero-order interpolation (or nearest-neighbor)
![Page 142: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/142.jpg)
ME5286 – Lecture 4
#142
Geometric Transformations• First-order interpolation
• Higher-order interpolation schemes are more sophisticated but also more time consuming
![Page 143: Lecture 4: Spatial Domain Transformationsdept.me.umn.edu/.../vision/Notes/2015/ME5286-Lecture4.pdf · 2015-04-20 · ME5286 – Lecture 4 Reminder • 2nd Quiz on the manipulator](https://reader036.vdocuments.us/reader036/viewer/2022070715/5ed815d4cba89e334c6737e9/html5/thumbnails/143.jpg)
ME5286 – Lecture 4
#143
Review
• Spatial Domain Transformation– Point Processing for Enhancement– Area/Mask Processing Transformations
• Image Filter for Blurring, Enhancement
– Frame Processing Transformations• Operations on multiple images
– Geometric Transformations• Image Warping or Operations on the image axes