Zoom Lenses – Varifocal. Zoom Lenses – Parfocal Computing Field of View xoxoxoxo didididi...
-
date post
21-Dec-2015 -
Category
Documents
-
view
229 -
download
2
Transcript of Zoom Lenses – Varifocal. Zoom Lenses – Parfocal Computing Field of View xoxoxoxo didididi...
Zoom Lenses – VarifocalZoom Lenses – Varifocal
Zoom Lenses – ParfocalZoom Lenses – Parfocal
Computing Field of ViewComputing Field of View
xxoo
ddii
xxii
ddoo
1/1/ddoo + 1/ + 1/ddii = 1/ = 1/ff
xxo o / / ddoo = = xxi i / / ddii
= 2 tan= 2 tan-1-1 ½ ½ xxi i
(1/(1/ff1/1/ddoo))Since typically Since typically ddoo >> >> f,f,
2 tan2 tan-1-1 ½ ½ xxi i / / ff
tan tan /2 = ½ /2 = ½ xxo o // ddoo
xxi i / / ff
Filtering and Edge Filtering and Edge DetectionDetection
Local NeighborhoodsLocal Neighborhoods
• Hard to tell anything from a single Hard to tell anything from a single pixelpixel– Example: you see a reddish pixel. Is Example: you see a reddish pixel. Is
this the object’s color? Illumination? this the object’s color? Illumination? Noise?Noise?
• The next step in order of complexity The next step in order of complexity is to look at local neighborhood of a is to look at local neighborhood of a pixelpixel
Linear FiltersLinear Filters
• Given an image Given an image InIn((xx,,yy) generate a) generate anew image new image OutOut((xx,,yy):):– For each pixel (For each pixel (xx,,yy))
OutOut((xx,,yy) is a linear combination of ) is a linear combination of pixelspixelsin the neighborhood of in the neighborhood of InIn((xx,,yy))
• This algorithm isThis algorithm is– Linear in input intensityLinear in input intensity– Shift invariantShift invariant
Discrete ConvolutionDiscrete Convolution
• This is the discrete analogue of This is the discrete analogue of convolutionconvolution
• The pattern of weights is called the The pattern of weights is called the “kernel” of the filter“kernel” of the filter
• Will be useful in smoothing, edge Will be useful in smoothing, edge detectiondetection
Example: SmoothingExample: Smoothing
Original: MandrillOriginal: Mandrill Smoothed withSmoothed withGaussian kernelGaussian kernel
Gaussian FiltersGaussian Filters
• One-dimensional GaussianOne-dimensional Gaussian
• Two-dimensional GaussianTwo-dimensional Gaussian
2
2
21
2
1)(
x
exG
2
2
21
2
1)(
x
exG
2
22
22
2
1),(
yx
eyxG
2
22
22
2
1),(
yx
eyxG
Gaussian FiltersGaussian Filters
Gaussian FiltersGaussian Filters
Gaussian FiltersGaussian Filters
• Gaussians are used because:Gaussians are used because:– SmoothSmooth– Decay to zero rapidlyDecay to zero rapidly– Simple analytic formulaSimple analytic formula– Limit of applying multiple filters is Limit of applying multiple filters is
GaussianGaussian– Separable:Separable:
G G22(x,y) = G(x,y) = G11(x) G(x) G11(y)(y)
Computing ConvolutionsComputing Convolutions
• What happens near edges of image?What happens near edges of image?– Ignore (Ignore (OutOut is smaller than is smaller than InIn))– Pad with zeros (edges get dark)Pad with zeros (edges get dark)– Replicate edge pixelsReplicate edge pixels– Wrap aroundWrap around– ReflectReflect– Change filterChange filter– ……
i j
jyixInjifyxOut ),(),(),( i j
jyixInjifyxOut ),(),(),(
Computing ConvolutionsComputing Convolutions
• If If InIn is is nnnn, , ff is is mmmm, takes time, takes time O( O(mm22nn22))
• OK for small filter kernels, bad for OK for small filter kernels, bad for large oneslarge ones
i j
jyixInjifyxOut ),(),(),( i j
jyixInjifyxOut ),(),(),(
Digression: Fourier Digression: Fourier TransformsTransforms
• Define Define Fourier transformFourier transform of function of function ff asas
• F is a function of frequency – F is a function of frequency – describes how much of each describes how much of each frequency frequency ff contains contains
• Fourier transform is invertibleFourier transform is invertible
dxexf xixf
)(
2
1)(F )(F dxexf xixf
)(
2
1)(F )(F
Fourier Transform and Fourier Transform and ConvolutionConvolution
• Fourier transform turns convolutionFourier transform turns convolutioninto multiplication:into multiplication:
FF ((ff((xx) ) gg((xx)))) = = FF ((ff((xx)))) FF
((gg((xx))))
Fourier Transform and Fourier Transform and ConvolutionConvolution
• Useful application #1: Use frequency Useful application #1: Use frequency space to understand effects of filtersspace to understand effects of filters– Example: Fourier transform of a Example: Fourier transform of a
GaussianGaussianis a Gaussianis a Gaussian
– Thus: attenuates high frequenciesThus: attenuates high frequencies
==
Fourier Transform and Fourier Transform and ConvolutionConvolution
• Useful application #2: Efficient Useful application #2: Efficient computationcomputation– Fast Fourier Transform (FFT) takes timeFast Fourier Transform (FFT) takes time
O( O(n n log log nn))– Thus, convolution can be performed in Thus, convolution can be performed in
timetime O( O(nn log log nn + + mm log log mm))
– Greatest efficiency gains for large Greatest efficiency gains for large filtersfilters
Edge DetectionEdge Detection
• What do we mean by edge What do we mean by edge detection?detection?
• What is an edge?What is an edge?
What is an Edge?What is an Edge?
Edge easy to findEdge easy to find
What is an Edge?What is an Edge?
Where is edge? Single pixel wide or multiple pixels?Where is edge? Single pixel wide or multiple pixels?
What is an Edge?What is an Edge?
Noise: have to distinguish noise from actual edgeNoise: have to distinguish noise from actual edge
What is an Edge?What is an Edge?
Is this one edge or two?Is this one edge or two?
What is an Edge?What is an Edge?
Texture discontinuityTexture discontinuity
Formalizing Edge DetectionFormalizing Edge Detection
• Look for strong step edgesLook for strong step edges
• One pixel wide: look for One pixel wide: look for maximamaxima in in dI dI / / dxdx
• Noise rejection: smooth (with a Noise rejection: smooth (with a Gaussian) over a neighborhood Gaussian) over a neighborhood
dx
dI dx
dI
Canny Edge DetectorCanny Edge Detector
• SmoothSmooth
• Find derivativeFind derivative
• Find maximaFind maxima
• ThresholdThreshold
Canny Edge DetectorCanny Edge Detector
• First, smooth with a Gaussian ofFirst, smooth with a Gaussian ofsome width some width
Canny Edge DetectorCanny Edge Detector
• Next, find “derivative”Next, find “derivative”
• What is derivative in 2D? Gradient:What is derivative in 2D? Gradient:
y
f
x
fyxf ,),(
y
f
x
fyxf ,),(
Canny Edge DetectorCanny Edge Detector
• Useful fact #1: differentiation Useful fact #1: differentiation “commutes” with convolution“commutes” with convolution
• Useful fact #2: Gaussian is separableUseful fact #2: Gaussian is separable
gdx
dfgf
dx
d g
dx
dfgf
dx
d
Canny Edge DetectorCanny Edge Detector
• Thus, combine first two stages of Thus, combine first two stages of Canny:Canny:
),(
)(),,(
)(),( 11
2 yxfdy
ydGyxf
dx
xdGyxfG
),(
)(),,(
)(),( 11
2 yxfdy
ydGyxf
dx
xdGyxfG
Canny Edge DetectorCanny Edge Detector
Original: LenaOriginal: Lena Smoothed Gradient MagnitudeSmoothed Gradient Magnitude
Canny Edge DetectorCanny Edge Detector
• Nonmaximum suppressionNonmaximum suppression– Eliminate all but local maxima in Eliminate all but local maxima in
magnitudemagnitudeof gradientof gradient
– At each pixel look along At each pixel look along direction direction of of gradient:gradient:if either neighbor is bigger, set to zeroif either neighbor is bigger, set to zero
– In practice, quantize direction to In practice, quantize direction to horizontal, vertical, and two diagonalshorizontal, vertical, and two diagonals
– Result: “thinned edge image”Result: “thinned edge image”
Canny Edge DetectorCanny Edge Detector
• Final stage: thresholdingFinal stage: thresholding
• Simplest: use a single thresholdSimplest: use a single threshold
• Better: use two thresholdsBetter: use two thresholds– Find chains of edge pixels, all greater than Find chains of edge pixels, all greater than
low low
– Each chain must contain at least one pixel Each chain must contain at least one pixel greater than greater than high high
– Helps eliminate dropouts in chains, Helps eliminate dropouts in chains, without being too susceptible to noisewithout being too susceptible to noise
– ““Thresholding with hysteresis”Thresholding with hysteresis”
Canny Edge DetectorCanny Edge Detector
Original: LenaOriginal: Lena EdgesEdges
Other Edge DetectorsOther Edge Detectors
• Can build simpler, faster edge Can build simpler, faster edge detector by omitting some steps:detector by omitting some steps:– No nonmaximum suppressionNo nonmaximum suppression– No hysteresis in thresholdingNo hysteresis in thresholding– Simpler filterSimpler filter
Second-Derivative-BasedSecond-Derivative-BasedEdge DetectorsEdge Detectors
• To find local maxima in derivative, To find local maxima in derivative, look for zeros in second derivativelook for zeros in second derivative
• Analogue in 2D: LaplacianAnalogue in 2D: Laplacian
2
2
2
22 ),(
y
f
x
fyxf
2
2
2
22 ),(
y
f
x
fyxf
LOGLOG
• As before, combine Laplacian with As before, combine Laplacian with Gaussian smoothing: Laplacian of Gaussian smoothing: Laplacian of Gaussian (LOG)Gaussian (LOG)
LOGLOG
• As before, combine Laplacian with As before, combine Laplacian with Gaussian smoothing: Laplacian of Gaussian smoothing: Laplacian of Gaussian (LOG)Gaussian (LOG)
Problems withProblems withLaplacian Edge DetectorsLaplacian Edge Detectors
• Local minimum vs. local maximumLocal minimum vs. local maximum
• Symmetric – poor performance near Symmetric – poor performance near cornerscorners
• Sensitive to noise along an edgeSensitive to noise along an edge– Higher-order derivatives = greater noise Higher-order derivatives = greater noise
sensitivitysensitivity