1. a given pattern p is sought in an image. the pattern may appear at any location in the image. the...
TRANSCRIPT
![Page 1: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/1.jpg)
1
Fast Pattern Matching in Non-Linear Tone-Mapped Images
Yacov Hel-OrThe Interdisciplinary Center (IDC), Israel
Visiting Scholar - Google
Hagit Hel-Or and Eyal DavidU. of Haifa, Israel
![Page 2: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/2.jpg)
• A given pattern p is sought in an image.
• The pattern may appear at any location in the image.
• The image may be subject to some tone changes.
2
Pattern Matching under Tone Mapping
pattern
image similarity
![Page 3: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/3.jpg)
• Source of Tone Changes:– Illumination conditions
– Camera parameters
– Different Modalities
• Applications: “patch based” methods– Image summarization
– Image retargeting
– Image editing
– Super resolution
– Tracking, Recognition, many more …
Pattern Matching
![Page 4: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/4.jpg)
• Assumption: Tone changes can be locally represented as a Tone Mapping between the sought pattern p and a candidate window w:
4
Tone Changes as Tone Mappings
w=M(p)
orp=M(w)
Vp
Vw
Vp
![Page 5: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/5.jpg)
• Given a pattern p and a candidate window w a distance metric must be defined, according to which matchings are determined:
• Desired properties of D(p,w) :
– Discriminative
– Robust to Noise
– Invariant to some deformations: tone mapping
– Fast to execute
Distance Metric
D(p,w)
![Page 6: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/6.jpg)
• Sum of Squared Difference (SSD):
Most Common Distance Metrics
2
, wpwpD
– By far the most common solution.
– Assumes the identity tone mapping.
– Fast implementation (~1 convolution).
![Page 7: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/7.jpg)
• Normalized Cross Correlation (NCC):
– Compensates for linear mappings.
– Fast implementation (~ 1 convolution) .
2
varvar,
w
ww
p
ppEwpD
![Page 8: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/8.jpg)
• Mutual Information (MI):
– Measures the statistical dependencies between p and w.
– Compensates for non-linear mappings.
H(w)
H(p)
D(p,w)=I(p,w)=H(w)-H(w | p)
![Page 9: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/9.jpg)
Properties:• Measures the entropy loss in w given p.
• Highly Discriminative.
• Sensitive to bin-size / kernel-variance.
• Inaccurate for small patched.
• Very slow to apply.
MI as a Distance
Measure:
H(w)H(p)
I(w,p)
![Page 10: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/10.jpg)
Properties:• Highly discriminative.
• Invariant to any (non-linear) tone mapping.
• Robust to noise.
• Very fast to apply.
• Natural generalization of the NCC for non-linear mappings.
Proposed Approach:
Matching by Tone Mapping
(MTM)
![Page 11: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/11.jpg)
• Proposed distance measure:
• Note: the division by var(w) avoids the trivial mapping.
Matching by Tone Mapping (MTM)
w
wpMwpD
M varmin,
2
p
pwMpwD
M varmin,
2
![Page 12: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/12.jpg)
Basic Ideas:• Approximate M(p) by a piece-wise constant mapping.
• Enables to represent M(p) in a linear form.
• The minimization can be solved in closed form.
How can MTM be calculated efficiently?
Vp
Vw
Vp
Vw
![Page 13: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/13.jpg)
• Assume the pattern/window values are restricted to the half open interval [a,b).
• We divide [a,b) into k bins =[1,2,...,k+1]
• A value z is naturally associated with a single bin:
B(z)=j if z[j,j+1)
Tone Mapping as a linear form:
z
1 2 k+1j j+1
![Page 14: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/14.jpg)
Pattern Slices
• We define a pattern slice
![Page 15: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/15.jpg)
Pattern Slices
2nd slice p2
1st slice p1
0 1
• We define a pattern slice
![Page 16: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/16.jpg)
The Slice Matrix
• Raster scanning the slice windows and stacking into a matrix constructs a slice matrix Sp =[p1 p2 … pk].
= Sp
![Page 17: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/17.jpg)
*
• The matrix Sp is orthogonal: pipj = |pi| ij
• Its columns span the space of piecewise constant tone mappings of p:
Sp p
S p p
![Page 18: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/18.jpg)
M(p)
*
Changing the values to a different vector, , applies piece-wise tone mapping:
p Sp
S p M(p)
![Page 19: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/19.jpg)
• Representing tone mapping in a linear form, D(p,w) boils down to:
• The above minimization can be solved in closed form:
Back to Pattern Matching
w
wSwpD p
varmin,
2
j
j
jwp
pwwpD
22 1),(
![Page 20: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/20.jpg)
j
j
jwp
pwwpD
22 1),(
D( ) =( , )
( )--( )
2
2
p w ( )-2
![Page 21: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/21.jpg)
*
MTM for running windows:
j
j
jwp
pwwpD
22 1),(
*
2
box filter( )
( )2
Pattern
![Page 22: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/22.jpg)
MTM for running windows:
j
j
jpw
wppwD
22 1),(
p2 :
( )2
Pattern
*
![Page 23: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/23.jpg)
• Convolutions can be applied efficiently since p j
is sparse.
• Convolving with pj requires |pj| operations.
• Since pipj= run time for all k sparse convolutions sum up to a single convolution!
Complexity
![Page 24: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/24.jpg)
MTM and Other Distances• The MTM can be shown to measure:
• This is related to the Correlation-Ratio distance measure (Pearson 1930, Roche et al. 1998) and the Fisher’s LD.
• Restricting M to be a linear tone mapping: M(z)=az+b, the MTM distance D(w,p) reduces to the NCC.
w
pwEwpD
var
|var,1
![Page 25: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/25.jpg)
MTM and MI• MTM and MI are similar in spirit:
• While MI maximizes the entropy reduction in (w | p) MTM maximizes the variance reduction in (w | p).
• However, MTM outperforms MI with respect to speed and accuracy (in small patch cases).
MI MTM
Maximizes Entropyreduction
Variance reduction
Speed slow Very fast
Bin size sensitive insensitive
![Page 26: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/26.jpg)
Results
![Page 27: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/27.jpg)
28
Detection rates (over 2000 image pattern pairs) v.s extremity of the applied tone mapping.
![Page 28: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/28.jpg)
29
Run time for various pattern sizes (in 512x512 image)
![Page 29: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/29.jpg)
30
Performance of MI and MTM for various pattern sizes and over various bin-sizes
![Page 30: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/30.jpg)
• How can we distinguish between target and background?
Example Application: Shadow Detection in Video
Background model Current video frame
![Page 31: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/31.jpg)
Naïve Background Subtraction
![Page 32: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/32.jpg)
Background model Video frame
• Assumption: Shadow patches are functionally dependent on the background patches.
![Page 33: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/33.jpg)
MTM distance
![Page 34: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/34.jpg)
MTM distance
![Page 35: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/35.jpg)
• A new distance measure that accounts for non-linear tone mappings.
• A very efficient scheme which can be applied over the entire image using ~1 convolution.
• A natural generalization of NCC.
36
Conclusions:
![Page 36: 1. A given pattern p is sought in an image. The pattern may appear at any location in the image. The image may be subject to some tone changes. 2 pattern](https://reader035.vdocuments.us/reader035/viewer/2022062713/56649cca5503460f94992310/html5/thumbnails/36.jpg)
37
THANK YOU