KALMAN FILTER

APPLICATION IN COMPUTER VISION &
IMAGE PROCESSING
Hamid Bazargani
School of Electrical & Computer Eng.
Outline:
• A brief introduction to Kalman filter

• Classical Kalman Filter

• Kalman & Stereo vision localization

• Different extensions of Kalman Filter

• Image and Video De-noising (Kalman approach)

• Kalman Tracking for Robust pose estimation
Introduction:
•Kalman is a recurrent algorithm relying on series of uncertain
measurements to optimally estimate an unknown variable.
•The Kalman filter is 50 years old but is still a popular method for
sensory information analysis .
•The Kalman applications span area of navigation systems,
aerospace, robotics, information processing , computer vision, etc
•Main properties:
•Requires small computational cost
•State space representation and ease of implementation
•Recursive algorithm which only uses last state and current
observation
Formulation:
Where F is transition matrix, G is a control input matrix . H is output
matrix.
Random variables w and v are process and measurement noise
respectively.
Predict or time update Correct or measurement update
Kalman stages
Multivariate Gaussians:
posterior
prior
Measurement
evidence
Markov model:
) ( ) | ( ) | ( x p x z p z x p ∝
Multivariate Gaussians:
posterior
prior
Measurement
evidence
)
`
¹
¹
´
¦
− Σ − − ∝

) ( ) (
2
1
exp ) (
1
µ µ x x x p
T
)
`
¹
¹
´
¦
− Γ − − ∝

) ( ) (
2
1
exp ) | (
1
z x z x x z p
T
) ( ) (
1 1 1 1 1 new
z
− − − − −
Γ + Σ Γ + Σ = µ µ
( )
1
1 1 new

− −
Γ + Σ = Σ
Multivariate Gaussians:
CS373 - Programming a Robotic Car - Unit 2
Kalman Filter Prediciton - CS373 Unit 2 - Udacity
By Sebastian Thrun
Kalman & Stereo Vision Localization:
•Stereo localization requires both camera’s information at each time
step.

Kalman & Stereo Vision Localization:
•There is a small time delay between the two cameras’ image
capturing. This time lag causes an error in estimation of object
position in Cartesian coordinates.
Non-linearity & Kalman Filter:
[Refer to Video1]

•Python and Blender used for data acquisition which brings Physics engine to
generate exact trajectory.

•Blender communicate with matlab over UDP protocol.
Non-linearity & Kalman Filter:
Extended Kalman Filter
Figures from CS-223 (Stanford)
Non-linearity & Kalman Filter:
Extended Kalman Filter
Figures from CS-223 (Stanford)
Non-linearity & Kalman Filter:
Extended Kalman Filter
Figures from CS-223 (Stanford)
Adaptive Kalman Filter:
•Adaptive Fading Kalman Filter

•Innovation based Adaptive Kalman Filter

Adaption
Non-linearity
Kalman
EKF
AEKF
AKF
Kalman Filter Categories
SV Results
Noise level 05 . 0 =
n
σ Noise level 5 . 0 =
n
σ
Image and Video de-noising:
•noise is assumed to be signal-independent at each pixel
Image and Video de-noising:
•Wiener Filter
•Bilateral Filter
•Median Filter
•Non-Local Means Filtering
Image and Video de-noising:
•Wiener Filter
•Assume Stationary signal
•Signal and noise are independent with constant PSD
Image and Video de-noising:
•Wiener Filter
Image and Video de-noising:
•Wiener Filter
15 =
n
σ
Image and Video de-noising:
•Wiener Filter
Filtered
Image and Video de-noising:
•Non-Local Means Filter
•Each pixel is replaced by weighted average of its neighborhoods.

•Larger patch size leads to expensive computation. while Smaller patch
size results in poor de-noising effect.

•All weights should be normalized .
Image and Video de-noising:
•Non-Local Means Filter
15 =
n
σ
Image and Video de-noising:
•Non-Local Means Filter
Image and Video de-noising:
•Comparison
15 =
n
σ
original
Wiener filter NLM filter
Noisy
Image and Video de-noising:
•Comparison
0
2
4
6
8
10
12
14
PSNR (db) PSNR (db)
Video de-noising:
•Each pixel is replaced by 3D spatio-temporal weighted average of its
neighborhoods.
Motion estimation & Kalman Filter
•Optical Flow Algorithms

•Block Matching Algorithms

•Full Search Algorithm (FSA)
•Three Step Algorithm (TSA)
•Four Step Algorithm (FSA)
•Diamond Search Algorithm (DSA)
•Adaptive Rood Pattern Search
Motion estimation & Kalman Filter
•Why Kalman Filter?
•Motion estimation inaccuracy when illumination is changed
•Inaccuracy based on noise
•The size of moving object may differ from searching region size
•Fails in presence of occlusion
Motion estimation & Kalman Filter
2D Causal AR model:
B(m,n)
B(m,n-1)
B(m-1,n)
) , ( ) , 1 ( ) 1 , ( ) , (
) , ( ) , 1 ( ) 1 , ( ) , (
, , 10 , 01 ,
, , 10 , 01 ,
n m w n m v b n m v b n m v
n m w n m v a n m v a n m v
y i y i y i y i
x i x i x i x i
+ − + − =
+ − + − =
Motion estimation & Kalman Filter
State space representation :
(
(
(
(
¸
(

¸

+
(
(
(
(
¸
(

¸





(
(
(
(
¸
(

¸

=
(
(
(
(
¸
(

¸



0
0
) 1 , (
) , 1 (
) 1 , (
) , 1 (
*
0 1 0 0
0 0
0 0 0 1
0 0
) , 1 (
) , (
) , 1 (
) , (
,
,
,
,
11 01
11 01
,
,
,
,
q
q
n m v
n m v
n m v
n m v
b b
a a
n m v
n m v
n m v
n m v
x i
x i
x i
x i
x i
x i
x i
x i
(
(
(
(
¸
(

¸

+
(
(
(
(
¸
(

¸



(
¸
(

¸

=
(
¸
(

¸

=
0
0
) , 1 (
) , (
) , 1 (
) , (
*
0 1
0 0
0 0
0 1
) , (
) , (
,
,
,
,
,
,
r
r
n m v
n m v
n m v
n m v
n m v
n m v
z
x i
x i
x i
x i
y i
x i
(
(
(
(
(
¸
(

¸

=
0 0 0 0
0 0
0 0 0 0
0 0
2 2
2 2
q q
q q
Q
(
(
(
(
(
¸
(

¸

=
0 0 0 0
0 0
0 0 0 0
0 0
2 2
2 2
r r
r r
R
Motion estimation & Kalman Filter
Motion estimation & Kalman Filter
Motion estimation & Kalman Filter
Motion estimation & Kalman Filter
Motion estimation & Kalman Filter
Motion estimation & Kalman Filter
•Green arrows show motion vectors

•Red arrows show corrected motion vectors

•Kalam uses corrected version of neighboring vectors if available
Motion estimation Results
[Refer to Video2]
•Results are generated using the following approaches:

•2D 3x3 spatial domain NLM

•3D 3x3x3 spatio-temporal domain NLM

•3D 5x3x3 spatio-temporal domain NLM
Motion estimation Results
[Refer to Video2]
Kalman Tracking for Robust pose estimation
•Object Recognition
•Object recognition requires set of 2D correspondences between
target image and video frame.

• Robust RANSAC (RANdom SAmple Consensus) is used to robustly
estimate the pose against wrong matches.

• Robust pose estimation brings an exhaustive computational cost.
Kalman Tracking for Robust pose estimation
•Tracking
•Feature points tracking

• Tracking the region of search for matches.

• Keep tracking of estimated pose after pose estimation process.

•Keep tracking of inliers (best matches) found from RANSAC loop.
(My Contribution)
Kalman Tracking for Robust pose estimation
•Pose estimation:
Point
Matching
RANSAC Loop
Video
Frame points
Target Points
M-estimator
(LSM)
Kalman tracker
Kalman Tracking for Robust pose estimation
•Pose estimation:
[Refer to Video3]
Implementation
•Programs are written with C++ using OpenCV library

•C++ implementation of generic Kalman Filter algorithm

•C++ implementation of Non-Local Means algorithm

•C++ implementation of FSA Block Matching algorithm

•C++ implementation of Wiener filter for image denoising

•Matlab full implementation of Conventional, Extended , Adaptive Fading and
Innovation-based Adaptive Kalman filter

Will be available for download soon on
https://github.com/hamidb

Conclusion:
•We studied Kalman Filter as an adaptive filter which can be applied for
Smoothing, prediction , filtering and tracking

•Three main extensions of Kalman filter including conventional, extended
and adaptive
Kalman filter are reviewed.

•Applying Kalman Filter in Video de-noising and compared the result with
other filters like Wiener filter

•Applying Kalman filter in computer vision applications such as multiple view
geometry and pose estimation
References:
1. Dan Simon. Optimal State Estimation: Kalman, H Infinity, and Nonlinear Approaches. Wiley-Interscience, 1
edition, August 2006.
2. S. Sangsuk-Iam and T. E. Bullock. Analysis of discrete time kalman filtering under incorrect noise
covariances. Automatic Control, IEEE Transactions
3. Qijun Xia, Ming Rao, Yiqun Ying, and Xuemin Shen. Adaptive fading kalman filter with an application.
Automatica
4. Buades, A., Coll, B., Morel, J.M.: A non-local algorithm for image denoising. In: IEEE Conference on
Computer Vision and Pattern Recognition (CVPR). (2005)
5. Buades, A., Coll, B., Morel, J.M.: Denoising image sequences does not require motion estimation. In: IEEE
International Conference on Advanced Video and Signal Based Surveillance. (2005)
6. Han, Yu Bing and Chen, Rushan: Efficient video denoising based on dynamic nonlocal means . Journal of
Image Vision Comput. (2012)
7. Chung-Ming Kuo; Chaur-Heh Hsieh; Yue-Dar Jou; Hsieh-Cheng Lin; Po-Chiang Lu, "Motion estimation for
video compression using Kalman filtering," Broadcasting, IEEE Transactions on , Jun 1996
8. Bazargani, H.; Omidi, E.; Talebi, H.A., "Adaptive Extended Kalman Filter for asynchronous shuttering error of
stereo vision localization," Robotics and Biomimetics (ROBIO), 2012 IEEE International Conference on , vol.,
no., pp.2254,2259, 11-14 Dec. 2012
9. Ruiz, V.; Fotopoulos, V.; Skodras, A.N.; Constantinides, A.G., "An 8×8-block based motion estimation using
Kalman filter," Image Processing, 1997.
10. Antoni Buades and Bartomeu Coll and Jean Michel Morel, On image denoising methods,Technical Note,
CMLA (Centre de Mathematiques et de Leurs Applications,(2004)
Thank you for your Attention.
http://www.slideshare.net/hamidbazargani/venn-
diagrams-29181371