Anda di halaman 1dari 10

Temporal Filter

Pi19404
January 5, 2013

Contents

Contents
Temporal Filters
0.1 Introduction . . . . . . . . . . . . 0.2 Laplacian of Gaussian lter . . . 0.3 Edge detection using Log Filters 0.4 Zero Crossing Detector . . . . . . 0.5 Temporal Edge Detector . . . . . 0.6 Demo . . . . . . . . . . . . . . . . 0.7 Code . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2
2 2 5 8 8 9 9 9

Temporal Filters
0.1 Introduction
Temporal lter are lters that operate over time.Input to the lter is set of images the ltering is performed at each pixel location over set of images. Here we look at temporal edge detection lter.The lters are 1D lter applied at each pixel of image over a stack of images. We will also look at some temporal lters like Laplacian of Gaussian Filters

0.2 Laplacian of Gaussian lter


1D Laplacian Filter is expressed as L( x ) = 2 f x2

In discrete time 1D Laplacian lter is expressed as L(n) = x (n) 2x (n 1) + x (n 1) In discrete domain The laplacian can be calculated using a convolution lter with kernel mask (1, 2, 1) L1 ( n ) = L ( n ) f ( n )

2 | 10

Temporal Filters
" Generall taking derivative amplies noise along with edges hence usually a gaussian lter is applied before taking the derivative. The 1D Gaussian Filter is expressed as G1 ( x ) = 1
2 21

exp[

x2 ] 2 21

The signal f(x) is rst convolved with a gaussian lter and then laplacian lter is applied. g1 ( x ) = G1 ( x ) f ( x ) " It can be shown that since convolution lter is associative L( g( x ) f ( x )) = x2 ( g( x ) f ( x )) x2 f (s) 2 g ( x s ) x2

= =

f (s) g( x s)ds = x2

f (s) g ( x s) =

f (s) LOG ( x s) = f ( x ) LOG ( x )

l ( x ) g( x ) can be thought of as a lter and is called as laplacian of gaussian lter or LOG lter. In 1D LOG lter can be expressed as LoG ( x ) =

1
22 2

x2 x2 exp[ 2 ] 22 2

For a given sigma and kernel size we can obtain a discrete kernel that approximate the function. The kernel is symmetric is symmetric about the origin. For kernel size of 5 and = 0.5 is given by 0.4296, 1.0000, 1.0000, 1.0000, 0.4296 This can be normalized so that the lowest pixel value is 1 1, 4, 7, 4, 1

This is convolution kernel that can be used to compute the LoG output for discrete time system. normalized plot of gaussian,its gradient and lapacian are shown in plot 1.1

3 | 10

Temporal Filters

(a) Log Filter

4 | 10

Temporal Filters

0.3 Edge detection using Log Filters


Let us consider the laplacian of a step function,ramp function without gaussian kernel. The gradient of step function is a impulse function ,while than of ramp is step function the laplacian of step is a impulse itself,the laplacian of ramp is impulse function. The presence of impulse function can provide us with the location of edges. The

(b) Laplacian of ramp and step edges

gaussian blurring will blur noise as well as the edge as well.Let us consider the input after gaussian blurring has been applied.It can be seen that the edges are no longer sharp edges but gradually changing edges. Large the variance greater is the degree of blurring. We can see than zero crossings of the LogFilter provide the approximate location of edges. Due to blurring exact edges are not obtained are zero crossings of the lter. Consider the step edge. when gaussian lter is applied at the edges,it will create a approximate linear transition of edges and then laplacian of such a signal will provide rst a increasing impulse followed by a decreasing impulse.Thus the zero crossing will indicate the presence of step edge. Another way to look at is to consider the Log lter convolution operation. The lter is negative at center surrounded by positive peaks. Far away from the edge response

5 | 10

Temporal Filters

(c) Log Filter

6 | 10

Temporal Filters
of lter is zero.As it approaches the edge it will ecounter positive peak and increase in value ,then encounter the negative peak and value decreases and becomes negative. then it will encounter the positive peak and value will increase and become zero It can be seen that at once side of center the sum of areas remains positive till it encounter the center pixel.There is a zero crossing at the center pixel and it keeps on decreasing for some values then increases again and becomes zero. Consider the case

(d) Response for Step Edge

of ramp edge.First positive peak encounters the ramp edge and its value keeps on increasing ,then as negative peak reaches the ramp edges in value keeps on decreasing then as next positive peak reaches the ramp edge value again increases and as it reaches the at region it becomes zero. Thus in both the cases a zero crossing in ecountered on the edge or edge transition. Thus the presence of zero crossings indicates the presence of an edge. Thus after applying Log Filter we can apply a zero crossing detector .

7 | 10

Temporal Filters

(e) Response for Ramp

0.4 Zero Crossing Detector


The simplest zero crossing detection just looks for sign change of sample value. Since making decision based on one signal point of transition could lead to errors we make the decision of zero crossing based on set of sample values. consider neighborhood of 3 pixels that will be considered for edge detection. let x(n) be the position where zero crossing has occured I1 (n) =

i = n 3

n +3

x (i ), I2 (n) =

i =n

x (i )

If I1 (n) > 0 and I2 (n) < 0 or vice-versa then zero crossing is detected

0.5 Temporal Edge Detector


The Input to the temporal lter is a stack of images. This can be visualized as 2D array of 1D signals located at each pixel location. The output of the lter is also a 2D array of 1D signals. Zero crossing detection is performed for each of these 1D signals ,and If a zero crossing is detected the pixel is marked as temporal edge The criteria for searching for zero crossing to seach for negative to positive transition or vice versa. Thus following conditions indicate a zero crossing x (n) < 0&x (n + 1) > 0 x (n) > 0&x (n + 1)d < 0

8 | 10

Temporal Filters
x (n 1) > 0&x (n + 1) < 0&x (n) = 0 x (n 1) < 0&x (n + 1) > 0&x (n) = 0

0.6 Demo
Some of the les for testing clapping hands,walking running were taken from KTH dataset The input and output les can be found at http://code.google.com/p/m19404/ source/browse/TemporalFilter/. The les i1,i2,i3 are inputs and out1,out2,out3 are corresponding output les

0.7 Code
The code and sample images can be found at http://code.google.com/p/m19404/ source/browse/TemporalFilter/

9 | 10

Bibliography

Bibliography
[1] M. Ahmad. Human motion detection and segmentation from moving image sequences. In: Electrical and Computer Engineering, 2008. ICECE 2008. International Conference on. 2008, pp. 407 411. doi: 10.1109/ICECE.2008.4769241. A. Walker R. Fisher S. Perkins and E. Wolfart. LOG Filters. url: http://homepages. inf.ed.ac.uk/rbf/HIPR2/log.htm. [2]

10 | 10

Anda mungkin juga menyukai