Intelligent Ip Camera - Fpga Motion Detection Implementation

110
Intelligent IP Camera An FPGA Motion Detecti on Implementation D A T 6 , S p r i n g 2 0 0 8 .  N i c o l a s C o t h e r e a u  G u i l l a u m e D e l a i t e  E d o u a r d G o u r d i n  A a l b o r g U n i v e r s i t y  D e p a r t m e n t o f C o m p u t e r S c i e n c e  

Transcript of Intelligent Ip Camera - Fpga Motion Detection Implementation

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 1/110

Intelligent IP CameraAn FPGA Motion DetectionImplementation

D A T 6 , S p r i n g 2 0 0 8 .  

N i c o l a s C o t h e r e a u  

G u i l l a u m e D e l a i t e  

E d o u a r d G o u r d i n  

e      

A a l b o r g U n i v e r s i t y  

D e p a r t m e n t o f C o m p u t e r S c i e n c e  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 2/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 3/110

A a l b o r g U n i v e r s i t y      D e p a r t m e n t o f C o m p u t e r S c i e n c e  

T I T L E :  

I n t e l l i g e n t I P C a m e r a  

A n F P G A M o t i o n D e t e c t i o n  

I m p l e m e n t a t i o n  

T H E M E :  

D i s t r i b u t e d S y s t e m s  

a n d S e m a n t i c s  

C o n t r o l S y s t e m s  

P R O J E C T P E R I O D :  

0 1 / 0 2 / 2 0 0 8 - 3 1 / 0 5 / 2 0 0 8  

P R O J E C T G R O U P :  

d 6 0 5 a  

G R O U P M E M B E R S :  

N i c o l a s C o t h e r e a u  

G u i l l a u m e D e l a i t e  

E d o u a r d G o u r d i n  

S U P E R V I S O R S :  

A l e x a n d r e D a v i d  

Y a n n i c k L e M o u l l e c  

N U M B E R O F C O P I E S :  2 

N U M B E R O F P A G E S :  9 4 

C O N C L U D E D :  2 6 - 0 5 - 2 0 0 8  

S Y N O P S I S :  

T h i s R e p o r t d e a l s w i t h a n i n t e l l i g e n t c a m e r a  

i m p l e m e n t a t i o n . T h i s c a m e r a i s l i n k e d w i t h a  

A l t e r a F P G A p l a t f o r m ( D E 2 B o a r d ) w h e r e a  

m o t i o n d e t e c t i o n a l g o r i t h m i s i m p l e m e n t e d . A  

v i d e o i s r e c o r d e d w h e n m o v e m e n t s a r e d e t e c t e d .  

I t i s t h e n s t o r e d o n a S D - C a r d a n d a c c e s s i b l e  

o n a n E t h e r n e t n e t w o r k . H a r d w a r e a n d s o f t w a r e  

c o - d e s i g n i s s t u d i e d t o i m p l e m e n t t h e m o t i o n  

d e t e c t i o n a l g o r i t h m o n a   N i o s I I   s o f t c o r e  

p r o c e s s o r , w i t h h a r d w a r e a c c e l e r a t i o n . T h e  

p r o j e c t i s c o m p o s e d o f b a c k g r o u n d a n a l y s i s ,  

d e s i g n m o d e l s t u d y , s y s t e m a n a l y s i s a n d d e s i g n ,  

m o t i o n d e t e c t i o n a l g o r i t h m a n a l y s i s a n d d e s i g n ,  

i m p l e m e n t a t i o n o f t h e p r o p o s e d s o l u t i o n , a n d  

t e s t i n g a n d e x p e r i m e n t s o f t h i s i m p l e m e n t a -  

t i o n . T h e v i d e o c a p t u r e a n d t r a n s m i s s i o n a r e  

s u c c e s s f u l l y i m p l e m e n t e d . T h e m o t i o n d e t e c -  

t i o n a l g o r i t h m i s a l s o i m p l e m e n t e d , b u t u s i n g  

i m a g e s f r o m t h e d e s k t o p l e s y s t e m . S t o r a g e  

a n d r e c o r d i n g p a r t s a r e n o t i m p l e m e n t e d d u e  

t o m e m o r y c h i p p r o b l e m s . A s a c o n c l u s i o n ,  

t h e o p t i m i z a t i o n o f v i d e o s u r v e i l l a n c e b y u s -  

i n g  F P G A   s e e m s t o b e p o s s i b l e , b u t w i t h  

a c u s t o m a n d o p t i m i z e d p l a t f o r m i n s t e a d o f a  

' s t a n d a r d o n e ' ( i . e . p r o d u c e d b y a m a n u f a c t u r e r ) .  

k e y w o r d s :   M a s t e r T h e s i s , M o t i o n D e t e c t i o n ,  

A l t e r a , F G P A , S o f t c o r e P r o c e s s o r , A l g o r i t h m ,  

B a c k g r o u n d S u b t r a c t i o n , T h r e s h o l d i n g , H W / S W  

C o - d e s i g n , D e s i g n M o d e l .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 4/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 5/110

T h i s r e p o r t i s t h e r e s u l t o f t h e w o r k d o n e d u r i n g t h e S S E 4 ( D a t 6 ) s e m e s t e r o f t h e  

C a n d . S c i e n t s t u d y a t D e p a r t m e n t o f C o m p u t e r S c i e n c e , A a l b o r g U n i v e r s i t y . T h i s  

p r o j e c t w a s d o n e i n t h e r e s e a r c h a r e a o f D i s t r i b u t e d S y s t e m s a n d S e m a n t i c s a n d  

C o n t r o l S y s t e m s . I t c o n s t i t u t e s t h e c o m p l e t e w o r k t o w a r d a m a s t e r t h e s i s .  

W e w o u l d l i k e t o t h a n k o u r s u p e r v i s o r s , Y a n n i c k l e M o u l l e c a n d A l e x a n d r e D a v i d  

f o r s u p e r v i s i n g t h i s p r o j e c t a n d t h e m a n y h e l p f u l c o m m e n t s m a d e t h r o u g h o u t t h e  

p r o j e c t . W e w o u l d a l s o l i k e t o t h a n k R a s m u s A b i l d g r e n f o r h i s p r e c i o u s a n d h e l p f u l  

i n s i g h t s i n t o u s e o f D e s i g n T r o t t e r .  

T h e d o c u m e n t i s o r g a n i s e d a s f o l l o w s :   P a r t I   i s t h e m a i n r e p o r t , w i t h t h e e x -  

p l a n a t i o n s a n d d e t a i l s o f t h e p r o p o s e d s o l u t i o n .   P a r t I I   r e g r o u p s t h e a p p e n d i c e s  

a n d t h e b i b l i o g r a p h y o f t h i s r e p o r t . T h e o r g a n i z a t i o n o f e a c h p a r t i s d e t a i l e d i n t h e  

i n t r o d u c t i o n o f e a c h .  

T h i s t h e s i s h a s b e e n r e v i s e d o n t h e 2 6 t h o f m a y , 2 0 0 8 . S o m e c o r r e c t i o n s a n d  

c h a n g e s w e r e m a d e t o t h e p u b l i s h e d e d i t i o n .  

N i c o l a s C o t h e r e a u G u i l l a u m e D e l a i t e  

E d o u a r d G o u r d i n  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 6/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 7/110

v i i 

S u m m a r y      

T h i s R e p o r t d e a l s w i t h a n i n t e l l i g e n t c a m e r a i m p l e m e n t a t i o n . T h i s c a m e r a i s  

l i n k e d w i t h a   A l t e r a   F i e l d P r o g r a m m a b l e G a t e A r r a y ( F P G A ) p l a t f o r m o n a D E 2  

B o a r d w h e r e a m o t i o n d e t e c t i o n a l g o r i t h m i s i m p l e m e n t e d . T h e m a i n g o a l o f t h i s  

p r o j e c t i s t o a n a l y s e t h e f e a s i b i l i t y o f o p t i m i z i n g v i d e o s u r v e i l l a n c e w i t h a n F P G A .  

T h e a i m i s t h e r e f o r e t o c r e a t e a p r o t o t y p e t o d o s e v e r a l f u n c t i o n , w i t h s o m e r e -  

q u i r e m e n t s . A r o o m i s m o n i t o r e d a n d t h e v i d e o c a p t u r e d b y t h e c a m e r a s e n s o r i s  

d i s p l a y e d o n a V G A s c r e e n . T h e v i d e o i s r e c o r d e d o n l y w h e n m o t i o n s a r e d e t e c t e d .  

T h e n , t h e v i d e o i s s t o r e d o n a S D - C a r d a n d a c c e s s i b l e o n a n E t h e r n e t n e t w o r k . H a r d -  

w a r e a n d s o f t w a r e c o - d e s i g n i s s t u d i e d t o i m p l e m e n t t h e m o t i o n d e t e c t i o n a l g o r i t h m  

o n a  N i o s I I   s o f t c o r e p r o c e s s o r , w i t h h a r d w a r e a c c e l e r a t i o n .  

T h e p r o j e c t i s c o m p o s e d o f b a c k g r o u n d a n a l y s i s w h i c h d e t a i l s t h e m a i n c o n t e x t o f  

t h e p r o j e c t a n d d e t a i l s t h e p r o b l e m t o b e a n s w e r e d i n t h i s r e p o r t . T h e n , a d e s i g n  

m o d e l s t u d y i s p r o p o s e d t o e n h a n c e t h e a n a l y s i s , d e s i g n a n d i m p l e m e n t a t i o n o f t h e  

p r o j e c t . T h e s y s t e m a n a l y s i s a n d d e s i g n a n d t h e m o t i o n d e t e c t i o n a l g o r i t h m a n a l -  

y s i s a n d d e s i g n a r e s u c c e s s i v e l y g i v e n . F i n a l l y , t h e i m p l e m e n t a t i o n o f t h e p r o p o s e d  

s o l u t i o n a n d t h e t e s t i n g a n d e x p e r i m e n t s p a r t s a r e d e t a i l e d .  

T h e v i d e o c a p t u r e a n d t r a n s m i s s i o n a r e s u c c e s s f u l l y i m p l e m e n t e d . T h o s e p a r t s a r e  

i m p l e m e n t e d i n f u l l h a r d w a r e , u s i n g   V e r i l o g   p r o g r a m m i n g l a n g u a g e . T h e m o t i o n  

d e t e c t i o n a l g o r i t h m i m p l e m e n t e d i s a b a c k g r o u n d s u b t r a c t i o n a l g o r i t h m . A s t h e  

r e c o r d i n g a n d s t o r a g e b l o c k s a r e n o t s u c c e s s f u l l y i m p l e m e n t e d , f r a m e s s t o r e d o n  

t h e d e s k t o p l e s y s t e m a r e u s e d t o t e s t t h e a l g o r i t h m . I t i s f u l l y i m p l e m e n t e d i n  

s o f t w a r e , u s i n g A N S I - C p r o g r a m m i n g l a n g u a g e . S t o r a g e a n d r e c o r d i n g p a r t s a r e n o t  

i m p l e m e n t e d d u e t o m e m o r y c h i p p r o b l e m s .  

A s a c o n c l u s i o n , t h e o p t i m i z a t i o n o f v i d e o s u r v e i l l a n c e b y u s i n g   F P G A   s e e m s t o  

b e p o s s i b l e , b u t w i t h a c u s t o m a n d o p t i m i z e d p l a t f o r m i n s t e a d o f a s t a n d a r d o n e  

( i . e . p r o d u c e d b y a m a n u f a c t u r e r ) . I n f a c t s , t h e m e m o r y c h i p o f t h e s e l e c t e d b o a r d  

i s a n 8 M B S D R A M c h i p , w h i l e f o r t h i s p r o j e c t t w o 2 5 6 M B S D R A M w o u l d h a v e  

b e e n b e t t e r .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 8/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 9/110

C o n t e n t s    

I M a i n R e p o r t 1  

1 I n t r o d u c t i o n 3  

1 . 1 S u r v e i l l a n c e s y s t e m s . . . . . . . . . . . . . . . . . . . . . . . . . . . 3  

1 . 2 V i d e o C a m e r a a n d I n t e l l i g e n c e . . . . . . . . . . . . . . . . . . . . . 3  

1 . 3 P r o b l e m s t a t e m e n t . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4  

1 . 4 G o a l s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5  

1 . 4 . 1 S e l e c t i o n a n d s i m u l a t i o n o f t h e e v e n t d e t e c t i o n a l g o r i t h m . . 5  

1 . 4 . 2 T r a n s m i s s i o n c h a i n . . . . . . . . . . . . . . . . . . . . . . . . 5  

1 . 4 . 3 R e c o r d i n g a n d S t o r a g e C h a i n . . . . . . . . . . . . . . . . . . 5  

1 . 4 . 4 I n t e l l i g e n t C a m e r a . . . . . . . . . . . . . . . . . . . . . . . . 6  

1 . 4 . 5 O p t i m i z e d I n t e l l i g e n t C a m e r a . . . . . . . . . . . . . . . . . . 7  

1 . 4 . 6 C o m p l e t e I n t e l l i g e n t I P C a m e r a . . . . . . . . . . . . . . . . . 7  

1 . 5 T a s k s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8  

1 . 5 . 1 C a p t u r e i m a g e w i t h t h e c a m e r a s e n s o r . . . . . . . . . . . . . 8  

1 . 5 . 2 D i s p l a y i m a g e o n a s c r e e n . . . . . . . . . . . . . . . . . . . . 8  

1 . 5 . 3 R e c o r d c a p t u r e d v i d e o . . . . . . . . . . . . . . . . . . . . . . 8  

1 . 5 . 4 S t o r e r e c o r d e d v i d e o . . . . . . . . . . . . . . . . . . . . . . . 9  

1 . 5 . 5 A c c e s s r e c o r d e d v i d e o . . . . . . . . . . . . . . . . . . . . . . 9  

1 . 5 . 6 E v e n t d e t e c t i o n a l g o r i t h m . . . . . . . . . . . . . . . . . . . . 1 0  

1 . 5 . 7 V i d e o c o m p r e s s i o n . . . . . . . . . . . . . . . . . . . . . . . . 1 1  

1 . 6 S t r u c t u r e o f t h e d o c u m e n t . . . . . . . . . . . . . . . . . . . . . . . . 1 1  

2 D e s i g n M o d e l s 1 3  

2 . 1 D e s c r i p t i o n o f t h e  A3

p a r a d i g m . . . . . . . . . . . . . . . . . . . . . 1 3  

2 . 2 D e s c r i p t i o n o f t h e R u g b y M e t a - M o d e l . . . . . . . . . . . . . . . . . 1 5  

2 . 3 T h i s p r o j e c t d e s c r i b e d u s i n g t h e d e s i g n m o d e l s . . . . . . . . . . . . 1 7  

2 . 3 . 1 T h e  A3

a p p l i e d t o o u r p r o j e c t . . . . . . . . . . . . . . . . . . 1 7  

2 . 3 . 2 T h e R u g b y M e t a - M o d e l a p p l i e d t o o u r p r o j e c t . . . . . . . . 1 9  

3 S y s t e m D e s c r i p t i o n 2 3  

3 . 1 S y s t e m c o n s t r a i n t s a n a l y s i s . . . . . . . . . . . . . . . . . . . . . . . 2 4  

3 . 1 . 1 U s e o f   F P G A   . . . . . . . . . . . . . . . . . . . . . . . . . . 2 4  

3 . 1 . 2 T i m e c o n s t r a i n t . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5  

3 . 1 . 3 D a t a c o n s t r a i n t s . . . . . . . . . . . . . . . . . . . . . . . . . 2 6  

3 . 1 . 4 O t h e r c o n s t r a i n t s . . . . . . . . . . . . . . . . . . . . . . . . . 2 6  

i x 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 10/110

x  C o n t e n t s  

3 . 2 S k e t c h i n g t h e i n i t i a l a r c h i t e c t u r e . . . . . . . . . . . . . . . . . . . . 2 6  

3 . 2 . 1 H a r d w a r e / s o f t w a r e c o - d e s i g n . . . . . . . . . . . . . . . . . . 2 6  

3 . 2 . 2 s o f t c o r e p r o c e s s o r d e n i t i o n . . . . . . . . . . . . . . . . . . . 2 7  

3 . 2 . 3 T h e n e e d f o r a s o f t c o r e p r o c e s s o r . . . . . . . . . . . . . . . . 2 8  

3 . 2 . 4 T h e n e e d f o r a n e m b e d d e d O S . . . . . . . . . . . . . . . . . 2 8  

3 . 3 P o s s i b l e o p t i o n s t o s a t i s f y t h e s y s t e m c o n s t r a i n t s . . . . . . . . . . . 2 9  

3 . 4  F P G A   p l a t f o r m s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 9  

3 . 4 . 1   A l t e r a C y c l o n e I I   o n  T e r a s i c   D E 2 b o a r d . . . . . . . . 2 9  

3 . 4 . 2   A l t e r a S t r a t i x   . . . . . . . . . . . . . . . . . . . . . . . . 2 9  

3 . 4 . 3   X i l i n x V i r t e x   I I o n   C e l o x i c a   R C 2 0 3 b o a r d . . . . . . . . 3 0  

3 . 5 P r o g r a m m i n g a n d s i m u l a t i o n l a n g u a g e s . . . . . . . . . . . . . . . . 3 0  

3 . 5 . 1 H a r d w a r e D e s c r i p t i o n L a n g u a g e s ( H D L ) . . . . . . . . . . . . 3 0  

3 . 5 . 2 S y s t e m D e s i g n L a n g u a g e s ( S D L ) . . . . . . . . . . . . . . . . 3 2  

3 . 5 . 3 H i g h L e v e l L a n g u a g e s . . . . . . . . . . . . . . . . . . . . . . 3 4  

3 . 6 S o f t c o r e p r o c e s s o r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 6  

3 . 6 . 1   N i o s I I   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 6  

3 . 6 . 2 M i c r o b l a z e . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 6  

3 . 6 . 3 S P A R C a n d L E O N . . . . . . . . . . . . . . . . . . . . . . . 3 7  

3 . 6 . 4 O p e n s o f t c o r e p r o c e s s o r . . . . . . . . . . . . . . . . . . . . . 3 7  

3 . 7 E m b e d d e d   O S  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 7  

3 . 7 . 1   u C L i n u x   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 8  

3 . 7 . 2 e C o s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 8  

3 . 7 . 3   M i c r o C / O S - I I   . . . . . . . . . . . . . . . . . . . . . . . . . 3 8  

3 . 8 C h o i c e s m a d e t o m e e t t h e c o n s t r a i n t s a n d r e q u i r e m e n t s . . . . . . . 3 8  

3 . 8 . 1   F P G A   p l a t f o r m . . . . . . . . . . . . . . . . . . . . . . . . . 3 8  

3 . 8 . 2 C a m e r a s e n s o r . . . . . . . . . . . . . . . . . . . . . . . . . . 3 9  

3 . 8 . 3 P r o g r a m m i n g l a n g u a g e s . . . . . . . . . . . . . . . . . . . . . 3 9  

3 . 8 . 4 s o f t c o r e p r o c e s s o r . . . . . . . . . . . . . . . . . . . . . . . . 4 0  

3 . 8 . 5 E m b e d d e d   O S  . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2  

4 M o t i o n D e t e c t i o n A l g o r i t h m 4 3  

4 . 1 D e n i t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4  

4 . 2 A n a l y s i s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 5  

4 . 3 D e s i g n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 6  

4 . 3 . 1 B a c k g r o u n d G e n e r a t i o n . . . . . . . . . . . . . . . . . . . . . 4 6  

4 . 3 . 2 T h r e s h o l d i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 7  

4 . 3 . 3 S e l e c t i n g a n E c i e n t M e d i a n S e a r c h A l g o r i t h m . . . . . . . . 4 7  

4 . 4 P r o l i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 8  

4 . 5 M e t r i c s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1  

4 . 5 . 1 C h o s e n M e t r i c s . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1  

4 . 5 . 2 R e s u l t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2  

4 . 5 . 3 C o n c l u s i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4  

5 I m p l e m e n t a t i o n 5 5  

5 . 1 T r a n s m i s s i o n c h a i n . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 6  

5 . 1 . 1 I m a g e c a p t u r e . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 6  

5 . 1 . 2 D i s p l a y I m a g e o n a S c r e e n . . . . . . . . . . . . . . . . . . . . 6 0  

5 . 1 . 3 O t h e r F e a t u r e s . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 11/110

C O N T E N T S   x i 

5 . 2 R e c o r d i n g a n d s t o r a g e c h a i n . . . . . . . . . . . . . . . . . . . . . . . 6 3  

5 . 2 . 1 I m p l e m e n t a t i o n o f t h e   N i o s I I   . . . . . . . . . . . . . . . . . 6 3  

5 . 2 . 2 R e c o r d c a p t u r e d v i d e o . . . . . . . . . . . . . . . . . . . . . . 6 5  

5 . 2 . 3 S t o r e r e c o r d e d v i d e o . . . . . . . . . . . . . . . . . . . . . . . 6 6  

5 . 2 . 4 A c c e s s r e c o r d e d v i d e o . . . . . . . . . . . . . . . . . . . . . . 6 6  

5 . 3 I n t e l l i g e n t c a m e r a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7  

5 . 3 . 1 M o t i o n d e t e c t i o n a l g o r i t h m . . . . . . . . . . . . . . . . . . . 6 7  

5 . 4 N o n i m p l e m e n t e d b l o c k s . . . . . . . . . . . . . . . . . . . . . . . . . 6 8  

6 T e s t i n g & E x p e r i m e n t s 6 9  

6 . 1 T e s t i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 0  

6 . 1 . 1 T r a n s m i s s i o n c h a i n t e s t i n g . . . . . . . . . . . . . . . . . . . . 7 0  

6 . 1 . 2 M o t i o n d e t e c t i o n a l g o r i t h m t e s t i n g . . . . . . . . . . . . . . . 7 0  

6 . 2 E x p e r i m e n t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1  

6 . 2 . 1 T r a n s m i s s i o n c h a i n t e s t i n g . . . . . . . . . . . . . . . . . . . . 7 2  

6 . 2 . 2 M o t i o n d e t e c t i o n a l g o r i t h m e x p e r i m e n t s . . . . . . . . . . . . 7 2  

7 C o n c l u s i o n a n d F u t u r e W o r k 7 5  

7 . 1 C o n c l u s i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5  

7 . 1 . 1 W h a t h a s b e e n d o n e t o a n s w e r t h e p r o b l e m . . . . . . . . . . 7 5  

7 . 1 . 2 A n s w e r t o t h e p r o b l e m . . . . . . . . . . . . . . . . . . . . . . 7 7  

7 . 1 . 3 S o l u t i o n p r o p o s a l f o r a c o m p l e t e o p e r a t i o n a l s y s t e m . . . . . 7 7  

7 . 2 F u t u r e w o r k s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7  

7 . 2 . 1 S h o r t t e r m f u t u r e w o r k s . . . . . . . . . . . . . . . . . . . . . 7 7  

7 . 2 . 2 L o n g t e r m f u t u r e w o r k s . . . . . . . . . . . . . . . . . . . . . 7 8  

I I A p p e n d i c e s & R e f e r e n c e s 7 9  

G l o s s a r y 8 1  

A H a r d w a r e / s o f t w a r e c o - d e s i g n d e n i t i o n . . . . . . . . . . . . . . . . . 8 1  

B  O S  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1  

C e m b e d d e d   O S  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1  

D H a r d w a r e D e s c r i p t i o n L a n g u a g e d e n i t i o n . . . . . . . . . . . . . . . 8 2  

E S y s t e m D e s c r i p t i o n L a n g u a g e d e n i t i o n . . . . . . . . . . . . . . . . 8 2  

F h i g h - l e v e l p r o g r a m m i n g l a n g u a g e d e n i t i o n . . . . . . . . . . . . . . 8 2  

G s o f t c o r e p r o c e s s o r d e n i t i o n . . . . . . . . . . . . . . . . . . . . . . . 8 3  

H E m b e d d e d   F P G A   d e n i t i o n . . . . . . . . . . . . . . . . . . . . . . . 8 3  

I O t h e r a c r o n y m s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4  

I . 1 S D d e n i t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4  

I . 2 M M C d e n i t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4  

I . 3 A S I C d e n i t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4  

I . 4 S o P C d e n i t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4  

A l g o r i t h m s i m p l i e d c a l l g r a p h 8 5  

T i m e p l a n 8 7  

C D - R o m c o n t e n t 8 9  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 12/110

x i i  C o n t e n t s  

R e f e r e n c e s 9 1  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 13/110

L i s t o f F i g u r e s    

1 . 1 T r a n s m i s s i o n c h a i n b l o c k d i a g r a m . . . . . . . . . . . . . . . . . . . . 5  

1 . 2 R e c o r d i n g c h a i n b l o c k d i a g r a m . . . . . . . . . . . . . . . . . . . . . 6  

1 . 3 I n t e l l i g e n t v i d e o c a m e r a b l o c k d i a g r a m . . . . . . . . . . . . . . . . . 6  

1 . 4 O p t i m i z e d i n t e l l i g e n t v i d e o c a m e r a b l o c k d i a g r a m . . . . . . . . . . . 7  

1 . 5 G l o b a l b l o c k d i a g r a m o f t h e p r o j e c t . . . . . . . . . . . . . . . . . . . 7  

2 . 1 A3

p a r a d i g m d e s i g n o w . . . . . . . . . . . . . . . . . . . . . . . . . 1 4  

2 . 2 T h e R u g b y m e t a m o d e l . . . . . . . . . . . . . . . . . . . . . . . . . 1 6  

2 . 3 T h e d i e r e n t t y p i c a l a b s t r a c t i o n l e v e l s . . . . . . . . . . . . . . . . . 1 7  

2 . 4  A3p a r a d i g m a p p l i e d t o t h i s p r o j e c t . . . . . . . . . . . . . . . . . . 1 8  

2 . 5 R u g b y m e t a - m o d e l a p p l i e d t o o u r p r o j e c t . . . . . . . . . . . . . . . . 2 0  

2 . 6 T h e C o m p u t a t i o n d o m a i n . . . . . . . . . . . . . . . . . . . . . . . . 2 0  

2 . 7 T h e C o m m u n i c a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 0  

2 . 8 T h e D a t a d o m a i n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1  

2 . 9 T h e T i m e d o m a i n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1  

3 . 1 L o c a t i o n i n t h e  A3

p a r a d i g m . . . . . . . . . . . . . . . . . . . . . . 2 3  

3 . 2 L o c a t i o n i n t h e R u g b y M e t a - M o d e l . . . . . . . . . . . . . . . . . . . 2 4  

3 . 3 H W / S W C o - D e s i g n t o r e a c h c o n s t r a i n t s . . . . . . . . . . . . . . . . 2 7  

3 . 4 S y s t e m - l e v e l l a n g u a g e r e q u i r e m e n t s . . . . . . . . . . . . . . . . . . . 3 4  

4 . 1 M o t i o n d e t e c t i o n a l g o r i t h m ' s l o c a t i o n i n t h e  A3

m o d e l . . . . . . . . 4 3  

4 . 2 M o t i o n d e t e c t i o n a l g o r i t h m ' s l o c a t i o n i n t h e R u g b y M e t a - M o d e l . . 4 4  

4 . 3 P r o l e r i n H a r d w a r e / S o f t w a r e C o - D e s i s g n . . . . . . . . . . . . . . . 4 8  

4 . 4 R e s u l t s o f m o t i o n d e t e c t i o n t e s t . . . . . . . . . . . . . . . . . . . . . 4 9  

5 . 1 L o c a t i o n i n t h e  A3

p a r a d i g m . . . . . . . . . . . . . . . . . . . . . . 5 5  

5 . 2 L o c a t i o n i n t h e R u g b y M e t a - M o d e l . . . . . . . . . . . . . . . . . . . 5 6  

5 . 3 S i m p l i e d b l o c k d i a g r a m o f t h e t r a n s m i s s i o n c h a i n . . . . . . . . . . 5 7  

5 . 4 C a m e r a s e n s o r G P I O o r g a n i z a t i o n . . . . . . . . . . . . . . . . . . . 5 8  

5 . 5 R T L v i e w o f t h e C C D _ C a p t u r e b l o c k . . . . . . . . . . . . . . . . . 5 9  

5 . 6 G e n e r i c   N i o s I I   d i a g r a m . . . . . . . . . . . . . . . . . . . . . . . . 6 4  

5 . 7 G e n e r i c   N i o s I I   c o r e b l o c k d i a g r a m . . . . . . . . . . . . . . . . . . 6 4  

5 . 8 D i e r e n t o p e r a t i o n o n t h e S D - C a r d . . . . . . . . . . . . . . . . . . . 6 6  

5 . 9 B l o c k d i a g r a m o f t h e S D - C a r d c u s t o m d r i v e r . . . . . . . . . . . . . 6 7  

x i i i  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 14/110

x i v  L i s t o f F i g u r e s  

6 . 1 L o c a t i o n i n t h e   A3p a r a d i g m . . . . . . . . . . . . . . . . . . . . . . 6 9  

6 . 2 L o c a t i o n i n t h e R u g b y M e t a - M o d e l . . . . . . . . . . . . . . . . . . . 7 0  

6 . 3 R e s u l t s o f m o t i o n d e t e c t i o n t e s t . . . . . . . . . . . . . . . . . . . . . 7 1  

6 . 4 R e s u l t s o f m o t i o n d e t e c t i o n e x p e r i m e n t s . . . . . . . . . . . . . . . . 7 3  

1 S i m p l i e d c a l l g r a p h o f t h e C v e r s i o n o f t h e a l g o r i t h m . . . . . . . . 8 5  

2 G A N T T D i a g r a m o f t h e P r o j e c t . . . . . . . . . . . . . . . . . . . . 8 8  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 15/110

L i s t o f T a b l e s    

2 . 1 P r o s a n d c o n s o f p r o c e s s o r s a v a i l a b l e . . . . . . . . . . . . . . . . . . 1 9  

3 . 1 P r o s a n d c o n s o f   F P G A   . . . . . . . . . . . . . . . . . . . . . . . . 2 5  

3 . 2 P r o s a n d c o n s o f C l a n g u a g e . . . . . . . . . . . . . . . . . . . . . . . 3 5  

4 . 1 A p p l i c a t i o n p r o l e d R e s u l t s ( % T i m e ) . . . . . . . . . . . . . . . . . 5 0  

4 . 2 A l g o r i t h m p r o l e d R e s u l t s ( % T i m e ) . . . . . . . . . . . . . . . . . . 5 0  

4 . 3 M e t r i c s R e s u l t s f o r t h e G r e y s c a l e C o n v e r s i o n u s i n g D e s i g n T r o t t e r . 5 2  

4 . 4 M e t r i c s R e s u l t s f o r t h e B a c k g r o u n d S u b s t i t u t i o n u s i n g D e s i g n T r o t t e r 5 3  

4 . 5 M e t r i c s R e s u l t s f o r t h e M e d i a n S e a r c h a l g o r i t h m u s i n g D e s i g n T r o t t e r 5 3  

4 . 6 M e t r i c s R e s u l t s f o r t h e A u t o m a t i c T h r e s h o l d u s i n g D e s i g n T r o t t e r . 5 4  

1 P r o s a n d c o n s o f  F P G A   . . . . . . . . . . . . . . . . . . . . . . . . 8 3  

x v 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 16/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 17/110

P a r t I  

M a i n R e p o r t    

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 18/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 19/110

Chapter1I n t r o d u c t i o n      

T h i s c h a p t e r p r e s e n t s t h e o v e r a l l c o n t e x t o f t h i s p r o j e c t . F i r s t l y , a s h o r t b a c k -  

g r o u n d d e s c r i p t i o n o f s u r v e i l l a n c e s y s t e m s a n d v i d e o s u r v e i l l a n c e i s g i v e n . T h e n , t h e  

p r o b l e m s t a t e m e n t o f t h e p r o j e c t i s f o r m u l a t e d a s a q u e s t i o n . T h e m e t h o d o l o g y u s e d  

f o r a n s w e r i n g t h e q u e s t i o n i s s u b s e q u e n t l y i n t r o d u c e d : g o a l s a n d t a s k s a r e d e n e d  

s t e p - b y - s t e p . F i n a l l y , t h e o r g a n i z a t i o n o f P a r t I i s d e t a i l e d .  

1 . 1 S u r v e i l l a n c e s y s t e m s  

S u r v e i l l a n c e i s t h e m o n i t o r i n g o f b e h a v i o u r ; a s u r v e i l l a n c e s y s t e m i s a s y s t e m  

d e s i g n e d t o p r o c e s s a n d m o n i t o r t h e b e h a v i o u r o f p e o p l e , o b j e c t s o r p r o c e s s e s w i t h i n  

a g i v e n s y s t e m f o r c o n f o r m i t y t o e x p e c t e d / d e s i r e d n o r m s i n t r u s t e d s y s t e m s f o r  

s e c u r i t y / s o c i a l c o n t r o l . I t c a n b e e i t h e r s e c r e t e o r e v i d e n t . A l t h o u g h t h e w o r d  

s u r v e i l l a n c e l i t e r a l l y m e a n s w a t c h i n g o v e r , t h e t e r m i s o f t e n u s e d f o r a l l f o r m s o f  

o b s e r v a t i o n o r m o n i t o r i n g , n o t j u s t v i s u a l o b s e r v a t i o n [ U n i 8 9 ] . N e v e r t h e l e s s , t h e  

a l l - s e e i n g e y e i n t h e s k y i s s t i l l a g e n e r a l i c o n o f s u r v e i l l a n c e . S u r v e i l l a n c e i n m a n y  

m o d e r n c i t i e s a n d b u i l d i n g s o f t e n u s e s c l o s e d - c i r c u i t t e l e v i s i o n c a m e r a s .  

F r o m t h e b e g i n n i n g o f h u m a n c i v i l i z a t i o n , t h e r e h a s a l w a y s b e e n a n e e d f o r s u r v e i l -  

l a n c e s y s t e m s . T h e r e a s o n s a r e n u m e r o u s : b o r d e r s g u a r d i n g , r a i d e r s , s p i e s a n d  

t h i e v e s p r o t e c t i o n s . T h e S u n T z u ' s   A r t o f W a r  , w r i t t e n m o r e t h a n 2 , 0 0 0 y e a r s a g o ,  

e x p l a i n h o w t o u s e s p i e s a g a i n s t e n e m i e s . D u r i n g t h o u s a n d s o f y e a r s , t h e r e w e r e  

o n l y o n e k i n d o f s u r v e i l l a n c e s y s t e m w i t h t w o k i n d s o f a c t o r s ( o r c r e a t u r e s ) : h u m a n  

b e i n g s a n d d o g s . I t w a s m o r e o r l e s s e c i e n t d e p e n d i n g o n t h e h o u r o f t h e d a y .  

H o w e v e r , e l e c t r o n i c s a n d I n f o r m a t i o n T e c h n o l o g i e s ( I T ) g a v e t h e s u r v e i l l a n c e n e w  

p o s s i b i l i t i e s , m a k i n g i t m o r e e c i e n t a n d m o r e r o b u s t .  

1 . 2 V i d e o C a m e r a a n d I n t e l l i g e n c e  

F r o m t h e i r i n v e n t i o n a c e n t u r y a g o , v i d e o c a m e r a s h a v e b e e n e a r l y a s s o c i a t e d w i t h  

s u r v e i l l a n c e s y s t e m s ( e . g . d u r i n g W o r l d W a r I ) . N o w t h a t c a m e r a s a r e m o r e a n d  

m o r e a o r d a b l e , s u r v e i l l a n c e s y s t e m s u s i n g t h e m h a v e b e e n g e n e r a l i z e d a n d s p r e a d  

a l l o v e r t h e w o r l d . I t i s b e c a u s e t h e y a r e a n s w e r i n g a n e e d . I t c o n s i s t s i n p l a c i n g  

v i d e o c a m e r a i n a p u b l i c o r p r i v a t e a r e a t o v i s u a l i z e o r r e c o r d i n a c e n t r a l r o o m a l l  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 20/110

4  1 . I n t r o d u c t i o n  

t h e p e o p l e o w s . I t s a i m i s t o p r e v e n t t h e f t s , a t t a c k s , f r a u d s a n d t o m a n a g e t h e  

i n c i d e n t s a n d t h e s w a y s o f t h e c r o w d . A s t h e i n f o r m a t i o n i s c e n t r a l i z e d , i t a l l o w s t h e  

o w n e r o f a s y s t e m t o s a v e m o n e y b y e m p l o y i n g l e s s p e o p l e a n d b e i n g m o r e e c i e n t ,  

a s a m a n c a n n o t w a t c h e v e r y p a r t o f t h e s p a c e a t t h e s a m e t i m e w h e r e a s t h e c a m e r a s  

c a n [ C u s 0 3 ] .  

A f t e r t h e u s e o f t h e v i d e o c a m e r a s , t h e o t h e r m a i n p r o g r e s s e s w e r e m o b i l e v i d e o  

c a m e r a s , t a p e r e c o r d i n g a n d m o r e r e c e n t l y i n t e l l i g e n t v i d e o c a m e r a s . I n f a c t , w h e n  

o n e r e c o r d s a l l t h e i n f o r m a t i o n c a p t u r e d b y a v i d e o c a m e r a , i t l e a d s t o g e t a l o t o f  

t a p e s . T h e r e f o r e , o n e n e e d s t o g e t r o o m t o s t o r e t h o s e d a t a . H e n c e , i t c o s t s m o n e y  

f o r h a v i n g a r e c o r d m a i n l y c o n s i s t i n g o f a c t i o n s o f n o i n t e r e s t i n s t e a d o f a r e c o r d o f  

u s e f u l s e q u e n c e s ( r o b b e r y , v a n d a l i s m , e t c . ) .  

I n t e l l i g e n c e i n v i d e o c a m e r a i s w h e r e t h e s t r e s s i s p u t n o w a d a y s : w i t h t h i s k i n d o f  

v i d e o c a m e r a , t h e r e c o r d e d d a t a i s s m a l l e r . I n f a c t , t h a n k s t o t h e i m p l e m e n t a t i o n o f  

a n i m a g e p r o c e s s i n g a l g o r i t h m , t h e v i d e o i s r e c o r d e d a n d s t o r e d o n l y w h e n n e e d e d  

( m o t i o n d e t e c t e d , f a c e r e c o g n i z e d , e t c . ) . T h e m e m o r y u s a g e o f t h e v i d e o c a n a l s o b e  

r e d u c e d b y u s i n g c o m p r e s s i o n m e t h o d s . M o r e o v e r , u s i n g n e w t e c h n o l o g y a v o i d t o  

u s e t a p e b u t o t h e r s t o r a g e m e d i a , l i k e d a t a c a r d ( C o m p a c F l a s h c a r d , S D / X D - c a r d ,  

e t c . ) , w h i c h c a n c o n t a i n m o r e i n f o r m a t i o n a n d a r e s m a l l e r .  

1 . 3 P r o b l e m s t a t e m e n t  

A s e x p l a i n p r e v i o u s l y , t h e u s e o f a n i m a g e p r o c e s s i n g a l g o r i t h m a l l o w s t o s t o r e  

o n l y u s e f u l d a t a a n d s a v e s p a c e . T h e r e f o r e , t h e m a i n a i m o f t h i s p r o j e c t i s t o a n s w e r  

t h i s q u e s t i o n :  

I s i t p o s s i b l e t o i m p l e m e n t a n i n t e l l i g e n t I P v i d e o s u r v e i l l a n c e c a m e r a o n  

a n F i e l d P r o g r a m m a b l e G a t e A r r a y (  F P G A  

) p l a t f o r m t o o p t i m i z e v i d e o  

s u r v e i l l a n c e ?  

F o r t h i s p r o j e c t , t h e p r o j e c t g r o u p w o u l d l i k e t o c o n n e c t a c a m e r a w i t h a n   F P G A  

. T h i s   F P G A   p r o c e s s e s t h e p i c t u r e s c a p t u r e d b y a c a m e r a s e n s o r , u s e d a s a v i d e o  

c a m e r a , w i t h a n i m a g e p r o c e s s i n g a l g o r i t h m a n d t h e n m a k e i t a v a i l a b l e o n a w e b -  

s e r v e r , c o n n e c t e d o n a l o c a l E t h e r n e t n e t w o r k . T h e c o n t e x t o f t h e e x p e r i m e n t s i s :  

• A x e d v i d e o c a m e r a ;  

• A g i v e n r o o m t o m o n i t o r ;  

• S t a r t r e c o r d i n g o n l y w h e n a m o t i o n i s d e t e c t e d i n t h i s r o o m .  

T h e r e q u i r e m e n t s c a n b e d e s c r i b e d a s f o l l o w :  

F i r s t o f a l l , t h e a r c h i t e c t u r e h a s t o b e b a s e d o n a n   F P G A   ( m o r e d e t a i l s c a n b e f o u n d  

i n C h a p t e r 3 ) .  

S e c o n d l y , t h e H a r d w a r e / S o f t w a r e C o - D e s i s g n m e t h o d o l o g y s h o u l d b e u s e d t o i m -  

p l e m e n t t h e a l g o r i t h m s .   H a r d w a r e / S o f t w a r e C o - D e s i s g n t r i e s t o i n c r e a s e t h e p r e -  

d i c t a b i l i t y o f e m b e d d e d s y s t e m d e s i g n b y p r o v i d i n g a n a l y s i s m e t h o d s t h a t t e l l d e s i g n e r s  

i f a s y s t e m m e e t s i t s p e r f o r m a n c e , p o w e r , a n d s i z e g o a l s a n d s y n t h e s i s m e t h o d s t h a t  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 21/110

1 . 4 G o a l s   5 

l e t r e s e a r c h e r s a n d d e s i g n e r s r a p i d l y e v a l u a t e m a n y p o t e n t i a l d e s i g n m e t h o d o l o g i e s  

[ W o l 0 3 ] . A m o r e d e t a i l e d d e n i t i o n i s g i v e n i n C h a p t e r 3 . T h e c o n s t r a i n t s a r e d e n e d  

a n d d e t a i l e d i n C h a p t e r 3 .  

1 . 4 G o a l s  

T h e m a i n g o a l i s t o g e t t h e f u l l i m p l e m e n t a t i o n o f t h e p r o j e c t o n a n   F P G A   t o 

a n s w e r t o t h e q u e s t i o n . W h i c h m e a n s b u i l d i n g a p r o t o t y p e s y s t e m t o m o n i t o r a  

r o o m , t o p r o c e s s d a t a c a p t u r e d , t o r e c o r d t h e u s e f u l p a r t o f t h e v i d e o a n d n a l l y  

t o a l l o w a c c e s s e s t o t h i s v i d e o t h r o u g h t h e E t h e r n e t n e t w o r k , u s i n g t h e I n t e r n e t  

P r o t o c o l ( I P ) . T o a c h i e v e t h i s , t h e p r o j e c t i s s p l i t i n s e v e r a l p a r t s d e s c r i b e d b e l l o w .  

1 . 4 . 1 S e l e c t i o n a n d s i m u l a t i o n o f t h e e v e n t d e t e c t i o n a l g o r i t h m  

T h i s p a r t c o n s i s t s i n e x p l o r i n g t h e d i e r e n t m e t h o d s t o p r o c e s s i m a g e s . T h e n ,  

i t a l l o w s t h e s e l e c t i o n o f o n e a l g o r i t h m w h i c h f u l l o u r r e q u i r e m e n t s . O n c e t h e  

a l g o r i t h m i s s e l e c t e d , i t n e e d s t o b e p r o l e d t o e x t r a c t u s e f u l i n f o r m a t i o n t o g e t t h e  

b e s t i m p l e m e n t a t i o n . T h e r e f o r e , a r s t d r a f t u s i n g C c o d e i s t o b e i m p l e m e n t e d ,  

t h e n a l l m e t r i c s ( p a r a l l e l i s m , b e s t s u i t a b l e a r c h i t e c t u r e , e t c . [ A S R  

+0 5 ] ) a r e t o b e  

c a l c u l a t e d t o n a l l y g e t t h e p r o l e o f t h e a l g o r i t h m f o r t h e i m p l e m e n t a t i o n o f t h e  

n a l v e r s i o n o f t h e a l g o r i t h m .  

1 . 4 . 2 T r a n s m i s s i o n c h a i n  

T h e a i m o f t h i s p a r t i s t o c a p t u r e a v i d e o w i t h t h e c a m e r a s e n s o r a n d d i s p l a y i t o n a  

s c r e e n . T h i s i s t h e s e c o n d s t e p t o a c h i e v e o u r n a l g o a l . I n f a c t , t h i s i m p l e m e n t a t i o n  

s t e p a l l o w s t h e e x t r a c t i o n o f d a t a f r o m t h e v i d e o c a m e r a a n d a l l o w s t h e v e r i c a t i o n  

o f t h o s e d a t a w i t h a d i s p l a y . P l e a s e r e f e r t o F i g u r e 1 . 1 ( o n p a g e 5 ) t o g e t t h e b l o c k  

d i a g r a m o f t h i s p a r t .  

F i g u r e 1 . 1 : T r a n s m i s s i o n c h a i n b l o c k d i a g r a m : t h e i m p l e m e n t a t i o n o f t h i s s t e p i s  

v e r y s i m p l e a s i t o n l y n e e d s a f e w p r o c e s s i n g : t h e c o n v e r s i o n s f r o m r a w d a t a t o R G B  

a n d t h e g r e y - s c a l e d o n e . T h e d e c o m p o s i t i o n o f t h e d i e r e n t p a r t s o f t h i s s y s t e m i n  

b l o c k s a l l o w t h e c o n n e c t i o n o f f u t u r e o t h e r b l o c k s t o e n h a n c e t h e s y s t e m e a s i l y .  

1 . 4 . 3 R e c o r d i n g a n d S t o r a g e C h a i n  

T h e a i m o f t h i s p a r t i s t o a d d a r e c o r d i n g f u n c t i o n t o t h e p r e v i o u s l y d e s c r i b e d  

s y s t e m . T o v e r i f y t h i s a n d m a k e t h i s f u n c t i o n u s e f u l , a n a c c e s s f u n c t i o n i s t o b e  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 22/110

6  1 . I n t r o d u c t i o n  

a d d e d . T h i s a l l o w s t h e u s e r t o s e e w h a t h a s b e e n s t o r e d t h r o u g h a w e b - s e r v e r .  

P l e a s e s e e F i g u r e 1 . 2 ( o n p a g e 6 ) t o g e t t h e b l o c k d i a g r a m o f t h i s p a r t .  

F i g u r e 1 . 2 : R e c o r d i n g c h a i n b l o c k d i a g r a m : t h e n e w b l o c k s a r e a d d e d u p o n t h e  

p r e v i o u s a r c h i t e c t u r e . T h e r e a r e u s e d t o e n h a n c e t h e p r e v i o u s s y s t e m a n d t o a v o i d  

a c o m p l e t e r e d e n i t i o n o f t h e s y s t e m . A s p r e v i o u s l y e x p l a i n , t h i s n e w s y s t e m c a n b e  

e n h a n c e d e a s i l y .  

1 . 4 . 4 I n t e l l i g e n t C a m e r a  

O n c e t h e p r e v i o u s s t e p i m p l e m e n t e d , t h e n e x t s t e p i s t o t r i g g e r t h o s e e v e n t s w h e n a  

m o t i o n i s d e t e c t e d . T h e r e f o r e , t h e i m p l e m e n t a t i o n o f a n e v e n t d e t e c t i o n a l g o r i t h m i s  

d o n e d u r i n g t h i s p h a s e . T h i s p a r t i s t h e c o r e o f t h i s p r o j e c t , a s t h e p r e v i o u s s t e p s a r e  

p r e p a r i n g s t e p s a n d f o l l o w i n g s t e p s a r e o p t i m i z a t i o n s a n d f e a t u r e a d d i t i o n s . P l e a s e ,  

s e e F i g u r e 1 . 3 ( o n p a g e 6 ) t o g e t t h e b l o c k d i a g r a m o f t h i s p a r t .  

F i g u r e 1 . 3 : I n t e l l i g e n t v i d e o c a m e r a b l o c k d i a g r a m : u p o n t h e p r e v i o u s i m p l e m e n t a -  

t i o n a r e a d d e d t h e b l o c k s o f t h e a l g o r i t h m .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 23/110

1 . 4 G o a l s   7 

1 . 4 . 5 O p t i m i z e d I n t e l l i g e n t C a m e r a  

T h i s s t e p i s f o r a d d i n g a n i m p o r t a n t f e a t u r e c o n s i d e r i n g t h e s t o r a g e s p a c e . I n  

f a c t , i m p l e m e n t i n g a v i d e o c o m p r e s s i o n a l g o r i t h m t o i m p r o v e t h e s t o r a g e i s h i g h l y  

d e s i r a b l e . I t a d d s c o m p l e x i t y t o t h e p r o j e c t d e s i g n , b u t a l s o r e d u c e s t h e d i s k s p a c e  

u s a g e o n t h e S D - C a r d a n d t h e r e f o r e t h e s t o r a g e c o s t s o f t h e p r o p o s e d s o l u t i o n . P l e a s e  

r e f e r t o F i g u r e 1 . 4 ( o n p a g e 7 ) t o g e t t h e b l o c k d i a g r a m o f t h i s p a r t .  

F i g u r e 1 . 4 : O p t i m i z e d i n t e l l i g e n t v i d e o c a m e r a b l o c k d i a g r a m : a f t e r a d d i n g t h e r s t  

a l g o r i t h m , a s e c o n d o n e i s t o b e i m p l e m e n t e d , c o n c e r n i n g t h e v i d e o c o m p r e s s i o n t o  

s a v e m o r e s p a c e .  

1 . 4 . 6 C o m p l e t e I n t e l l i g e n t I P C a m e r a  

T h i s s t e p m a i n l y c o n s i s t s i n t e s t i n g a n d v a l i d a t i n g t h e c o m p l e t e s y s t e m . I n f a c t , t h e  

c o m p l e t e c h a i n o f e x e c u t i o n i s t o b e i m p l e m e n t e d t o v e r i f y t h a t a l l c o m p o n e n t s o f  

t h e s y s t e m w o r k a n d c o m m u n i c a t e t o g e t h e r a s p l a n n e d . P l e a s e , s e e F i g u r e 1 . 5 o n  

p a g e 7 t o g e t t h e b l o c k d i a g r a m o f t h i s p a r t .  

F i g u r e 1 . 5 : G l o b a l b l o c k d i a g r a m o f t h e p r o j e c t : a l l b l o c k s a r e a d d e d t o b u i l d u p t h e  

f u l l s y s t e m t o a n s w e r t h e h y p o t h e s i s . T h e r e a r e a l s o s o m e e x t e r n a l e v e n t t o p e r f o r m .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 24/110

8  1 . I n t r o d u c t i o n  

1 . 5 T a s k s  

T h i s s e c t i o n d e s c r i b e s a l l t h e r e q u i r e d t a s k s t o i m p l e m e n t t h e p r e v i o u s s t e p - b y - s t e p  

p r e s e n t a t i o n o f t h e p r o j e c t . T h e f o l l o w i n g d e s c r i b e d t a s k s d o n o t f o l l o w t h e p r e v i o u s  

o r d e r , a s t h e i m p l e m e n t a t i o n o f c e r t a i n t a s k s i s m o r e c r i t i c a l f o r t h e s t e p - b y - s t e p  

i m p l e m e n t a t i o n . F i g u r e 2 , p a g e 8 8 , p r e s e n t s t h e G A N T T d i a g r a m o f t h i s p r o j e c t ,  

u s i n g t h e f o l l o w i n g t a s k s t o p l a n t h e p r o j e c t s c h e d u l e .  

1 . 5 . 1 C a p t u r e i m a g e w i t h t h e c a m e r a s e n s o r  

T h i s p a r t i s e s s e n t i a l a s i t i s t h e r s t s t e p o f t h e g l o b a l p r o c e s s . I t s i m p l y c o n s i s t s  

o f a c q u i r i n g t h e i m a g e w i t h t h e c a m e r a s e n s o r a n d m a d e i t a v a i l a b l e t o t h e r e s t o f  

t h e s y s t e m .  

S t u d y  

T h e a i m o f t h i s t a s k i s t o u n d e r s t a n d h o w t h e c a m e r a s e n s o r a c q u i r e s a n d s e n d s  

d a t a t h r o u g h i t s i n p u t s a n d o u t p u t s .  

I m p l e m e n t a t i o n  

T h e a i m i s t o i m p l e m e n t t h e d a t a a c q u i s i t i o n f r o m t h e s e n s o r .  

T e s t  

T h e a i m i s t o v e r i f y t h a t t h e i m p l e m e n t a t i o n i s w o r k i n g a c c o r d i n g t o t h e r e q u i r e -  

m e n t s ( d e t a i l e d i n C h a p t e r 3 ) t o d e t e c t p o t e n t i a l p r o b l e m s a n d c o r r e c t t h e m .  

1 . 5 . 2 D i s p l a y i m a g e o n a s c r e e n  

T h i s p a r t i s a f e a t u r e a n d a v a l i d a t i o n t e s t f o r t h e i m p l e m e n t a t i o n . I n f a c t , i t  

a l l o w s t h e u s e r t o s e e w h a t i s c u r r e n t l y b e i n g c a p t u r e d b y t h e c a m e r a s e n s o r .  

C h o i c e o f t h e d i s p l a y  

N o w a d a y s , i t e x i s t s s e v e r a l w a y t o d i s p l a y o n a g i v e n s c r e e n ( V G A , L C D , e t c . ) .  

T h e r e f o r e , t h e s t u d y a n d s e l e c t i o n o f o n e o f t h o s e t y p e s h a s t o b e d o n e f o r t h e  

i m p l e m e n t a t i o n .  

I m p l e m e n t a t i o n  

T h e a i m i s t o i m p l e m e n t t h e c o n t r o l l e r f o r t h e s e l e c t e d d i s p l a y s c r e e n t y p e .  

T e s t  

T h e a i m i s t o v e r i f y t h a t t h e i m p l e m e n t a t i o n i s w o r k i n g a c c o r d i n g t o t h e r e q u i r e -  

m e n t s ( d e t a i l e d i n C h a p t e r 3 ) t o d e t e c t p o t e n t i a l p r o b l e m s a n d c o r r e c t t h e m .  

1 . 5 . 3 R e c o r d c a p t u r e d v i d e o  

T h i s p a r t c o n s i s t o f r e c o r d i n g t h e v i d e o , t o m a k e i t a v a i l a b l e f o r c o m p r e s s i o n a n d  

s t o r a g e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 25/110

1 . 5 T a s k s   9 

S t u d y  

T h e s t u d y c o n s i s t s i n u n d e r s t a n d i n g h o w t o r e c o r d a v i d e o f r o m t h e s e n s o r .  

I m p l e m e n t a t i o n  

T h e a i m i s t o i m p l e m e n t t h e r e c o r d i n g f u n c t i o n a l i t y i n t h e s y s t e m b y s t o r i n g  

s e v e r a l f r a m e s o n t h e m e m o r y .  

T e s t  

T h e a i m i s t o v e r i f y t h a t t h e i m p l e m e n t a t i o n i s w o r k i n g a c c o r d i n g t o t h e r e q u i r e -  

m e n t s ( d e t a i l e d i n C h a p t e r 3 ) t o d e t e c t p o t e n t i a l p r o b l e m s a n d c o r r e c t t h e m .  

1 . 5 . 4 S t o r e r e c o r d e d v i d e o  

T h i s p a r t i s o n e o f t h e m a j o r g o a l o f t h e p r o j e c t : t h e s t o r a g e o f d a t a , p r e v i o u s l y  

r e c o r d e d . A l s o , t h e r e d u c t i o n o f t h e m e d i u m s i z e ( m e m o r y c a r d i n s t e a d o f t a p e ) i s  

a n o t h e r w a y t o r e d u c e t h e s i z e o f t h e s t o r a g e .  

S t o r a g e c h o i c e : S R A M ? S D R A M ? S D - C a r d ? O t h e r ?  

N o w a d a y s , t h e r e i s a l o t o f a v a i l a b l e m e m o r y t y p e s . T h e a i m o f t h i s t a s k i s t o  

s t u d y a n s s e l e c t t h e o n e t h a t w i l l f u l l o u r r e q u i r e m e n t s .  

I m p l e m e n t a t i o n  

T h e a i m i s t o i m p l e m e n t t h e s t o r a g e f u n c t i o n a l i t y i n t h e s y s t e m . I t t h e r e f o r e  

r e q u i r e s t o g e t a c o n t r o l l e r t o a c c e s s t h e s e l e c t e d m e m o r y c a r d a n d c r e a t e t h e b l o c k s  

t o u s e t h i s c o n t r o l l e r .  

T e s t  

T h e a i m i s t o v e r i f y t h a t t h e i m p l e m e n t a t i o n i s w o r k i n g a c c o r d i n g t o t h e r e q u i r e -  

m e n t s ( d e t a i l e d i n C h a p t e r 3 ) t o d e t e c t p o t e n t i a l p r o b l e m s a n d c o r r e c t t h e m .  

1 . 5 . 5 A c c e s s r e c o r d e d v i d e o  

T h e a i m o f t h i s t a s k i s t o b u i l d a m e c h a n i s m f o r p r o v i d i n g t h e u s e r w i t h a c o n v e -  

n i e n t a c c e s s t o t h e d a t a s t o r e d .  

S t u d y  

T h e a i m i s t o s t u d y h o w t o m a k e a d a t a s t o r e d a v a i l a b l e o n a n E t h e r n e t n e t w o r k .  

I m p l e m e n t a t i o n o f a s o f t c o r e p r o c e s s o r  

A s t h e E t h e r n e t p r o t o c o l i s e a s i e r t o i m p l e m e n t a t a h i g h e r a b s t r a c t i o n l e v e l , i m -  

p l e m e n t i n g a s o f t c o r e p r o c e s s o r o n t h e   F P G A   h e l p s u s i n g t h e E t h e r n e t c o n t r o l l e r o f  

t h e s y s t e m . A s o f t m i c r o p r o c e s s o r ( a l s o c a l l e d s o f t c o r e m i c r o p r o c e s s o r o r a s o f t p r o -  

c e s s o r ) i s a m i c r o p r o c e s s o r c o r e t h a t c a n b e w h o l l y i m p l e m e n t e d u s i n g l o g i c s y n t h e s i s .  

I t c a n b e i m p l e m e n t e d v i a d i e r e n t s e m i c o n d u c t o r d e v i c e s c o n t a i n i n g p r o g r a m m a b l e  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 26/110

1 0  1 . I n t r o d u c t i o n  

l o g i c ( e . g . ,   F P G A   , C P L D ) . A m o r e d e t a i l e d d e n i t i o n o f a s o f t c o r e p r o c e s s o r i s  

g i v e n i n C h a p t e r 3 .  

I m p l e m e n t a t i o n o f a w e b - s e r v e r  

O n c e t h e s o f t c o r e p r o c e s s o r i m p l e m e n t e d , t h e w e b - s e r v e r e x e c u t i n g o n i t m a k e s  

t h e d a t a a v a i l a b l e o n t h e n e t w o r k .  

T e s t  

T h e a i m i s t o v e r i f y t h a t t h e i m p l e m e n t a t i o n i s w o r k i n g a c c o r d i n g t o t h e r e q u i r e -  

m e n t s ( d e t a i l e d i n C h a p t e r 3 ) t o d e t e c t p o t e n t i a l p r o b l e m s a n d c o r r e c t t h e m .  

1 . 5 . 6 E v e n t d e t e c t i o n a l g o r i t h m  

T h e a i m i s t o r e c o r d o n l y u s e f u l d a t a . T h e r e f o r e , t h e i m p l e m e n t a t i o n o f a n e v e n t  

d e t e c t i o n a l g o r i t h m i s o n e o f t h e m a i n g o a l o f t h i s p r o j e c t .  

S t u d y  

A s i t e x i s t s v a r i o u s e v e n t d e t e c t i o n a l g o r i t h m s , t h e g o a l o f t h i s t a s k i s t o s t u d y  

t h e m a n d s e l e c t o n e t o i m p l e m e n t .  

C a l c u l a t i o n o f m e t r i c s  

O n c e t h e a l g o r i t h m s e l e c t e d , i t h a s t o b e p r o l e d ( t o g e t t h e f u l l u n d e r s t a n d i n g o f  

t h e a l g o r i t h m ) i n o r d e r t o b e i m p l e m e n t e d i t i n t h e b e s t w a y .  

H a r d w a r e / S o f t w a r e c o - d e s i g n  

W i t h t h e p r e v i o u s t a s k d o n e , t h e a l g o r i t h m i s p a r t i t i o n e d b e t w e e n h a r d w a r e a n d  

s o f t w a r e p a r t s t o h a v e t h e b e s t i m p l e m e n t a t i o n .  

I m p l e m e n t a t i o n  

T h e a i m i s t o i m p l e m e n t t h e a l g o r i t h m a c c o r d i n g t o t h e p r e v i o u s r e s u l t s . T h a t  

m e a n s , u s e t h e d r a f t c - c o d e a l g o r i t h m a n d a d a p t i t t o t h e s o f t c o r e p r o c e s s o r .  

O p t i m i z a t i o n  

O n c e t h e a l g o r i t h m i m p l e m e n t e d , i t m a y r e q u i r e s o p t i m i z a t i o n o f s o m e p a r t s , s u c h  

a s b o t t l e n e c k s , t o h a v e a f a s t e r i m p l e m e n t a t i o n . T h e m a i n p o i n t o f t h i s o p t i m i z a -  

t i o n i s t h e e x e c u t i o n t i m e . O t h e r o p t i m i z a t i o n , s u c h a s p o w e r , a r e a , e t c . , a r e n o t  

c o n s i d e r e d .  

T e s t  

T h e a i m i s t o v e r i f y t h a t t h e i m p l e m e n t a t i o n i s w o r k i n g a c c o r d i n g t o t h e r e q u i r e -  

m e n t s ( d e t a i l e d i n C h a p t e r 3 ) t o d e t e c t p o t e n t i a l p r o b l e m s a n d c o r r e c t t h e m .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 27/110

1 . 6 S t r u c t u r e o f t h e d o c u m e n t   1 1 

1 . 5 . 7 V i d e o c o m p r e s s i o n  

W h e n t h e v i d e o i s r e c o r d e d a n d s t o r e d , i t w o u l d b e b e n e c i a l t o o p t i m i z e t h e s p a c e  

u s e d b y i t . T o d o s o , a v i d e o c o m p r e s s i o n a l g o r i t h m c a n b e u s e d . I t w i l l e n h a n c e  

o n e o f t h e p r o j e c t ' s g o a l s : s a v i n g s p a c e f o r d a t a s t o r a g e .  

S t u d y  

A s i t e x i s t s v a r i o u s v i d e o c o m p r e s s i o n a l g o r i t h m s , w e h a v e t o s t u d y a n d s e l e c t o n e  

o f t h e m . I n f a c t s , a s e x p l a i n e d i n C h a p t e r 2 , d e p e n d i n g o n t h e r e q u i r e m e n t s o f t h e  

n a l v i d e o , t h e r a n g e o f p o s s i b l e a l g o r i t h m s i s q u i t e w i d e .  

C a l c u l a t i o n o f m e t r i c s  

O n c e t h e a l g o r i t h m s e l e c t e d , i t h a s t o b e p r o l e d i n o r d e r t o b e i m p l e m e n t e d i t i n  

t h e b e s t w a y .  

H a r d w a r e / S o f t w a r e C o - D e s i g n  

W i t h t h e p r e v i o u s t a s k d o n e , t h e a l g o r i t h m i s p a r t i t i o n e d b e t w e e n h a r d w a r e a n d  

s o f t w a r e p a r t s t o h a v e t h e b e s t i m p l e m e n t a t i o n .  

I m p l e m e n t a t i o n  

T h e a i m i s t o i m p l e m e n t t h e a l g o r i t h m a c c o r d i n g t o t h e p r e v i o u s r e s u l t s .  

T e s t  

T h e a i m i s t o v e r i f y t h a t t h e i m p l e m e n t a t i o n i s w o r k i n g a c c o r d i n g t o t h e r e q u i r e -  

m e n t s ( d e t a i l e d i n C h a p t e r 3 ) t o d e t e c t p o t e n t i a l p r o b l e m s a n d c o r r e c t t h e m .  

1 . 6 S t r u c t u r e o f t h e d o c u m e n t  

T h e r e s t o f t h e r e p o r t i s o r g a n i s e d a s f o l l o w s :   C h a p t e r 2   i s a n o v e r v i e w o f t h e  

p r o j e c t u s i n g a m e t a - m o d e l .   C h a p t e r 3   i s t h e s y s t e m a n a l y s i s a n d d e s i g n , w h i l e  

t h e  C h a p t e r 4   d e t a i l s t h e a n a l y s i s a n d d e s i g n o f t h e m o t i o n d e t e c t i o n a l g o r i t h m .  

C h a p t e r 5   d e a l s w i t h t h e a c t u a l i m p l e m e n t a t i o n b y d e s c r i b i n g e a c h s t e p .   C h a p t e r  

6  i s a b o u t t h e t e s t i n g a n d g i v e t h e m a i n r e s u l t s o f o u r e x p e r i m e n t s . F i n a l l y t h e  

C h a p t e r 7   c o n c l u d e t h i s r e p o r t a n d p r o p o s e s e v e r a l f u t u r e w o r k .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 28/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 29/110

Chapter2D e s i g n M o d e l s    

T h i s c h a p t e r d e s c r i b e s h o w t h e u s e o f d e s i g n m o d e l s c a n f a c i l i t a t e t h e p r o c e s s o f  

f u l l l i n g t h e g o a l s o f t h e p r o j e c t . F i r s t l y t h e  A3

p a r a d i g m i s e x p l a i n e d . T h e n , t h e  

R u g b y M e t a - M o d e l i s i n t r o d u c e d . F i n a l l y , t h e d e t a i l s o f t h e a c t u a l d e s c r i p t i o n o f t h e  

p r o j e c t u s i n g t h e R u g b y M e t a - M o d e l a n d  A3

p a r a d i g m a r e p r o v i d e d . B o t h o f t h e s e  

m o d e l s a r e u s e d b e c a u s e t h e y a r e c o m p l e m e n t a r y f o r a c o m p l e t e i m p l e m e n t a t i o n , a s  

e x p l a i n e d i n t h i s c h a p t e r .  

2 . 1 D e s c r i p t i o n o f t h e   A3

p a r a d i g m  

T h e a c r o n y m   A3s t a n d s f o r A p p l i c a t i o n - A l g o r i t h m - A r c h i t e c t u r e ( a s e x p l a i n i n  

[ t e a 0 7 ] ) w h i c h c o r r e s p o n d s t o t h e t h r e e f u n d a m e n t a l d o m a i n s o f t h e h a r d w a r e d e -  

s i g n p r o c e s s . T h e  A3

m o d e l i s u s e d t o d e s c r i b e t h e d e s i g n o w , i t s b a s i c s t a g e s a n d  

t r a n s i t i o n s b e t w e e n t h e m . F i g u r e 2 . 1 ( o n p a g e 1 4 ) p r e s e n t s t h e m o d e l w i t h g e n e r i c  

r e f e r e n c e s i n e a c h o f t h e t h r e e d o m a i n s . T h e t h r e e d o m a i n s a n d c o r r e s p o n d i n g d e s i g n  

o w s t a g e s a r e a s f o l l o w s :  

• A p p l i c a t i o n d o m a i n : c h a r a c t e r i z e s t h e s y s t e m f r o m a p u r e l y b e h a v i o u r a l p o i n t  

o f v i e w . S y s t e m a n a l y s i s i n t h i s d o m a i n c a n b e e x p r e s s e d b y t h e p h r a s e :  W h a t  

a r e t h e s y s t e m ' s f u n c t i o n a l i t i e s , p r o p e r t i e s a n d r e q u i r e m e n t s ?   . I n t h e d e s i g n  

p r o c e s s t h i s c o r r e s p o n d s t o a h i g h - l e v e l f u n c t i o n a l s p e c i c a t i o n o f t h e s y s t e m  

a s w e l l a s e s t a b l i s h i n g d e s i g n c o n s t r a i n t s .  

A t r a n s i t i o n t o t h e n e x t d o m a i n i s a c h i e v e d b y d e t a i l e d f u n c t i o n a l a n a l y s i s  

l e a d i n g t o s e l e c t i o n o f s p e c i c a l g o r i t h m s .  

• A l g o r i t h m d o m a i n : c o n c e r n s a l g o r i t h m s u s e d t o r e a l i z e s p e c i c f u n c t i o n a l i -  

t i e s o f t h e s y s t e m . S y s t e m a n a l y s i s i n t h i s d o m a i n c a n b e e x p r e s s e d b y t h e  

p h r a s e :  H o w a r e s y s t e m f u n c t i o n a l i t i e s r e a l i z e d ?   . A s m o s t o f t h e t i m e n u -  

m e r o u s a l g o r i t h m s a r e e x p l o i t e d i n a s i n g l e a p p l i c a t i o n , s y s t e m d e s i g n t a s k s i n  

t h e a l g o r i t h m i c d o m a i n a r e u s u a l l y r e l a t e d t o t h e e v a l u a t i o n o f m u l t i p l e a l g o -  

r i t h m s . T h i s c a n b e d o n e e i t h e r b y a n a l y s i s o f t h e o r e t i c a l m o d e l s o r p e r f o r m i n g  

n u m e r i c a l s i m u l a t i o n s . S u c h e v a l u a t i o n l e a d s t o t h e v e r i c a t i o n o f a l g o r i t h m  

c o r r e c t n e s s a s w e l l a s o b t a i n i n g m e a s u r e s o f c o m p l e x i t y , r o b u s t n e s s a n d v a r i o u s  

o t h e r m e t r i c s . T h i s e v e n t u a l l y l e a d s t o s e l e c t a s e t o f a l g o r i t h m s m o s t s u i t a b l e  

f o r r e a l i z i n g t h e a p p l i c a t i o n .  

1 3 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 30/110

1 4  2 . D e s i g n M o d e l s  

F i g u r e 2 . 1 :   A3p a r a d i g m d e s i g n o w : t h e r s t s t e p i s t o d e n e t h e p u r p o s e o f t h e  

a p p l i c a t i o n ( 1 ) . T h e s e c o n d o n e i s t o e x p l o r e a n d s i m u l a t e t h e a l g o r i t h m s t h a t  

f u l l t h e r e q u i r e m e n t s o f t h i s a p p l i c a t i o n ( 2 ) . T h e n , t h e t h i r d s t e p i s t o s e l e c t t h e  

b e s t a r c h i t e c t u r e t o i m p l e m e n t t h o s e a l g o r i t h m s ( 3 ) . T h e i m p l e m e n t a t i o n o n a n  

a r c h i t e c t u r e c a n l e a d t o m o d i c a t i o n t o t h e a l g o r i t h m ( 3 ' ) . A n d l a s t b u t n o t l e a s t ,  

t h e f o u r t h s t e p i s t o c h e c k t h a t t h e a c t u a l i m p l e m e n t a t i o n f u l l t h e r e q u i r e m e n t s o f  

t h e a p p l i c a t i o n ( 4 ) .  

A t r a n s i t i o n t o t h e t h i r d d e s i g n d o m a i n c o r r e s p o n d s t o t h e p r o c e s s o f D e s i g n  

S p a c e E x p l o r a t i o n ( D S E ) o f w h i c h p u r p o s e i s t o m a p t h e s e l e c t e d a l g o r i t h m s  

o n t o a n h a r d w a r e o r s o f t w a r e a r c h i t e c t u r e w h i c h m a t c h e s m o s t a p p l i c a t i o n r e -  

q u i r e m e n t s a n d c o n s t r a i n t s .  

• A r c h i t e c t u r e d o m a i n : C h a r a c t e r i z e s t y p e , n u m b e r a n d o r g a n i z a t i o n o f P r o -  

c e s s i n g E l e m e n t s ( P E ) u s e d f o r s y s t e m i m p l e m e n t a t i o n a s w e l l a s d e t e r m i n e s  

t h e s c h e m e o f m a p p i n g s e l e c t e d a l g o r i t h m s t o r e s p e c t i v e P E s . S y s t e m a n a l y -  

s i s i n t h i s d o m a i n c a n b e e x p r e s s e d b y t h e p h r a s e :  H o w a r e t h e a l g o r i t h m s  

i m p l e m e n t e d , w h a t h a r d w a r e / s o f t w a r e r e s o u r c e s a r e u s e d a n d h o w a r e v a r i o u s  

h a r d w a r e / s o f t w a r e m o d u l e s c o o p e r a t i n g ?   . T h e a r c h i t e c t u r e d o m a i n i s s t r o n g l y  

r e l a t e d t o t h e n a l s t a g e o f t h e d e s i g n p r o c e s s , n a m e l y s y s t e m i m p l e m e n t a t i o n .  

I n t h i s s e c t i o n o f t h e d e s i g n o w , a l g o r i t h m s s e l e c t e d f o r r e a l i z a t i o n o f s y s t e m  

f u n c t i o n a l i t i e s a r e m a p p e d t o s p e c i c h a r d w a r e / s o f t w a r e s t r u c t u r e s w i t h c o n -  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 31/110

2 . 2 D e s c r i p t i o n o f t h e R u g b y M e t a - M o d e l   1 5 

s i d e r a t i o n o f r e q u i r e m e n t s a n d c o n s t r a i n t s f r o m t h e a p p l i c a t i o n d o m a i n . B o t h  

a r c h i t e c t u r e s e l e c t i o n a n d a l g o r i t h m m a p p i n g a r e p e r f o r m e d w i t h c o n s i d e r a t i o n  

o f v a r i o u s m e t r i c s s u c h a s p e r f o r m a n c e , h a r d w a r e / s o f t w a r e c o m p l e x i t y , c o d e  

s i z e , c o s t , p o w e r c o n s u m p t i o n a n d d e v e l o p m e n t t i m e . T h e D S E p r o c e s s c a n  

a l s o i n v o l v e a f e e d b a c k p a t h t o t h e a l g o r i t h m d o m a i n l e a d i n g t o r e - s p e c i f y i n g  

t h e s e t o f a l g o r i t h m s u s e d f o r r e a l i z i n g s y s t e m f u n c t i o n a l i t i e s . S u c h s i t u a t i o n  

c a n o c c u r w h e n t h e a l g o r i t h m s s e l e c t e d o r i g i n a l l y a r e e i t h e r i n f e a s i b l e o r i n e -  

c i e n t t o i m p l e m e n t o n a n y a v a i l a b l e a r c h i t e c t u r e r e s u l t i n g i n a c o n i c t b e t w e e n  

s y s t e m r e q u i r e m e n t s a n d a v a i l a b i l i t y o f d e s i g n s o l u t i o n s .  

S u c c e s s f u l s y s t e m i m p l e m e n t a t i o n e n a b l e s t o c h a r a c t e r i z e t h e a p p l i c a t i o n i n t e r m s  

o f b o t h q u a l i t a t i v e a n d q u a n t i t a t i v e m e t r i c s s u c h a s a p p l i c a t i o n f e a s i b i l i t y , a c h i e v a b l e  

p e r f o r m a n c e , h a r d w a r e r e q u i r e m e n t s a n d c o s t . I n o r d e r t o a c h i e v e t h i s , a c o m p l e t e  

s y s t e m d e s i g n o w i s f o l l o w e d a s d e s c r i b e d i n t h e f o l l o w i n g s e c t i o n .  [ P o r 0 7 ]  

T h e A3

d e s i g n o w s u m m a r y :  

1 . S e l e c t t h e a l g o r i t h m ( s ) f o r t h e a p p l i c a t i o n  

2 . S i m u l a t e t h e a l g o r i t h m ( s )  

3 . S e l e c t t h e a r c h i t e c t u r e t o i m p l e m e n t t h e a l g o r i t h m ( s )  

4 . M o d e l t h e a l g o r i t h m ( s ) o n t h e a r c h i t e c t u r e  

5 . D e s i g n S p a c e E x p l o r a t i o n  

6 . H W / S W C o - d e s i g n  

7 . C o m p a r e r e s u l t s o f t h e i m p l e m e n t a t i o n t o t h e r e q u i r e m e n t s  

A s t h e   A3p a r a d i g m i s v e r y g e n e r i c , i t i s c o m p l e m e n t e d b y t h e u s e o f a m o r e  

d e t a i l e d a n d p r e c i s e d e s i g n m o d e l , t h e R u g b y M e t a - M o d e l . I n f a c t , a s e x p l a i n i n  

t h e n e x t s e c t i o n , t h e R u g b y M e t a - M o d e l i s c l o s e r t o t h e i m p l e m e n t a t i o n a n d i s v e r y  

d e s i g n e d f o r h a r d w a r e a n d s o f t w a r e c o - d e s i g n . M o r e o v e r , t h e   A3i s a p a r a d i g m ,  

w h i c h m e a n s m o s t l y a w a y o f t h i n k i n g o r d e s i g n i n g a s y s t e m . T h e R u g b y i s m o r e a n  

i m p l e m e n t a t i o n m o d e l t o f o l l o w f r o m t h e b e g i n n i n g o f t h e p r o j e c t t o i t s e n d .  

2 . 2 D e s c r i p t i o n o f t h e R u g b y M e t a - M o d e l  

M o d e l s l i k e t h e Y - c h a r t [ K G 8 3 ] & [ G a j 8 8 ] a n d t h e R u g b y M e t a - M o d e l [ H J K 9 9 ]  

m a k e i t p o s s i b l e t o r e p r e s e n t t h e a b s t r a c t i o n l e v e l s a n d d o m a i n s o f t h e d e s i g n m o d e l  

u n d e r c o n s i d e r a t i o n a n d t h e t r a n s i t i o n s b e t w e e n t h e a b s t r a c t i o n l e v e l s w h e n m o v i n g  

f r o m o n e m o d e l t o t h e n e x t .  

T h e Y - c h a r t m o d e l h a s t h r e e d o m a i n s : S t r u c t u r a l , B e h a v i o u r a l a n d P h y s i c a l .  

H o w e v e r , i t h a s n o e x p l i c i t r e p r e s e n t a t i o n f o r t i m e , d a t a a n d c o m m u n i c a t i o n . E s -  

p e c i a l l y a r e p r e s e n t a t i o n f o r c o m m u n i c a t i o n i s n e c e s s a r y i n h e t e r o g e n e o u s s y s t e m s  

h a v i n g s e v e r a l p r o c e s s i n g e l e m e n t s l i k e f o r e x a m p l e a G P P a n d a n A S I C c o m m u n i -  

c a t i n g . T h e R u g b y M e t a - M o d e l ( a s d e s c r i b e d i n [ H J K 0 0 ] ) o n t h e o t h e r h a n d h a s  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 32/110

1 6  2 . D e s i g n M o d e l s  

( a ) T h e R u g b y m e t a m o d e l w i t h t h e f o u r  

d o m a i n s : C o m m u n i c a t i o n , D a t a , C o m p u t a -  

t i o n a n d T i m e . T h e s y s t e m s t a r t w i t h a n  

i d e a a n d e n d s w i t h a p h y s i c a l s y s t e m . T h e  

d e v e l o p m e n t t i m e p r o g r e s s e s f r o m r i g h t t o  

l e f t  

( b ) E l a b o r a t i o n o f t h e f o u r d o m a i n s o f t h e  

R u g b y m e t a m o d e l . T h e l e v e l o f a b s t r a c t i o n d e -  

c r e a s e a n d t h e d e v e l o p m e n t t i m e i n c r e a s e f r o m  

l e f t t o r i g h t . A t s o m e s t a g e i n t h e d e v e l o p m e n t  

o f t h e s y s t e m , a d e c i s i o n a b o u t t h e H a r d w a r e &  

S o f t w a r e p a r t i t i o n i n g i s m a d e . F r o m t h a t p o i n t ,  

t h e d e v e l o p m e n t o f t h e s y s t e m i s s p l i t i n t o t w o .  

F i g u r e 2 . 2 : T h e R u g b y m e t a m o d e l a n d e l a b o r a t i o n o f t h e f o u r d o m a i n s . A s a n  

e x a m p l e t h e s p e c i c a t i o n m o d e l o f t h e m e t h o d o l o g y o f a s y s t e m d e s i g n l a n g u a g e i s  

s h o w n i n t h e R u g b y m e t a m o d e l t o g e t h e r w i t h t h e l e v e l o f a b s t r a c t i o n i n t h e f o u r  

d o m a i n s [ H J K 0 0 ] .  

e x p l i c i t r e p r e s e n t a t i o n s f o r b o t h t i m e a n d c o m m u n i c a t i o n , s i n c e i t h a s f o u r d o m a i n s ,  

n a m e l y C o m m u n i c a t i o n , D a t a , C o m p u t a t i o n a n d T i m e . I t h a s t h e r e f o r e b e e n c h o -  

s e n t o u t i l i z e t h e e v a l u a t i o n p r o p e r t i e s o f t h e R u g b y m e t a m o d e l t o v i s u a l i z e t h e  

a b s t r a c t i o n l e v e l s o f t h e d i e r e n t m o d e l s i n t h e d e s i g n . T h e R u g b y M e t a M o d e l i s  

s h o w n i n F i g u r e 2 . 2 ( a ) ( o n p a g e 1 6 ) a n d a n e l a b o r a t i o n o f t h e f o u r d o m a i n s i s s h o w n  

i n F i g u r e 2 . 2 ( b ) ( o n p a g e 1 6 ) . A s a n e x a m p l e t h e s p e c i c a t i o n m o d e l o f t h e m e t h o d -  

o l o g y o f a s y s t e m d e s i g n l a n g u a g e h a s b e e n r e p r e s e n t e d b y t h e R u g b y M e t a - M o d e l .  

T h e s p e c i c a t i o n m o d e l i s a t a n e a r l y s t a g e o f t h e d e s i g n p r o c e s s , h e n c e i t i s o n a  

h i g h l e v e l o f a b s t r a c t i o n . A s a s y s t e m h a s a n u m b e r o f a b s t r a c t i o n l e v e l s , F i g u r e 2 . 3 ,  

o n p a g e 1 7 s h o w s t h e d i e r e n t t y p i c a l a b s t r a c t i o n l a y e r s o f a g e n e r i c s y s t e m . T h o s e  

a b s t r a c t i o n l e v e l s a r e u s e d i n t h e R u g b y M e t a M o d e l .  

H a v i n g d e s c r i b e d t h e p r o b l e m s o f d e s i g n i n g a s y s t e m f o r a g i v e n a p p l i c a t i o n a n d  

t h e m e a n s t o s o l v e t h e p r o b l e m i n a s t r u c t u r e d m a n n e r , t h e l a s t s e c t i o n o f t h i s  

c h a p t e r i n t r o d u c e s h o w t h o s e t e r m s a r e u s e d i n t h i s p r o j e c t .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 33/110

2 . 3 T h i s p r o j e c t d e s c r i b e d u s i n g t h e d e s i g n m o d e l s   1 7 

F i g u r e 2 . 3 : T h e d i e r e n t t y p i c a l a b s t r a c t i o n l e v e l s o f a g e n e r i c s y s t e m . I t g o e s f r o m  

t h e t o p , w i t h t h e h i g h e s t a b s t r a c t i o n l a y e r , t o t h e b o t t o m w i t h t h e l o w e s t [ D ö m 0 3 ] .  

2 . 3 T h i s p r o j e c t d e s c r i b e d u s i n g t h e d e s i g n m o d e l s  

I n t h i s s e c t i o n , t h e  A3

p a r a d i g m i s a p p l i e d t o t h i s p r o j e c t a n d t h e n t h e R u g b y  

M e t a - M o d e l i s a p p l i e d . F o r e a c h o f t h o s e t w o d e s i g n m o d e l s , e a c h d o m a i n i s d e t a i l e d .  

2 . 3 . 1 T h e  A3

a p p l i e d t o o u r p r o j e c t  

T h i s s e c t i o n i s t h e a p p l i c a t i o n o f t h e s e c t i o n 2 . 1 t o t h i s p r o j e c t . F o r t h e  A3

p a r a d i g m , F i g u r e 2 . 4 ( o n p a g e 1 8 ) i s t h e s p e c i c o w o f t h e   A3p a r a d i g m a p p l i e d t o  

t h i s p r o j e c t . T h e a p p l i c a t i o n o f e a c h d o m a i n i s g i v e n i n t h e f o l l o w i n g p a r a g r a p h s .  

A p p l i c a t i o n  

T h e g o a l i s t o m a k e a n i n t e l l i g e n t I P s u r v e i l l a n c e v i d e o c a m e r a . I t i m p l i e s t h a t  

t h e s y s t e m m u s t b e s e c u r e a n d a v a i l a b l e a l l t h e t i m e f o r t h e s u r v e i l l a n c e . T h e r e i s a n  

I P p a r t b e c a u s e t h e v i d e o c a m e r a i s c o n n e c t e d t o a n E t h e r n e t n e t w o r k ( t h r o u g h  

t h e E t h e r n e t a d a p t e r ) , u s i n g t h e I P p r o t o c o l . T h i s f e a t u r e p r o v i d e s t h e o w n e r o f t h e  

s y s t e m a f a s t a n d c o n v e n i e n t a c c e s s t o d a t a . T h e o t h e r m a i n p a r t i s t h e i n t e l l i g e n c e .  

A s p r e v i o u s l y e x p l a i n e d , o n l y u s e f u l d a t a a r e s t o r e d . T h i s i m p l i e s u s i n g a n i m a g e  

p r o c e s s i n g a l g o r i t h m t o r e c o r d o n l y v i d e o w h e n s o m e t h i n g h a p p e n s . A s a f e a t u r e ,  

w h a t i s b e i n g c a p t u r e d i s a l s o d i s p l a y e d . I t p r o v i d e s t h e v a l i d a t i o n o f t h e r e c o r d i n g  

a n d s t o r a g e p a r t s .  

O n e o f t h e c o n s t r a i n t s t o b e m e t i s t o b e a s m u c h a s p o s s i b l e i n a r e a l - t i m e  

s y s t e m . W h i c h m e a n s t h a t t h e s y s t e m b u i l t i s a r e a l - t i m e s y s t e m , b u t w i t h s o f t  

t i m i n g c o n d i t i o n . A s e c o n d p o i n t i s t o h a v e d a t a s t o r e d d u r i n g t h e p r o c e s s i n t h e  

c o r r e c t f o r m a t t o b e u s e f u l f o r t h e f o l l o w i n g s t e p s o f t h e p r o c e s s ( i . e . i n r a w f r o m t h e  

c a m e r a s e n s o r , i n R G B & g r e y s c a l e d f o r t h e a l g o r i t h m , e t c . ) . A n o t h e r o n e i s t h e  

s e c u r i t y o f t h e s y s t e m . I n f a c t , a s i t i s a s u r v e i l l a n c e s y s t e m , t h e d a t a s t o r e d n e e d t o  

b e s e c u r e d w h e n t h e y a r e w r i t t e n o n t h e n a l m e m o r y b l o c k , a n d o n l y t h e s y s t e m  

s h o u l d b e a l l o w e d t o w r i t e d a t a o n t h e s e l e c t e d s t o r a g e m e d i u m .  

F o r f u r t h e r e x p l a n a t i o n a n d d e t a i l s , p l e a s e r e f e r t o C h a p t e r 3 , o n p a g e 2 3 .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 34/110

1 8  2 . D e s i g n M o d e l s  

F i g u r e 2 . 4 :   A3p a r a d i g m a p p l i e d t o t h i s p r o j e c t : t h e r e i s o n e a p p l i c a t i o n ( i n t e l l i g e n t  

c a m e r a f o r v i d e o s u r v e i l l a n c e ) u s i n g t w o a l g o r i t h m s ( o n e f o r e v e n t d e t e c t i o n a n d o n e  

f o r v i d e o c o m p r e s s i o n ) . F o r e a c h o f t h o s e a l g o r i t h m s , t h e a r c h i t e c t u r e i s b a s e d o n a  

G e n e r a l P u r p o s e P r o c e s s o r ( G P P ) a n d o n a n   F P G A   . T h e G P P i n t h i s p r o j e c t i s a  

s o f t c o r e p r o c e s s o r i m p l e m e n t e d o n t h e   F P G A   . 

A l g o r i t h m  

I n o r d e r t o m e e t o n e o f t h e m a i n f u n c t i o n a l i t i e s o f t h e s y s t e m , t h e i n t e l l i g e n c e  

p a r t , a n i m a g e p r o c e s s i n g a l g o r i t h m i s t o b e i m p l e m e n t e d . I t e x i s t s s e v e r a l a l g o -  

r i t h m s a n d s e v e r a l w a y s t o i m p l e m e n t t h o s e a l g o r i t h m s . T h e m a i n c a t e g o r i e s o f  

e v e n t d e t e c t i o n a l g o r i t h m s a r e m o t i o n d e t e c t i o n , f a c e r e c o g n i t i o n a n d s h a p e r e c o g -  

n i t i o n . A m o t i o n d e t e c t i o n a l g o r i t h m w a s c h o s e n b e c a u s e i t s e e m s t o c o s t l e s s i n  

d e v e l o p m e n t t i m e , i t s c o m p l e x i t y i s r a t h e r s i m p l e a n d m o r e a c c u r a t e f o r t h i s p r o j e c t  

t h a n s h a p e o r f a c e r e c o g n i t i o n a l g o r i t h m s . M o r e o v e r , t h e i m p l e m e n t a t i o n o f t h i s  

a l g o r i t h m i s j u s t t o v e r i f y t h e f e a s i b i l i t y o f t h e p r o p o s a l s o l u t i o n . A l s o , t h e a l g o r i t h m  

i s u s e d t o d e t e c t a n y k i n d o f e v e n t o c c u r r i n g i n t h e m o n i t o r e d r o o m . T h e r e f o r e , f a c e  

r e c o g n i t i o n a n d s h a p e r e c o g n i t i o n a r e t o o s p e c i c t o b e u s e d . T h e m a i n m e t h o d f o r  

m o t i o n d e t e c t i o n i s t o m a k e a b a c k g r o u n d s u b t r a c t i o n m e t h o d o l o g y . T h e m o t i o n  

d e t e c t i o n a l g o r i t h m s a r e p r e s e n t e d i n C h a p t e r 4 ( p a g e 4 3 ) , a l o n g w i t h t h e d e t a i l s o f  

t h e c h o i c e o f a l g o r i t h m .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 35/110

2 . 3 T h i s p r o j e c t d e s c r i b e d u s i n g t h e d e s i g n m o d e l s   1 9 

A n o t h e r f u n c t i o n a l i t y i s t o c o m p r e s s t h e n a l s t o r e d v i d e o t o s a v e m o r e s p a c e .  

T h i s c a n b e d o n e b y i m p l e m e n t i n g a v i d e o c o m p r e s s i o n a l g o r i t h m . A g a i n , t h e r e a r e  

m a n y a l g o r i t h m s a n d i m p l e m e n t a t i o n m e t h o d s t o e x p l o r e . T h e m a i n a l g o r i t h m s a r e  

b a s e d o n d i e r e n t c o n s t r a i n t s o r r e q u i r e m e n t s . T h e r s t r e q u i r e m e n t s i s t h e q u a l i t y  

o f t h e n a l c o m p r e s s e d v i d e o . T h e o t h e r o n e i s t h e d i s k s p a c e u s a g e . I n f a c t , t h o s e  

r e q u i r e m e n t s a r e a n t a g o n i s t i c . T h e r e f o r e , o n e c a n d e c i d e t h a t t h e n a l v i d e o n e e d s  

t o b e t h e s m a l l e s t p o s s i b l e ( i n t e r m s o f d i s k s p a c e u s a g e ) , b u t i t i m p l i e s t h a t t h e  

q u a l i t y h a s t o b e v e r y l o w . B e t w e e n t h o s e t w o e x t r e m a , t h e r e i s a w i d e r a n g e o f  

a l g o r i t h m s t h a t t r y t o t t h e b e s t o p t i m u m s o l u t i o n , t o h a v e t h e b e s t q u a l i t y f o r t h e  

s m a l l e r d i s k s p a c e u s a g e .  

A r c h i t e c t u r e  

I t e x i s t s m a i n l y t h r e e k i n d s o f a r c h i t e c t u r e s : e m b e d d e d G e n e r a l P u r p o s e P r o c e s -  

s o r s ( G P P s ) , D i g i t a l S i g n a l P r o c e s s o r s ( D S P s ) a n d F i e l d P r o g r a m m a b l e G a t e A r r a y s  

( F P G A s ) . F o r t h e s e l e c t e d a l g o r i t h m s , t h e m a i n c h a r a c t e r i s t i c s o f t h o s e a r c h i t e c t u r e  

( p r o s a n d c o n s ) a r e g i v e n i n T a b l e 2 . 3 . 1 , o n p a g e 1 9 . T y p i c a l l y , e m b e d d e d G P P s  

a r e t h e m o s t c o m m o n p r o c e s s o r s , o e r i n g a l o t o f e x i b i l i t y , D S P s a r e m a i n l y u s e d  

i n r e p e t i t i v e s i g n a l p r o c e s s i n g a p p l i c a t i o n ( e . g . n u m b e r c r u n c h i n g ) a n d F P G A s o e r  

p a r a l l e l i s m a n d r e c o n g u r a b i l i t y a n d a r e m o r e a n d m o r e u s e d .  

P r o c e s s o r s P r o s C o n s  

e m b e d d e d G P P s p e e d , d e v e l o p m e n t t i m e ,  

o a t i n g p o i n t s u p p o r t  

l i m i t e d p a r a l l e l i s m ( d e p e n d -  

i n g o n t h e n u m b e r o f c o r e )  

D S P s o m e p a r a l l e l i s m , x e d o r  

o a t i n g p o i n t s u p p o r t  

s p e c i c f o r s i g n a l p r o c e s s i n g  

c a l c u l a t i o n  

F P G A   m a s s i v e p a r a l l e l i s m , r e c o n g -  

u r a b i l i t y  

m o r e d i c u l t t o i m p l e m e n t  

t h a n s o f t w a r e ( t i m e c o n s u m -  

i n g ) , o a t i n g p o i n t i s v e r y e x -  

p e n s i v e  

T a b l e 2 . 1 : P r o s a n d c o n s o f p r o c e s s o r s a v a i l a b l e f o r t h i s p r o j e c t : e a c h o f t h o s e h a v e  

t h e r e o w n c a p a b i l i t i e s . T h e   F P G A   h a v e a l s o t h e p o s s i b i l i t y t o i n c l u d e D S P e l e m e n t s .  

F o r f u r t h e r e x p l a n a t i o n a n d d e t a i l s a b o u t t h e s e l e c t e d a r c h i t e c t u r e , p l e a s e r e f e r t o  

C h a p t e r 3 , o n p a g e 2 3 . F o r t h e m a i n d e t a i l s a b o u t t h e a c t u a l i m p l e m e n t a t i o n o n t h e  

s e l e c t e d a r c h i t e c t u r e , p l e a s e r e f e r t o C h a p t e r 5 , o n p a g e 5 5 .  

2 . 3 . 2 T h e R u g b y M e t a - M o d e l a p p l i e d t o o u r p r o j e c t  

T h e a p p l i c a t i o n o f e a c h d o m a i n i s g i v e n i n t h e f o l l o w i n g p a r a g r a p h s . T h e g l o b a l  

m e t a - m o d e l a p p l i e d t o t h i s p r o j e c t c a n b e s e e n i n F i g u r e 2 . 5 , o n p a g e 2 0 .  

C o m p u t a t i o n  

T h e c o m p u t a t i o n d o m a i n s t a r t s f r o m t h e r e l a t i o n s a n d c o n s t r a i n t s l e v e l t o g o t o  

t h e t r a n s i s t o r l e v e l , f o r t h e h a r d w a r e p a r t , a n d t h e i n s t r u c t i o n s e t , f o r t h e s o f t w a r e  

p a r t . F o r t h i s p r o j e c t , t h e r s t l e v e l o f a b s t r a c t i o n i s d e s c r i b e d i n C h a p t e r 3 , o n p a g e  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 36/110

2 0  2 . D e s i g n M o d e l s  

F i g u r e 2 . 5 : R u g b y m e t a - m o d e l a p p l i e d t o o u r p r o j e c t .  

F i g u r e 2 . 6 : T h e C o m p u t a t i o n d o m a i n a p p l i e d t o o u r p r o j e c t .  

2 3 . T h e s y s t e m f u n c t i o n s o f t h e p r o j e c t a r e d e s c r i b e d i n t h e f o l l o w i n g c h a p t e r . F o r  

t h e h a r d w a r e p a r t , t h e a b s t r a c t i o n l e v e l s t o p s a t t h e l o g i c b l o c k s l e v e l a s a n a l r e a d y  

e x i s t i n g   F P G A   i s u s e d . C o n c e r n i n g t h e s o f t w a r e p a r t , a s a s o f t c o r e p r o c e s s o r i s u s e d  

( p l e a s e r e f e r t o C h a p t e r 1 , p a g e 3 ) , t h e i n s t r u c t i o n s e t i s t h e o n e o f t h i s p r o c e s s o r .  

T h e d i a g r a m o f t h i s d o m a i n i s s h o w n o n F i g u r e 2 . 6 , o n p a g e 2 0 .  

C o m m u n i c a t i o n  

F i g u r e 2 . 7 : T h e C o m m u n i c a t i o n d o m a i n a p p l i e d t o o u r p r o j e c t .  

T h e c o m m u n i c a t i o n d o m a i n s t a r t s w i t h t h e s t r u c t u r a l a n d i n t e r f a c e c o n s t r a i n t s  

l e v e l t o n i s h a t t h e l a y o u t l e v e l , f o r t h e h a r d w a r e p a r t , a n d t h e a d d r e s s i n g n o d e s ,  

f o r t h e s o f t w a r e p a r t . F o r t h i s p r o j e c t , t h e r s t l e v e l o f a b s t r a c t i o n i s d e s c r i b e d i n  

C h a p t e r 3 , o n p a g e 2 3 . T h e i n t e r p r o c e s s c o m m u n i c a t i o n i s c o r e p a r t o f t h e p r o j e c t a s  

t h e a l g o r i t h m s u s e d r e q u i r e a l o t o f d a t a . A l s o , m e m o r y a c c e s s e s a r e v e r y i m p o r t a n t  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 37/110

2 . 3 T h i s p r o j e c t d e s c r i b e d u s i n g t h e d e s i g n m o d e l s   2 1 

b e c a u s e t h e i n t e r n a l m e m o r y o f a n   F P G A   c h i p i s t o o s m a l l f o r i m a g e p r o c e s s i n g .  

T h e r e f o r e , t h e b e t t e r t h e p r o c e s s e s c o m m u n i c a t e , t h e f e w e r t i m e i s s p e n d a c c e s s i n g  

t h e m e m o r y . C o n c e r n i n g t h e p a r a m e t e r p a s s i n g , f o r t h e s o f t w a r e , a n d t h e t o p o l o g y  

o f t h e h a r d w a r e i m p l e m e n t a t i o n , t h e f o l l o w i n g c h a p t e r d e s c r i b e s h o w t h e p r o b l e m s  

h a v e b e e n s o l v e d . T h e d i a g r a m o f t h i s d o m a i n i s s h o w n o n F i g u r e 2 . 7 , o n p a g e 2 0 .  

D a t a  

F i g u r e 2 . 8 : T h e D a t a d o m a i n a p p l i e d t o o u r p r o j e c t .  

T h e D a t a d o m a i n s t a r t s w i t h t h e d a t a c o n s t r a i n t s l e v e l t o n i s h a t t h e a n a l o g  

v a l u e , f o r t h e h a r d w a r e p a r t , a n d t h e p r o c e s s o r d a t a t y p e s f o r t h e s o f t w a r e p a r t .  

F o r t h i s p r o j e c t , t h e r s t l e v e l o f a b s t r a c t i o n i s d e s c r i b e d i n C h a p t e r 3 , o n p a g e 2 3 .  

T h e s y m b o l s a n d n u m b e r u s e d a r e d e s c r i b e d i n t h e f o l l o w i n g c h a p t e r s , a s i t w a s v e r y  

i m p o r t a n t t o d e n e t h e m w e l l t o i m p r o v e a n d e n h a n c e t h e c o m m u n i c a t i o n d o m a i n .  

T h e a n a l o g v a l u e a b s t r a c t i o n l e v e l w a s o n l y u s e d f o r t e s t i n g a n d e x p e r i m e n t s p u r p o s e .  

F o r t h e h a r d w a r e i m p l e m e n t a t i o n , o n l y l o g i c v a l u e s w e r e u s e d . F o r t h e s o f t w a r e p a r t ,  

t h e p r o c e s s o r d a t a t y p e s u s e d w e r e t h o s e o f t h e   N i o s I I   s o f t c o r e p r o c e s s o r . T h e  

d i a g r a m o f t h i s d o m a i n i s s h o w n o n F i g u r e 2 . 8 , o n p a g e 2 1 .  

T i m e  

F i g u r e 2 . 9 : T h e T i m e d o m a i n a p p l i e d t o o u r p r o j e c t .  

T h e t i m e d o m a i n s t a r t s w i t h t h e t i m i n g c o n s t r a i n t s l e v e l t o n i s h a t t h e p h y s i c a l  

t i m e , f o r t h e h a r d w a r e p a r t , a n d t h e p r o c e s s o r c y c l e t i m e f o r t h e s o f t w a r e p a r t .  

F o r t h i s p r o j e c t , t h e r s t l e v e l o f a b s t r a c t i o n i s d e s c r i b e d i n C h a p t e r 3 , o n p a g e 2 3 .  

T h e m a i n p o i n t t o b e n o t e d i s t h a t t h e f r e q u e n c y o f t h e   N i o s I I   s o f t c o r e p r o c e s s o r  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 38/110

2 2  2 . D e s i g n M o d e l s  

i s 1 0 0 M H z . T h e p h y s i c a l t i m e l e v e l o f a b s t r a c t i o n w a s o n l y u s e d f o r t e s t i n g a n d  

e x p e r i m e n t s p u r p o s e . T h e d i a g r a m o f t h i s d o m a i n i s s h o w n o n F i g u r e 2 . 9 , o n p a g e  

2 1 . 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 39/110

Chapter3S y s t e m D e s c r i p t i o n      

F i g u r e 3 . 1 : L o c a t i o n i n t h e  A3

p a r a d i g m , h i g h l i g h t e d b y t h e p u r p l e c i r c l e .  

T h i s C h a p t e r p r e s e n t s t h e s y s t e m a n a l y s i s a n d t h e s y s t e m d e s i g n . T o d o s o ,  

a r s t s e c t i o n e x p l a i n s t h e c o n s t r a i n t s o f t h i s p r o j e c t . T h e n , i t g i v e s t h e n e e d s  

r e q u i r e d b y t h i s p r o j e c t . T h e p l a t f o r m s a n d p r o g r a m m i n g l a n g u a g e s a r e t h e n s h o r t l y  

r e v i e w e d , b e f o r e d e a l i n g w i t h t h e s o f t c o r e p r o c e s s o r s ( d e n e d i n 3 . 2 . 2 ) a n d e m b e d d e d  

2 3 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 40/110

2 4  3 . S y s t e m D e s c r i p t i o n  

( a ) G l o b a l l o c a t i o n ( b ) E l a b o r a t e d l o c a t i o n  

F i g u r e 3 . 2 : L o c a t i o n i n t h e R u g b y M e t a - M o d e l , h i g h l i g h t e d b y t h e g r e y b a r s o n ( a )  

a n d ( b ) .  

O S ( d e n e d i n 3 . 2 . 4 ) p o s s i b i l i t i e s . F i n a l l y , t h e l a s t s e c t i o n d e t a i l s a n d e x p l a i n s t h e  

c h o i c e s m a d e t o m e e t t h o s e c o n s t r a i n t s a n d r e q u i r e m e n t s .  

3 . 1 S y s t e m c o n s t r a i n t s a n a l y s i s  

T h i s s e c t i o n g i v e s a n o v e r v i e w o f t h e d i e r e n t c o n s t r a i n t s o f t h e s y s t e m .  

3 . 1 . 1 U s e o f   F P G A  

F P G A  

d e n i t i o n  

T h e r s t c o n s t r a i n t i s t h e c h o i c e o f a t e c h n o l o g y . I n t h i s p r o j e c t , o n e o f t h e g o a l s  

i s t o t r y t o e v a l u a t e t h e f e a s i b i l i t y o f i m p l e m e n t i n g a m o t i o n d e t e c t i o n a l g o r i t h m  

o n t o a   F P G A   p l a t f o r m .  

F P G A   s t a n d s f o r F i e l d - P r o g r a m m a b l e G a t e A r r a y a n d r e f e r s t o a s e m i c o n d u c t o r  

d e v i c e c o n t a i n i n g p r o g r a m m a b l e l o g i c c o m p o n e n t s c a l l e d " l o g i c b l o c k s " i n c l u d i n g  

m e m o r i e s a n d p r o g r a m m a b l e i n t e r c o n n e c t s ( [ P T 0 5 ] ) . T h e d e s i g n e r c a n p r o g r a m t h e  

l o g i c b l o c k s a n d t h e i n t e r c o n n e c t s l i k e a o n e - c h i p p r o g r a m m a b l e b r e a d b o a r d .  

I n t h e d e s i g n o w o f a n e w p r o d u c t , t h e e a r l y d e s i g n s a r e u s i n g F P G A s t h e n m i -  

g r a t e d i n t o a x e d v e r s i o n t h a t m o r e r e s e m b l e s a n A S I C . A S I C m e a n s A p p l i c a t i o n -  

S p e c i c I n t e g r a t e d C i r c u i t a n d r e f e r s t o a n i n t e g r a t e d c i r c u i t c u s t o m i z e d f o r a p a r t i c -  

u l a r u s e . T o b e c o n g u r e d , t h e   F P G A   h a s t o b e d e s c r i b e d b y a l o g i c c i r c u i t d i a g r a m  

o r a s o u r c e c o d e u s i n g a h a r d w a r e d e s c r i p t i o n l a n g u a g e ( d e n e d i n 3 . 5 . 1 ) .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 41/110

3 . 1 S y s t e m c o n s t r a i n t s a n a l y s i s   2 5 

T a b l e 3 . 1 . 1 ( p a g e 2 5 ) s u m m a r i z e t h e p r o s a n d t h e c o n s o f t h e F P G A s c o m p a r e d  

t o A S I C s .  

P r o s C o n s  

T i m e - t o - m a r k e t s h o r t e r t h a n  

A S I C s  

S l o w e r t h a n A S I C s  

D e v e l o p m e n t c o s t c h e a p e r  

t h a n A S I C s  

M o r e e x p e n s i v e f o r m a s s p r o -  

d u c t i o n s t h a n A S I C s  

L o w e r n o n - r e c u r r i n g e n g i n e e r -  

i n g c o s t s t h a n A S I C s  

M o r e p o w e r c o n s u m i n g t h a n  

A S I C s  

R e - p r o g r a m m a b l e i n t h e e l d D i c u l t y t o p r o g r a m   F P G A  

p l a t f o r m  

P e r f o r m a n c e / p o w e r r e l a t i v e  

t o s t a n d a r d p r o c e s s o r s a n d  

D S P s  

T a b l e 3 . 1 : P r o s a n d c o n s o f   F P G A   c o m p a r e d t o A S I C : d e s p i t e t h e i r l o w e r p e r f o r -  

m a n c e s c o m p a r e d t o A S I C s , F P G A s a r e m o r e e x i b l e a n d e a s y t o d e v e l o p  

T h e r e q u i r e m e n t s s p e c i e d d u r i n g t h e e a r l y d e s i g n s t e p o f t h e p r o j e c t a r e t h e  

f o l l o w i n g :  

• F a s t p r o c e s s o r f o r p r o c e s s i n g p a r a l l e l t a s k s  

• S u p p o r t / d o c u m e n t a t i o n / e x a m p l e s a v a i l a b l e a n d u p t o d a t e  

• F r e e o f c h a r g e s o r n o t e x p e n s i v e p r i c e  

• I n p u t / o u t p u t f o r t h e c a m e r a s e n s o r  

• U S B w i r e f o r p r o g r a m m i n g / d e b u g g i n g t h e   F P G A  

• P o s s i b i l i t y t o a d d a s o f t c o r e p r o c e s s o r  

• P o s s i b i l i t y t o a d d a n e m b e d d e d   O S 

• S D c a r d o r M M C s l o t t o a d d e x t r a m e m o r y ( S D : S e c u r e D i g i t a l , M M C : M u l -  

t i m e d i a c a r d )  

3 . 1 . 2 T i m e c o n s t r a i n t  

T h e t i m e c o n s t r a i n t f o l l o w s t w o d i e r e n t a x i s . O n t h e o n e h a n d , t h e i m a g e p r o c e s s -  

i n g p a r t m u s t b e f a s t e n o u g h t o s t a r t t h e r e c o r d i n g a s s o o n a s a m o t i o n i s d e t e c t e d .  

O n t h e o t h e r h a n d , t h e s t o r a g e p r o c e s s m u s t b e f a s t e n o u g h t o s t o r e a p i c t u r e a f t e r  

a n o t h e r p i c t u r e w i t h o u t f r e e z i n g . T h o s e t w o a s p e c t s d e p e n d o n t h e p l a t f o r m u s e d  

a n d t h e e c i e n c y o f t h e a l g o r i t h m . T h i s t i m e c o n s t r a i n t i s r e l a t e d t o t h e d a t a c o n -  

s t r a i n t b e c a u s e t h e q u i c k n e s s o f e x e c u t i o n o f t h e i m a g e p r o c e s s i n g d e p e n d o n t h e  

t e m p o r a r y s t o r a g e o f p i c t u r e s .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 42/110

2 6  3 . S y s t e m D e s c r i p t i o n  

3 . 1 . 3 D a t a c o n s t r a i n t s  

F o r m o t i o n t o b e d e t e c t e d , p i c t u r e s n e e d t o b e p r o c e s s e d a n d a n a l y s e d . I t a l r e a d y  

u n d e r l i n e s t w o k i n d s o f c o n s t r a i n t s . T h e r s t o n e i s t h a t t h e s y s t e m n e e d s a m e m o r y  

w i t h f a s t a c c e s s f o r t h e p r o c e s s t o b e i n r e a l t i m e ( o r a t l e a s t a s c l o s e t o ) . T h e o t h e r  

c o n s t r a i n t i s a b o u t t h e t y p e o f t h e d a t a : i s i t p o s s i b l e t o p e r f o r m t h e a l g o r i t h m o n  

t h e r a w d a t a o r d o t h i s r a w d a t a n e e d t o b e t r a n s f o r m e d i n t o a k n o w n p i c t u r e t y p e .  

A f t e r t h e d e t e c t i o n o f a m o v e m e n t , w h e n t h e s y s t e m s t a r t s t o r e c o r d , t h e v i d e o m u s t  

b e s t o r e d . I t m e a n s t h a t t h e p i c t u r e s h a s t o b e s t o r e d q u i c k l y e n o u g h a s t h e y a r e  

a r r i v i n g ( l e s s t h a n 0 . 1 s ) .  

A s a c o n s e q u e n c e : t h e s y s t e m m u s t h a v e a m e m o r y s i z e d b i g e n o u g h t o s t o r e a  

d e c e n t a m o u n t o f v i d e o r e c o r d e d . T h e d a t a s t o r e d m u s t t t o t h e p e r f o r m a n c e s o f  

t h e p l a t f o r m a n d n e e d n o t t o b e t o o i m p o r t a n t . T h e n , w h e n a v i d e o i s r e c o r d e d ,  

i t n e e d t o b e a v a i l a b l e i n t h e F P G A m e m o r i e s ( i n t e r n a l o r e x t e r n a l ) f o r t h e e x t e r n a l  

u s e r s o f t h e s y s t e m . T h e s u c c e s s o f t h e m o t i o n d e t e c t i o n a n d t h e s t o r a g e o f t h e  

p i c t u r e s a n d v i d e o s a r e d e p e n d e n t t o t h e o w o f p i c t u r e s a n d t h e i r d i m e n s i o n s .  

3 . 1 . 4 O t h e r c o n s t r a i n t s  

L a s t b u t n o t l e a s t , s o m e o t h e r c o n s t r a i n t s n e e d t o b e m e n t i o n e d . O n e c o n c e r n s  

t h e s e c u r i t y . I n d e e d , a s t h i s m o t i o n d e t e c t i o n c a m e r a c o u l d b e u s e d a s a s u r v e i l l a n c e  

s y s t e m , i t n e e d s t o b e s e c u r e d . O n e o t h e r a s p e c t s c o n c e r n s t h e p o w e r c o n s u m p t i o n .  

T h i s a s p e c t i s m a i n l y d e p e n d i n g o n u s e c o n t e x t o f t h e s y s t e m . T h i s a s p e c t i s o u t o f  

t h e s c o p e o f t h i s r e p o r t b e c a u s e n o t a l l t h e   F P G A   h a v e b e e n o p t i m i z e d f o r p o w e r  

c o n s u m p t i o n a n d t h e c h o i c e o f F P G A s a r e a v a i l a b l e f o r t h e s y s t e m w a s q u i t e l i m i t e d  

t o t h o s e a v a i l a b l e i n t h e A A U e m b e d d e d l a b ( T e r a s i c D E 2 w i t h   A l t e r a C y c l o n e  

I I  o r  S t r a t i x   a n d C e l o x i c a R C 2 0 3 w i t h   X i l i n x   V i r t e x ) .  

T h e c o n s t r a i n t s a p p l i e d t o t h i s s y s t e m c a n c h a n g e d e e p l y d e p e n d i n g o n t h e n a l  

p u r p o s e s . I n d e e d , t h e p e r f o r m a n c e s r e q u i r e d a n d t h e a l g o r i t h m s n e e d e d a r e n o t t h e  

s a m e d e p e n d i n g i f t h e o b j e c t i v e i s t o d e t e c t a m o v e m e n t , t o c o u n t p e o p l e s o r t o  

r e c o g n i z e f o r m s .  

3 . 2 S k e t c h i n g t h e i n i t i a l a r c h i t e c t u r e  

3 . 2 . 1 H a r d w a r e / s o f t w a r e c o - d e s i g n  

O n e o f t h e k e y n o t i o n i n t h i s p r o j e c t i s H a r d w a r e / S o f t w a r e C o - D e s i s g n [ W o l 0 3 ]  

w h i c h i s u s e d t h r o u g h a l l t h e d e v e l o p m e n t p h a s e s . T h i s c o n c e p t h a s b e e n c r e a t e d  

a l i t t l e m o r e t h a n a d e c a d e a g o i n r e s p o n s e t o t h e r a i s e o f t h e e m b e d d e d s y s t e m s ,  

t h e c o m p l e x i t y a n d t h e h e t e r o g e n e i t y o f t h o s e s y s t e m s . A s a n e x a m p l e , a l r e a d y i n  

1 9 9 8 , 9 8 % o f t h e p r o c e s s o r s w e r e f o u n d i n e m b e d d e d s y s t e m s . E m b e d d e d s y s t e m s  

a r e s i n g l e - f u n c t i o n n e d , t i g h t l y c o n s t r a i n t e d , r e a c t i v e a n d r e a l t i m e s y s t e m s . W h e n  

d e s i g n i n g a e m b b e d d e d s y s t e m , t h e p a r t i t i o n i n g b e t w e e n h a r d w a r e a n d s o f t w a r e i s  

a c r u c i a l p o i n t . H a r d w a r e h a s b e t t e r p e r f o r m a n c e s b u t i s m o r e d i c u l t t o c o d e  

c o n t r a r y t o s o f t w a r e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 43/110

3 . 2 S k e t c h i n g t h e i n i t i a l a r c h i t e c t u r e   2 7 

F i g u r e 3 . 3 : H a r d w a r e / S o f t w a r e C o - D e s i g n t o r e a c h t h e c o n s t r a i n t s o f p e r f o r m a n c e s  

a n d c o s t s [ K o c ] .  

F i g u r e 3 . 3 , p a g e 2 7 [ K o c ] , e n l i g h t e n s t h a t t o d e a l w i t h t i m e a n d p e r f o r m a n c e  

c o n s t r a i n t s , a d e s i g n e r h a s t o m a k e c h o i c e s a b o u t p a r t i t i o n i n g h i s a l g o r i t h m b e t w e e n  

h a r d w a r e a n d s o f t w a r e p a r t . T h i s p a r t i t i o n i n g a n d t a s k s s c h e d u l i n g a r e t h e t w o m a i n  

d i m e n s i o n s o f t h e C o - D e s i g n . H a r d w a r e / S o f t w a r e C o - D e s i s g n c a n b e s u m m a r i z e d i n  

t h e f o l l o w i n g w a y :  

H a r d w a r e / S o f t w a r e C o - D e s i s g n p r o v i d e s a w a y o f c u s t o m i z i n g t h e h a r d w a r e a n d  

t h e s o f t w a r e a r c h i t e c t u r e s t o c o m p l e m e n t o n e a n o t h e r i n w a y s w h i c h i m p r o v e s y s t e m  

 f u n c t i o n a l i t y , p e r f o r m a n c e , r e l i a b i l i t y , s u r v i v a b i l i t y a n d c o s t / e e c t i v e n e s s . [ S F L 8 5 ]  

H a r d w a r e / S o f t w a r e C o - D e s i s g n w a s u s e d i n t h i s p r o j e c t t o s a v e s o m e t i m e f o r  

d e v e l o p m e n t a n d t o m a k e t h e s y s t e m m o r e e c i e n t a n d f a s t e r b e c a u s e b o t h h a r d w a r e  

a n d s o f t w a r e d e v e l o p m e n t h a v e b e e n u s e d i n t h i s p r o j e c t a n d s e p a r a t e t h e m a s l a t e  

a s p o s s i b l e i n t h e c o n c e p t i o n c y c l e , a i m i n g a t u n i f y i n g t h e s p e c i c a t i o n t h a t i n c l u d e s  

b o t h h a r d w a r e a n d s o f t w a r e . T h e r e a s o n s a n d t h e p a r t i t i o n i n g u s e d i n t h i s p r o j e c t  

a r e d e s c r i b e d i n t h e a p p r o p r i a t e s e c t i o n A .  

3 . 2 . 2 s o f t c o r e p r o c e s s o r d e n i t i o n  

A s o f t c o r e p r o c e s s o r i s a p r o c e s s o r i m p l e m e n t e d i n t o a r e p r o g r a m m a b l e s y s t e m  

l i k e a   F P G A   . I t i s a S y s t e m o n P r o g r a m m a b l e C h i p o r S o P C .  

A s o f t c o r e p r o c e s s o r i s a v e r y e x i b l e a r c h i t e c t u r e , i t c a n b e r e c o n g u r e d a t a n y  

t i m e , c o n t r a r y t o a h a r d c o r e p r o c e s s o r w h o s e c o r e h a s i t o w n n o n - r e p r o g r a m m a b l e  

c h i p . A s o f t c o r e p r o c e s s o r c a n b e a d a p t e d t o t h e m a t e r i a l c o n s t r a i n t s ( p e r f o r m a n c e s ,  

r e s o u r c e s , p o w e r c o n s u m p t i o n , . . . ) . H o w e v e r , s o f t c o r e p r o c e s s o r s p e r f o r m a n c e s a r e  

i n f e r i o r t o t h e h a r d c o r e o n e s b u t a s o f t c o r e p r o c e s s o r i s e a s i e r t o m a i n t a i n a n d c a n  

i m p l e m e n t e d i n t o a n A S I C ( A p p l i c a t i o n S p e c i c I n t e g r a t e d C i r c u i t ) .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 44/110

2 8  3 . S y s t e m D e s c r i p t i o n  

3 . 2 . 3 T h e n e e d f o r a s o f t c o r e p r o c e s s o r  

U s i n g a s o f t c o r e p r o c e s s o r h a s m a n y a d v a n t a g e s :  

• H i g h e r l e v e l o f a b s t r a c t i o n ( t h e s o f t c o r e p r o c e s s o r t r a n s f o r m s t h e d e v e l o p e r ' s  

s o f t w a r e c o d e i n t o h a r d w a r e l a n g u a g e )  

• P o s s i b i l i t y t o u s e h i g h e r l e v e l l a n g u a g e s a s C l i k e l a n g u a g e s  

• B e t t e r m a n a g e m e n t o f t h e m e m o r i e s  

• W i t h a s o f t c o r e p r o c e s s o r , t h e c o n c e p t i o n i s g o i n g f r o m h a r d w a r e t o s o f t w a r e  

• E a s i l y r e c o n g u r a b l e c o m p a r e d t o o t h e r p r o c e s s o r s  

3 . 2 . 4 T h e n e e d f o r a n e m b e d d e d O S  

T h e f o l l o w i n g d e n i t i o n s a r e n e c e s s a r y t o c l a r i f y w h a t i s a n e m b e d d e d O S .  

T h e s o f t w a r e c o m p o n e n t o f a c o m p u t e r s y s t e m t h a t i s r e s p o n s i b l e f o r t h e m a n a g e -  

m e n t a n d c o o r d i n a t i o n o f a c t i v i t i e s a n d t h e s h a r i n g o f t h e r e s o u r c e s o f t h e c o m p u t e r  

i s d e n e d a s a n o p e r a t i n g s y s t e m . T h i s O p e r a t i n g S y s t e m ( O S ) a c t s a s a n h o s t  

f o r a p p l i c a t i o n p r o g r a m s t h a t a r e e x e c u t e d o n t h e m a c h i n e . A s a n h o s t , o n e o f t h e  

p u r p o s e s o f a n o p e r a t i n g s y s t e m i s t o h a n d l e t h e d e t a i l s o f t h e o p e r a t i o n o f t h e  

h a r d w a r e .  

A n e m b e d d e d o p e r a t i n g s y s t e m i s a n   O S  f o r e m b e d d e d s y s t e m s . T h e s e   O S  a r e 

s p e c i a l i z e d , c o m p a c t a n d e c i e n t . T h e y d o n o t h a v e a l l t h e f u n c t i o n s t h e n o n -  

e m b e d d e d c o m p u t e r h a v e b e c a u s e t h e y d o n o t n e e d t h e m . T h e e m b e d d e d   O S  a r e 

d e s i g n e d t o b e o p e r a t e d o n r e a l - t i m e o p e r a t i n g s y s t e m s .  

T h e a d v a n t a g e s g i v e n b y t h e e m b e d d e d   O S  a r e :  

• H i g h e r a b s t r a c t i o n l e v e l ( p o s s i b i l i t y t o u s e o b j e c t - o r i e n t e d l a n g u a g e s l i k e p y t h o n )  

• B e t t e r m e m o r y m a n a g e m e n t  

• B e t t e r n e t w o r k m a n a g e m e n t  

• S o m e w e b s e r v e r a r e a l r e a d y c o d e d a n d a v a i l a b l e  

• P o s s i b i l i t y t o d o p a r a l l e l i s m ( m o s t p r o c e s s o r s d o e s n o t a l l o w s o f t w a r e p a r a l -  

l e l i s m )  

• B e t t e r m a n a g e m e n t o f t h e T C P / I P s t a c k  

O n c e a s o f t c o r e p r o c e s s o r h a s b e e n i m p l e m e n t e d o n t h e b o a r d , a n o t h e r s t e p c o u l d  

b e t h e i m p l e m e n t a t i o n o f a n e m b e d d e d O S . T h e a v a i l a b l e e m b e d d e d O S a r e d e p e n d -  

i n g o n t h e p l a t f o r m u s e d . L i k e f o r t h e s o f t c o r e p r o c e s s o r s , s o m e o f t h e m c a n b e f r e e  

a n d / o r o p e n - s o u r c e s b u t n o n e o f t h e m h a s b e e n c r e a t e d b y t h e c o m p a n i e s b u i l d i n g  

t h e p l a t f o r m s (  X i l i n x   o r  A l t e r a   ) . 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 45/110

3 . 3 P o s s i b l e o p t i o n s t o s a t i s f y t h e s y s t e m c o n s t r a i n t s   2 9 

3 . 3 P o s s i b l e o p t i o n s t o s a t i s f y t h e s y s t e m c o n s t r a i n t s  

I n t h e f o l l o w i n g s e c t i o n s a r e d e t a i l e d a l l t h e f e a s i b l e s o l u t i o n s t h a t c a n b e e x p l o r e d  

i n a l l t h e r e l e v a n t d o m a i n s :  

• F P G A   p l a t f o r m s  

• P r o g r a m m i n g l a n g u a g e s s o f t c o r e p r o c e s s o r  

• E m b e d d e d O S  

A f t e r t h e s e p r e s e n t a t i o n s t h e o p t i o n s s e l e c t e d f o r t h i s p r o j e c t a r e s h o w n i n 3 . 8 .  

3 . 4  F P G A   p l a t f o r m s  

H e r e i s l i s t o f t h e   F P G A   p l a t f o r m s a v a i l a b l e i n t h e e m b e d d e d l a b o r a t o r y o f A A U  

t h a t c o u l d b e u s e d f o r t h i s p r o j e c t . T h e y a r e s u p p o s e d t o t t h e c o n s t r a i n t s d e -  

c l a r e d i n 3 . 1 : r e s o u r c e s , i n p u t / o u t p u t f o r c a m e r a s e n s o r , p o s s i b i l i t y t o a d d a s o f t c o r e  

p r o c e s s o r o r a n e m b e d d e d   O S  a n d s o o n .  

3 . 4 . 1   A l t e r a C y c l o n e I I   o n  T e r a s i c   D E 2 b o a r d  

T h i s i s a c o m m o n s o l u t i o n u s i n g c l a s s i c e d u c a t i o n b o a r d w i t h a m e d i u m s i z e d  

F P G A   ( [ C o r 0 6 a ] ) . I t i s s u p p o s e d t o r e p r e s e n t t h e m i d d l e p o i n t b e t w e e n c o m p l e x i t y ,  

p e r f o r m a n c e s . O n e o f t h e a d v a n t a g e s o f t h i s k i n d o f b o a r d a r e t h e e x a m p l e s p r o v i d e d  

w i t h i t a n d t h e o n e s w h i c h c a n b e f o u n d o n t h e I n t e r n e t . T h e r e l e v a n t D E 2 m a i n  

c h a r a c t e r i s t i c s a r e :  

• A l t e r a   C y c l o n e I I p r o c e s s o r ( 2 C 3 5 ) w i t h 3 5 0 0 0 L E s  

• 4 M e g a B y t e s S D R A M m e m o r y  

• 5 1 2 k i l o B y t e s S R A M m e m o r y  

• 8 M e g a B y t e s a s h m e m o r y  

• V G A o u t p u t  

• E t h e r n e t C o n n e c t i v i t y  

• s o f t c o r e p r o c e s s o r   N i o s I I   I I c r e a t e d b y   A l t e r a   f o r i t s F P G A S  

3 . 4 . 2   A l t e r a S t r a t i x  

T h e  S t r a t i x   d e v e l o p m e n t b o a r d ( [ C o r 0 8 ] ) i s a b e t t e r v e r s i o n o f t h e p r e v i o u s o n e :  

f a s t e r F P G A & l a r g e r m e m o r y . T h e m a i n d i e r e n c e s a r e :  

• T h e  S t r a t i x   p r o c e s s o r ( E P 1 S 1 0 ) w i t h 1 0 5 7 0 L E s  

• T h e S R A M m e m o r y i s 1 M e g a B y t e s  

• T h e S D R A M m e m o r y i s 1 6 M e g a B y t e s  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 46/110

3 0  3 . S y s t e m D e s c r i p t i o n  

3 . 4 . 3   X i l i n x V i r t e x   I I o n   C e l o x i c a   R C 2 0 3 b o a r d  

X i l i n x   i s t h e o t h e r c o m p a n y t h a t i s l e a d i n g t h e F P G A m a r k e t .   X i l i n x   p r o p o s e s  

a l s o m a i n d e v e l o p m e n t b o a r d s s i m i l a r t o t h e   A l t e r a   o n e s . T h e o n e a v a i l a b l e i n t h e  

e m b e d d e d l a b o r a t o r y i s t h e   C e l o x i c a   R C 2 0 3 f e a t u r i n g   X i l i n x V i r t e x   I I  F P G A  

( [ C o r 0 6 b ] ) . I t h a s t h e f o l l o w i n g k e y f e a t u r e s :  

• X i l i n x   X C 2 V 3 0 0 0 - 4 V i r t e x I I p r o c e s s o r  

• 2 B a n k s o f 2 M b y t e e a c h S R A M ( 4 M b t o t a l )  

• V i d e o I n / O u t  

• A u d i o I n / O u t  

• S m a r t m e d i a s o c k e t  

• 1 0 / 1 0 0 E t h e r n e t  

• P a r a l l e l P o r t  

• R S 2 3 2 p o r t  

• P S 2 K e y b o a r d a n d M o u s e p o r t s  

3 . 5 P r o g r a m m i n g a n d s i m u l a t i o n l a n g u a g e s  

I n t h i s s e c t i o n a r e d e s c r i b e d t h e d i e r e n t p r o g r a m m i n g a n d s i m u l a t i o n l a n g u a g e s  

t h a t c a n a n s w e r t h e n e e d s o f t h e p r o j e c t . T h o s e l a n g u a g e s c a n b e d i e r e n t i a t e d  

i n t o c a t e g o r i e s b e c a u s e a l l c a n n o t b e u s e d i n t h e s a m e c o n d i t i o n s a n d f o r t h e s a m e  

g o a l s . T h e H a r d w a r e D e s c r i p t i o n L a n g u a g e ( H D L , 3 . 5 . 1 ) a r e t h e l a n g u a g e s d i r e c t l y  

a v a i l a b l e o n t h e   F P G A   p l a t f o r m . T h e n t h e r e a r e t h e S y s t e m D e s c r i p t i o n L a n g u a g e  

w h i c h d o n o t a l s o n e e d a n y a d d e d l a y e r o n t h e   F P G A   p l a t f o r m . A f t e r t h a t a r e t h e  

h i g h l e v e l l a n g u a g e s w h i c h n e e d s a s o f t c o r e p r o c e s s o r o r a n e m b e d d e d   O S  t o w o r k .  

T h e c o n c l u s i o n s a n d t h e c h o i c e s m a d e f o r t h i s p r o j e c t c o n c e r n i n g t h e p r o g r a m m i n g  

l a n g u a g e s a r e p r e s e n t e d i n s e c t i o n 3 . 8  

3 . 5 . 1 H a r d w a r e D e s c r i p t i o n L a n g u a g e s ( H D L )  

D e n i t i o n  

I n e l e c t r o n i c s , a n H a r d w a r e D e s c r i p t i o n L a n g u a g e o r H D L i s a c o m p u t e r l a n g u a g e  

f o r f o r m a l d e s c r i p t i o n o f e l e c t r o n i c c i r c u i t s . S o i t c a n d e s c r i b e a n o p e r a t i o n m a d e b y  

a c i r c u i t , i t s d e s i g n a n d o r g a n i z a t i o n . I t c a n a l s o b e s i m u l a t e d a n d t e s t e d t o v e r i f y  

t h i s o p e r a t i o n .  

A H a r d w a r e D e s c r i p t i o n L a n g u a g e i s w r i t t e n i n s t a n d a r d t e x t - b a s e d a n d d e s c r i b e s  

t h e b e h a v i o u r c i r c u i t s t r u c t u r e o f a n e l e c t r o n i c s y s t e m ( f o r e x a m p l e F P G A ) . D i e r -  

i n g f r o m s o f t w a r e p r o g r a m m i n g l a n g u a g e s , a n H D L ' s s y n t a x a n d s e m a n t i c s t a k e i n  

a c c o u n t t h e t i m e a n d t h e c o n c u r r e n c y b e t w e e n p r o c e s s e s . T h e l a n g u a g e s d e s c r i b i n g  

t h e c i r c u i t c o n n e c t i v i t y b e t w e e n a c l a s s i e d h i e r a r c h y o f b l o c k s a r e n e t l i s t l a n g u a g e s .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 47/110

3 . 5 P r o g r a m m i n g a n d s i m u l a t i o n l a n g u a g e s   3 1 

E x e c u t a b l e s p e c i c a t i o n s f o r h a r d w a r e c a n b e w r i t t e n w i t h H D L s . T h e s i m u l a t i o n  

p r o g r a m t a k e s a l s o t h e t i m e i n a c c o u n t a n d a l l o w s t h e p r o g r a m m e r s t o m o d e l a  

p i e c e o f h a r d w a r e b e f o r e i t i s c r e a t e d p h y s i c a l l y . W i t h t h e h a r d w a r e d e s c r i p t i o n s , a  

s o f t w a r e p r o g r a m c a l l e d a s y n t h e s i z e r c a n i n f e r h a r d w a r e l o g i c o p e r a t i o n s f r o m t h e  

l a n g u a g e s t a t e m e n t s a n d p r o d u c e a n e q u i v a l e n t n e t l i s t o f g e n e r i c h a r d w a r e p r i m i t i v e s  

t o i m p l e m e n t t h e s p e c i e d b e h a v i o u r o n t h e p l a t f o r m .  

D e s i g n i n g a s y s t e m i n H D L i s g e n e r a l l y m u c h h a r d e r a n d m o r e t i m e c o n s u m i n g  

t h a n w r i t i n g t h e e q u i v a l e n t p r o g r a m i n a C l i k e l a n g u a g e . T o s o l v e t h i s d i c u l t y ,  

t h e r e h a s b e e n m u c h w o r k d o n e o n a u t o m a t i c c o n v e r s i o n o f C c o d e i n t o H D L .  

V e r i l o g  

V e r i l o g   ( [ T D M P 8 5 ] ) i s a H a r d w a r e D e s c r i p t i o n L a n g u a g e u s e d t o m o d e l e l e c -  

t r o n i c s y s t e m s l i k e F P G A s a n d A S I C s . T h e l a n g u a g e i s d e s i g n e d f o r t h e d e s i g n ,  

v e r i c a t i o n , a n d i m p l e m e n t a t i o n o f a n a l o g , d i g i t a l o r m i x e d - s i g n a l c i r c u i t s a t v a r i o u s  

l e v e l s o f a b s t r a c t i o n . T h e m a i n c h a r a c t e r i s t i c s o f t h i s l a n g u a g e a r e :  

• S y n t a x s i m i l a r t o t h e C p r o g r a m m i n g l a n g u a g e  

• C a s e - s e n s i t i v e  

• P r e p r o c e s s o r w i t h C t o o l s  

• T h e m a j o r c o n t r o l o w k e y w o r d s , s u c h a s " i f " a n d " w h i l e " , a r e s i m i l a r t o C  

• T h e f o r m a t t i n g m e c h a n i s m a n d l a n g u a g e o p e r a t o r s a r e a l s o s i m i l a r t o C  

"  O n e o f t h e k e y c o n c e p t i s t h e n o n s t r i c t l y s e q u e n t i a l e x e c u t i o n o f s t a t e m e n t s . A  

V e r i l o g   d e s i g n c o n s i s t s o f a h i e r a r c h y o f m o d u l e s . M o d u l e s a r e d e n e d w i t h a  

s e t o f i n p u t , o u t p u t , a n d b i d i r e c t i o n a l p o r t s . I n t e r n a l l y , a m o d u l e c o n t a i n s a l i s t o f  

w i r e s a n d r e g i s t e r s . C o n c u r r e n t a n d s e q u e n t i a l s t a t e m e n t s d e n e t h e b e h a v i o u r o f t h e  

m o d u l e b y d e n i n g t h e r e l a t i o n s h i p s b e t w e e n t h e p o r t s , w i r e s , a n d r e g i s t e r s . S e q u e n -  

t i a l s t a t e m e n t s a r e e x e c u t e d i n s e q u e n t i a l o r d e r w i t h i n t h e b l o c k . B u t a l l c o n c u r r e n t  

s t a t e m e n t s a n d a l l b e g i n / e n d b l o c k s i n t h e d e s i g n a r e e x e c u t e d i n p a r a l l e l , q u a l i f y i n g  

V e r i l o g   a s a d a t a o w l a n g u a g e .  " [ W i k d ]  

V H D L  

V H D L   ( V H S I C H a r d w a r e D e s c r i p t i o n L a n g u a g e ) ( [ A i r 8 3 ] ) i s c o m m o n l y u s e d a s a  

d e s i g n - e n t r y l a n g u a g e f o r e l d - p r o g r a m m a b l e g a t e a r r a y s a n d a p p l i c a t i o n - s p e c i c i n -  

t e g r a t e d c i r c u i t s i n e l e c t r o n i c d e s i g n a u t o m a t i o n o f d i g i t a l c i r c u i t s .   V H D L   w a s o r i g -  

i n a l l y d e v e l o p e d a t t h e b e s t o f t h e U S D e p a r t m e n t o f D e f e n c e i n o r d e r t o d o c u m e n t  

t h e b e h a v i o u r o f t h e A S I C s t h a t s u p p l i e r c o m p a n i e s w e r e i n c l u d i n g i n e q u i p m e n t .  

T h a t i s t o s a y , V H D L w a s d e v e l o p e d a s a n a l t e r n a t i v e t o h u g e , c o m p l e x m a n u a l s  

w h i c h w e r e s u b j e c t t o i m p l e m e n t a t i o n - s p e c i c d e t a i l s .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 48/110

3 2  3 . S y s t e m D e s c r i p t i o n  

H a n d e l - C  

E v e n i f l i k e t h e p r e v i o u s l a n g u a g e s   H a n d e l - C   ( [ C e l 0 5 ] ) i s m a d e t o e n a b l e t h e  

c o m p i l a t i o n o f p r o g r a m s i n t o s y n c h r o n o u s h a r d w a r e (  F P G A   a n d A S I C s ) , i t s c a s e  

i s a b i t d i e r e n t .   H a n d e l - C   i s m o r e a p r o g r a m m i n g l a n g u a g e a i m e d a t c o m p i l i n g  

h i g h l e v e l a l g o r i t h m s d i r e c t l y i n t o g a t e l e v e l h a r d w a r e t h a n a H D L . I t i s a s u b s e t o f  

C , w i t h n o n - s t a n d a r d e x t e n s i o n s t o c o n t r o l h a r d w a r e i n s t a n t i a t i o n a n d p a r a l l e l i s m .  

I t c o n t a i n s a l l t h e n e c e s s a r y f e a t u r e s t o d e s c r i b e c o m p l e x a l g o r i t h m s .  

3 . 5 . 2 S y s t e m D e s i g n L a n g u a g e s ( S D L )  

S D L 

A S y s t e m D e s c r i p t i o n L a n g u a g e ( S D L ) i s m o r e t h a n a H D L b e c a u s e i t c a n b e u s e d  

f o r d e s i g n i n g t h e w h o l e s y s t e m , u n l i k e H D L w h i c h a r e u s e d o n l y f o r c o d i n g b l o c k s .  

C o n c e r n i n g t h e i r c h a r a c t e r i s t i c s , t h e S D L s a r e :  

• M a d e f o r S y s t e m - o n - C h i p d e s i g n  

• U s e d t o m o v e t o H i g h e r l e v e l s o f a b s t r a c t i o n  

• U s e d t o d e s i g n a c o m p l e t e s y s t e m  

T h e p r o g r a m m i n g o f t h e S y s t e m D e s c r i p t i o n L a n g u a g e i s m a d e o n t h e d e v e l o p m e n t  

c o m p u t e r s . T h e n , a f t e r a c o - d e s i g n s t e p , t h e c o d e i s d i v i d e d b e t w e e n h a r d w a r e a n d  

s o f t w a r e b y t h e c o m p i l e r a n d c o d e r . T h a t i s o n e o f t h e m a i n a d v a n t a g e o f t h i s  

c a t e g o r y o f l a n g u a g e s : h a r d w a r e a n d s o f t w a r e , a l l t h e s y s t e m i s c o d e d w i t h a s a m e  

l a n g u a g e w h i c h i s n o t l o w l e v e l ( t i m e s a v i n g a n d p r o d u c t i v i t y i n c r e a s i n g ) .  

T h e m a i n S D L s w i t h t h e i r m a i n c h a r a c t e r i s t i c s a r e d e s c r i b i n g i n t h e f o l l o w i n g  

s u b s e c t i o n s .  

S y s t e m - C  

U n l i k e t h e   V H D L   o r  V e r i l o g   l a n g u a g e s w h i c h a r e o n l y m a t e r i a l d e s c r i p t i o n l a n -  

g u a g e s ,   S y s t e m - C   i s h i g h e r l e v e l b e c a u s e i t a l l o w s t h e d e s i g n o f s y s t e m s a t a b e -  

h a v i o u r a l l e v e l .   S y s t e m - C   i s n o t r e a l l y a c o m p l e t e , n e w l a n g u a g e b u t m o r e a n  

e n s e m b l e o f C + + c l a s s e s i n t r o d u c i n g t h e n e c e s s a r y c o n c e p t s f o r d e s i g n i n g m a t e r i a l  

( e . g . t h e c o n c u r r e n c y c o n c e p t ) ( [ C G 0 5 ] ) .   S y s t e m - C   i s a b l e t o d e s i g n m a t e r i a l s y s -  

t e m s , s o f t w a r e s , m i x e d .   S y s t e m - C   i s a d a p t e d t o c o n c e p t i o n o f S o C ( S y s t e m o n  

C h i p ) s y s t e m s . I t a l s o a l l o w s t o s i m u l a t e a n d t o c r e a t e a n i m p l e m e n t a b l e r e p r e s e n -  

t a t i o n .  

I n  S y s t e m - C   , t h e s y s t e m i s a h i e r a r c h y o f o b j e c t s , i . e . m o d u l e s i m b r i c a t e d a n d / o r  

p r o c e s s e s . T h e s e m o d u l e s a r e c o m m u n i c a t i n g b y c h a n n e l s e s t a b l i s h i n g l i n k s b e t w e e n  

p o r t s o f d i e r e n t m o d u l e s .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 49/110

3 . 5 P r o g r a m m i n g a n d s i m u l a t i o n l a n g u a g e s   3 3 

I m p u l s e - C  

I m p u l s e - C   ( [ P T 0 5 ] ) i s b a s e d o n s t a n d a r d A N S I - C s u p p o r t i n g p a r a l l e l p r o g r a m -  

m i n g a n d p r o v i d e s a s o f t w a r e l e v e l o f a b s t r a c t i o n i n p a r t i c u l a r f o r t h e d e v e l o p m e n t o f  

a p p l i c a t i o n s t a r g e t i n g F P G A d e v i c e s . T h e a d v a n t a g e s o f t h e A N S I C f o r p r o g r a m -  

m i n g a r e :  

• I t s u p p o r t s s t a n d a r d C d e v e l o p m e n t t o o l s  

• I t s u p p o r t s m u l t i - p r o c e s s p a r t i t i o n i n g  

• I t i s c o m p a t i b l e w i t h a w i d e r a n g e r a n g e o f F P G A - b a s e d c o m p u t i n g p l a t f o r m s  

I m p u l s e - C   i s a s s o f t w a r e - t o - h a r d w a r e c o m p i l e r :  

•I t o p t i m i z e s C c o d e f o r p a r a l l e l i s m  

• I t g e n e r a t e s H D L , r e a d y f o r F G P G A s y n t h e s i s  

• I t a l s o g e n e r a t e s h a r d w a r e / s o f t w a r e i n t e r f a c e s  

S p e c - C  

S p e c - C   ( [ D ö m 0 3 ] i s a n o t h e r S D L , a l s o c r e a t e d a I r v i n e U n i v e r s i t y ( C a l i f o r n i a )  

l i k e   S y s t e m - C   b u t i t i s c o n s i d e r e d a s l e s s g e n e r a l a s i t s m a i n c o n c u r r e n t   S y s t e m - C  

. I t s m a i n c h a r a c t e r i s t i c s a r e :  

• I t s e x e c u t i o n b e h a v i o u r ( V a l i d a t i o n a n d s i m u l a t i o n )  

• I t s s y n t h e s i s b e h a v i o u r ( p o s s i b i l i t y t o i m p l e m e n t i n s o f t w a r e a n d h a r d w a r e )  

• I t s m o d u l a r i t y ( H i e r a r c h y )  

• I t s u p p o r t s a l l t h e e m b e d d e d s y s t e m s c o n c e p t s  

• I t i s a r e a l l a n g u a g e , n o t o n l y a c l a s s l i b r a r y  

M a t l a b  

a n d S i m u l i n k  

M a t l a b   i s b o t h a p r o g r a m m i n g l a n g u a g e a n d a d e v e l o p m e n t e n v i r o n m e n t ( [ i n c 0 8 c ] ) .  

I t i s u s e d f o r n u m e r i c c a l c u l a t i o n s , a l g o r i t h m i c a n d p r o j e c t d e v e l o p m e n t . I n t h e d o -  

m a i n s o f t h e   F P G A   ,  M a t l a b   i s u s e d w i t h   S i m u l i n k   a s a m u l t i - d o m a i n s i m u l a t i o n  

p l a t f o r m . I t i s a l s o a d y n a m i c s y s t e m s d e s i g n p l a t f o r m .   S i m u l i n k   a l l o w s d e s i g n ,  

s i m u l a t i o n , i m p l e m e n t a t i o n a n d c o n t r o l o f c o m m u n i c a t i o n a n d s i g n a l a n a l y s i s s y s -  

t e m s .  

T h e  S i m u l i n k   e n v i r o n m e n t c a n d e s i g n a s y s t e m , s i m u l a t e i t s b e h a v i o u r , b r e a k u p  

t h e d e s i g n b e f o r e i t s i m p l e m e n t a t i o n .   S i m u l i n k   c a n s i m u l a t e n u m e r i c , a n a l o g i c a l o r  

m i x e d c o m p o n e n t s .  

A s u m m a r y o f a c o m p a r i s o n b e t w e e n a l l l a n g u a g e s a b l e t o b e u s e d i n   F P G A  

p r o g r a m m i n g i s f o u n d i n F i g u r e 3 . 4 , o n p a g e 3 4 .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 50/110

3 4  3 . S y s t e m D e s c r i p t i o n  

F i g u r e 3 . 4 : S y s t e m - l e v e l l a n g u a g e r e q u i r e m e n t s : c o m p a r i s o n b e t w e e n t h e   S p e c - C  

a n d o t h e r l a n g u a g e s p o s s i b l y u s e d i n   F P G A   [ D ö m 0 3 ] .  

3 . 5 . 3 H i g h L e v e l L a n g u a g e s  

H i g h L e v e l L a n g u a g e d e n i t i o n  

A s h o r t d e n i t i o n o f a h i g h - l e v e l p r o g r a m m i n g l a n g u a g e m a y b e t h a t t h i s k i n d  

o f l a n g u a g e i s m o r e a b s t r a c t , e a s i e r t o u s e , o r m o r e p o r t a b l e a c r o s s p l a t f o r m s t h a n  

l o w - l e v e l l a n g u a g e s . H i g h l e v e l l a n g u a g e s a r e s u p p o s e d t o m a k e c o m p l e x p r o g r a m -  

m i n g s i m p l e r a n d l o w l e v e l l a n g u a g e s m a k e m o r e e c i e n t c o d e . T h e y c o n s u m e m o r e  

m e m o r y , h a v e a l a r g e r b i n a r y s i z e a n d a r e s l o w e r t o e x e c u t e . I n f a c t t h e d i e r e n c e  

b e t w e e n l o w a n d h i g h l e v e l l a n g u a g e s c o u l d b e v e r y r e l a t i v e , o r i g i n a l l y , C l a n g u a g e  

w a s c o n s i d e r e d a s h i g h l e v e l l a n g u a g e a n d n o w d e p e n d i n g o n t h e c o n t e x t , i t c a n b e  

a l s o c o n s i d e r e d a s a l o w l e v e l l a n g u a g e b e c a u s e i t s t i l l a l l o w s m e m o r y t o b e a c c e s s e d  

b y a d d r e s s , a n d p r o v i d e s d i r e c t a c c e s s t o t h e a s s e m b l e r l e v e l .  

C L a n g u a g e  

C i s a g e n e r a l - p u r p o s e p r o g r a m m i n g l a n g u a g e w i t h t h e f o l l o w i n g f e a t u r e s ( [ C o m 0 7 ] ) :  

• B l o c k s t r u c t u r e d  

• P r o c e d u r a l  

• I m p e r a t i v e  

• A l l o w i n g l o w - l e v e l a c c e s s t o m e m o r y  

• R e q u i r i n g m i n i m a l r u n - t i m e s u p p o r t  

T h e s e l a n g u a g e s a r e a v a i l a b l e o n c e a s o f t c o r e p r o c e s s o r h a s b e e n i m p l e m e n t e d i n t o  

t h e  F P G A   p l a t f o r m . T a b l e 3 . 5 . 3 , p a g e 3 5 g i v e s a n o v e r v i e w o f t h e p o s s i b i l i t i e s o f c  

l a n g u a g e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 51/110

3 . 5 P r o g r a m m i n g a n d s i m u l a t i o n l a n g u a g e s   3 5 

P r o s C o n s  

b a s e d o n o p e n s t a n d a r d s n o o b j e c t - o r i e n t e d c o n c e p t s  

u s e f e w c o n c e p t s t o e a s e t h e  

p r o g r a m m i n g  

n o e r r o r h a n d l i n g m e c h a n i s m  

i n u e n c e d n u m e r o u s r e c e n t  

l a n g u a g e s s u c h a s C + + / J a v a ,  

P H P 

n o s t a n d a r d g a r b a g e c o l l e c t o r  

a l l o w o r c o d e s o f t w a r e s  

n o t n e e d i n g a n y s u p p o r t  

( l i b r a r i e s , v i r t u a l m a c h i n e )  

b u e r o v e r o w b r e a c h  

H a s a p r e d i c t a b l e c o m p o r t -  

m e n t ( r a m m e m o r y )  

d i c u l t y t o c o d e p o r t a b l e  

c o d e  

T a b l e 3 . 2 : P r o s a n d c o n s o f t h e C l a n g u a g e  

C + + L a n g u a g e  

C + + ( [ W i k a ] ) i s a g e n e r a l - p u r p o s e p r o g r a m m i n g l a n g u a g e , c o m p a t i b l e a s m u c h a s  

p o s s i b l e w i t h t h e C l a n g u a g e . I t s m a i n f e a t u r e s a n d d i e r e n c e s c o m p a r e d t o C a r e :  

• S t a t i c a l l y t y p e d  

• M u l t i - p a r a d i g m  

• N o t p l a t f o r m s p e c i c  

• N o n e e d f o r s o p h i s t i c a t e d p r o g r a m m i n g e n v i r o n m e n t  

• E x c e p t i o n h a n d l i n g  

• T e m p l a t e s  

T h e k e y c o n c e p t o f t h e C + + l a n g u a g e i s t h e o b j e c t o r i e n t e d p r o g r a m m i n g . I t  

a l l o w s c l a s s i c a t i o n , e n c a p s u l a t i o n , c l a s s e s c o m p o s i t i o n , c l a s s e s a s s o c i a t i o n , h e r i t a g e ,  

a b s t r a c t i o n a n d g e n e r i c i t y .  

P y t h o n L a n g u a g e  

P y t h o n ( [ f o u 0 6 ] ) i s a m u l t i - p a r a d i g m , i n t e r p r e t e d l a n g u a g e f o r s t r u c t u r e d i m p e r a -  

t i v e a n d o b j e c t - o r i e n t e d p r o g r a m m i n g . P y t h o n i s a g e n e r a l - p u r p o s e , v e r y h i g h - l e v e l  

p r o g r a m m i n g l a n g u a g e . P y t h o n h a s a l s o a l a r g e v a r i e t y o f l i b r a r i e s a n d i t s c o r e  

s y n t a x i s q u i t e s i m p l e .  

I t s d e s i g n p h i l o s o p h y e m p h a s i z e s p r o g r a m m e r p r o d u c t i v i t y a n d c o d e r e a d a b i l i t y .  

P y t h o n ' s c o r e s y n t a x a n d s e m a n t i c s a r e m i n i m a l i s t , w h i l e t h e s t a n d a r d l i b r a r y i s l a r g e  

a n d c o m p r e h e n s i v e . P y t h o n h a s a a u t o m a t i c m a n a g e m e n t o f t h e m e m o r y ( g a r b a g e  

c o l l e c t o r ) a n d a e x c e p t i o n h a n d l i n g s y s t e m . T h i s l a n g u a g e c a n b e a v a i l a b l e o n c e  

a n e m b e d d e d O S h a s b e e n i m p l e m e n t e d i n t o t h e   F P G A   p l a t f o r m . O n m o s t o f t h e  

e m b e d d e d   O S  , t h e r e i s a p y t h o n i n t e r p r e t o r i n c l u d e d . C o m p a r e d t o o t h e r h i g h l e v e l  

l a n g u a g e s , a k e y a d v a n t a g e o f p y t h o n i s t h e f a c t t h a t i t d o e s n o t n e e d a n y v i r t u a l  

m a c h i n e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 52/110

3 6  3 . S y s t e m D e s c r i p t i o n  

3 . 6 S o f t c o r e p r o c e s s o r s  

T h i s s e c t i o n p r e s e n t s t h e d i e r e n t s o f t c o r e p r o c e s s o r s t h a t c a n b e u s e d o n t h e  

a v a i l a b l e   F P G A   p l a t f o r m s . T h e r e a r e t w o d i s t i n c t p o s s i b i l i t i e s : t h e o c i a l b r a n d e d  

o n e s a n d t h e o p e n s o u r c e o n e s . D e p e n d i n g o n t h e p l a t f o r m u s e d , s o m e o c i a l s o f t c o r e  

p r o c e s s o r s c a n b e f r e e o f c h a r g e . A s t h e c h o i c e i s q u i t e n a r r o w , a l l t h e p o s s i b i l i t i e s  

h a v e b e e n s t u d i e d a n d a r e d i s p l a y e d i n t h e f o l l o w i n g s u b s e c t i o n s .  

3 . 6 . 1   N i o s I I  

T h e  N i o s I I   s o f t c o r e s ( I a n d I I ) [ C o r 0 7 ] a r e s o f t c o r e p r o c e s s o r s o w n e d b y   A l t e r a  

. T h e y t f o r   A l t e r a F P G A   , a r e w e l l d o c u m e n t e d a n d n u m e r o u s e x i s t i n g I P - B l o c  

c a n b e i m p l e m e n t e d i n t o i t . T h e   N i o s I I   s o f t c o r e p r o c e s s o r i s b a s e d o n a R I S C  

3 2 b i t s C o r e s a n d A v a l o n b u s . T h e i m p l e m e n t a t i o n o f t h e   N i o s I I   i n t o t h e F P G A  

i s d o n e v i a Q u a r t u s ( [ I n c 0 8 b ] ) . T h e d e v e l o p m e n t o f t h e c o r e a n d i t s c o m p o n e n t s  

( i p - B l o c s ) i s d o n e v i a S O P C B u i l d e r ( c i t e s o p c ) . T h e d e v e l o p m e n t o f t h e s o f t w a r e i s  

d o n e u n d e r   N i o s I I   I D E ( b a s e d o n E c l i p s e , [ I n c 0 8 a ] ) u s i n g C l a n g u a g e . T h e s e t h r e e  

s o f t w a r e s a r e t h e d e v e l o p m e n t t o o l s p r o v i d e d b y   A l t e r a   t o d e v e l o p a p p l i c a t i o n s o n  

F P G A   . 

3 . 6 . 2 M i c r o b l a z e  

M i c r o b l a z e [ I n c 0 7 ] i s t h e s o f t c o r e p r o c e s s o r d e v e l o p e d b y   X i l i n x   f o r i t s   F P G A  

p l a t f o r m V i r t e x . I t s m a i n f e a t u r e s a r e :  

• I t i s b a s e d o n R I S C a r c h i t e c t u r e  

• B o t h i n s t r u c t i o n a n d d a t a w o r d s a r e 3 2 b i t s  

• M a n y a s p e c t s c a n c o n g u r e d c a c h e s i z e , b u s - i n t e r f a c e s a n d e m b e d d e d p e r i p h -  

e r a l s  

• S p e e d u p t o 2 1 0 M H z o n t h e V i r t e x - 5 F P G A f a m i l y  

• C o n g u r a b l e 3 - s t a g e o r 5 - s t a g e p i p e l i n e  

• V e r y c u s t o m i z a b l e f o r d e s i g n i n g c u s t o m - b u i l t s o f t w a r e .  

T h e X i l i n x E m b e d d e d D e v e l o p m e n t K i t ( E D K ) c o n t a i n s :  

• T h e M i c r o B l a z e c o r e  

• P e r i p h e r a l c o r e s  

• S o f t w a r e d e v e l o p m e n t t o o l s :  

  G N U C C o m p i l e r ( G N U : G n u ' s N o t U n i x i s a n   O S  b a s e d e x c l u s i v e l y f r e e  

a n d o p e n s o u r c e s s o f t w a r e s )  

  G N U D e b u g g e r  

  E c l i p s e I D E  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 53/110

3 . 7 E m b e d d e d   O S  3 7 

3 . 6 . 3 S P A R C a n d L E O N  

S P A R C ( S c a l a b l e P r o c e s s o r A R C h i t e c t u r e ) i s b r a n d o w n e d p a r S P A R C I n t e r n a -  

t i o n a l I n c o r p o r a t i o n a n d s t a n d s f o r a n o p e n m i c r o p r o c e s s o r a r c h i t e c t u r e . I t i s c o n -  

s t r u c t e d o n a R I S C m o d e l w i t h a p i p e l i n e a n d a s f e w f e a t u r e s o r o p - c o d e s a s p o s s i b l e .  

T h i s a r c h i t e c t u r e i s s u p p o r t i n g 6 4 b i t s d a t a a n d m e m o r i e s a d d r e s s e s . S P A R C d e -  

s i g n s a l s o a m i c r o p r o c e s s o r s f a m i l y . S P A R C i s a n a r c h i t e c t u r e w h i c h s p e c i c a t i o n s  

a r e f r e e . A c o m p l e t e l y f r e e o f c o s t p r o c e s s o r u s i n g S P A R C i s L E O N .  

L E O N [ G H C 0 7 ] i s a n o p e n s o u r c e 3 2 b i t s R I S C p r o c e s s o r , S P A R C c o m p a t i b l e . I t s  

m a i n f e a t u r e s a r e :  

• 7 l e v e l s p i p e l i n e  

• D a t a c a c h e a n d i n s t r u c t i o n s s e p a r a t e d  

• C o n g u r a b l e c a c h e  

• M M U 

• B u s i n t e r f a c e A M B A - 2 . 0  

• W o r k s u n t i l 1 2 5 M H z o n F P G A  

3 . 6 . 4 O p e n s o f t c o r e p r o c e s s o r  

T h e o t h e r s o f t c o r e p r o c e s s o r a r e c o n c e n t r a t e d o n t h e W e b s i t e w w w . o p e n c o r e s . c o m .  

T h e r e a r e s o m e n u m e r o u s p r o j e c t s b u t o n l y a f e w d o c u m e n t a t i o n a n d n o I P - B l o c s .  

T h e s e p r o j e c t s c a n b e d e s i g n e d f o r   A l t e r a   ,  X i l i n x   o r o t h e r a r c h i t e c t u r e s . H e r e  

a r e t w o e x a m p l e s o f i n t e r e s t i n g p r o j e c t s f o u n d o n t h i s w e b s i t e .  

D D R S D R A M C o n t r o l l e r C o r e  

T h e D D R S D R A M p r o j e c t ( [ W i n 0 6 ] ) p r o v i d e s a c o n t r o l l e r t o a c c e s s s t a n d a r d  

m e m o r y d e v i c e s l i k e D D R S R A M . T h i s c o n t r o l l e r m a n a g e s t h e i n i t i a l i z a t i o n , t h e a u t o  

r e f r e s h a n d o t h e r c o m m a n d s s u c h l i k e o f c o u r s e R E A D a n d W R I T E . T h e c o n t r o l l e r  

h a s b e e n d e s i g n e d f o r t h e X I L I N X V i r t e x I I .  

S D / M M C B o o t l o a d e r  

T h e S D / M M C B o o t l o a d e r p r o j e c t ( [ L a e 0 7 ] ) m a n a g e s c o n g u r a t i o n a n d b o o t s t r a p -  

p i n g o f F P G A s . T h i s b o o t l o a d e r c o n t r o l S e c u r e D i g i t a l ( S D ) c a r d s o r M u l t i M e d i a C -  

a r d s ( M M C ) w h i c h a r e o p e r a t e d i n S P I m o d e ( a v o i d i n g d e d i c a t e d i m p l e m e n t a t i o n s ) .  

T h i s b o o t l o a d e r i s d e s i g n e d i n i t i a l l y f o r t h e X i l i n x S p a r t a n I I e o n B u r c h E D ' s B 5 -  

X 3 0 0 b o a r d . M a n y d i e r e n t s i z e d , d i e r e n t b r a n d s S D a n d M M C c a r s h a v e t e s t e d  

s u c c e s s f u l l y b u t n o t a l l .  

3 . 7 E m b e d d e d   O S 

T h i s s e c t i o n w i l l p r e s e n t t h e d i e r e n t e m b e d d e d   O S  t h a t c a n b e u s e d o n t h e a v a i l a b l e  

F P G A   p l a t f o r m s .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 54/110

3 8  3 . S y s t e m D e s c r i p t i o n  

3 . 7 . 1   u C L i n u x  

u C L i n u x   m e a n s " M i c r o C o n t r o l l e r L i n u x " . I t i s a f o r k o f t h e L i n u x K e r n e l d e s i g n e d  

f o r M i c r o c o n t r o l l e r s w i t h o u t M M U ( m e m o r y m a n a g e m e n t u n i t ) b u t n o w i t c o v e r s  

m o r e p r o c e s s o r a r c h i t e c t u r e s s t i l l w i t h o u t M M U l i k e   F P G A   p l a t f o r m s .  

3 . 7 . 2 e C o s  

E c o s i s u s e d t o d e s i g n s o f t w a r e s w i t h s t r o n g c o n s t r a i n t s o f r e s p o n s e t i m e a n d  

r e a c t i v i t y . E c o s i s v e r y c o n g u r a b l e , a l l o w i n g g o o d r u n - t i m e p e r f o r m a n c e s o p t i m i s e d  

h a r d w a r e r e s o u r c e f o o t p r i n t . A t t h e b e g i n n i n g d e v e l o p e d b y C y g n u s , E c o s i s n o w a  

f r e e s o f t w a r e d e v e l o p e d b y a c o m m u n i t y e n s u r i n g o n - g o i n g t e c h n i c a l i n n o v a t i o n a n d  

p l a t f o r m s u p p o r t .  

3 . 7 . 3   M i c r o C / O S - I I  

M i c r o C / O S - I I [ L a b 0 2 ] ( c o m m o n l y w r i t t e n  µ

C / O S - I I o r u C / O S - I I ) i s a l o w - c o s t  

r e a l - t i m e   O S  f o r m i c r o p r o c e s s o r s . I t i s n o w e x t e n d e d t o o t h e r p l a t f o r m s . I t i s  

w r i t t e n i n A N S I - C f o r m a x i m u m p o r t a b i l i t y . T h e s o c i e t y , M i c r i u m I n c o r p o r a t i o n ,  

d e v e l o p i n g t h i s   O S  a l s o c r e a t e d l o t s o f m i d d l e w a r e s f o r i t l i k e u C / C A N , u C / T C P - I P ,  

u C / F S , u C / G U I , u C / M O D - B U S , u C / L C D , u C / U S B f o r e x a m p l e .   M i c r o C / O S - I I  

i s s u i t a b l e f o r u s e i n s a f e t y c r i t i c a l e m b e d d e d s y s t e m s s u c h a s a v i a t i o n , m e d i c a l  

s y s t e m s a n d n u c l e a r i n s t a l l a t i o n s .  

3 . 8 C h o i c e s m a d e t o m e e t t h e c o n s t r a i n t s a n d r e q u i r e -  

m e n t s  

A f t e r d e n i n g a l l t h e d i e r e n t o p t i o n s a v a i l a b l e f o r i m p l e m e n t i n g t h e p r o j e c t , s o m e  

o p t i o n s h a v e b e e n s e l e c t e d t o t t h e r e q u i r e m e n t s a n d c o n s t r a i n t s . I n t h e f o l l o w i n g  

s u b s e c t i o n s a r e p r e s e n t e d t h e c h o s e n o p t i o n s i n t h e f o l l o w i n g c a t e g o r i e s :  

• F P G A   p l a t f o r m  

• C a m e r a s e n s o r  

• s o f t c o r e p r o c e s s o r  

•P r o g r a m m i n g l a n g u a g e s  

• E m b e d d e d   O S 

3 . 8 . 1   F P G A   p l a t f o r m  

T h e c h o s e n   F P G A   p l a t f o r m i s t h e   A l t e r a   D E 2 B o a r d w i t h   C y c l o n e I I   p r o -  

c e s s o r . T h e r e a s o n s o f t h i s c h o i c e a r e :  

• A c a m e r a s e n s o r h a s b e e n d e s i g n e d b y   T e r a s i c   f o r t h i s p l a t f o r m ( 1 . 3 M e g a  

P i x e l D i g i t a l C a m e r a D e v e l o p m e n t P a c k a g e ) , a n d i s a v a i l a b l e i n t h e e m b e d d e d  

s y s t e m l a b .  

• T h e e x a m p l e s ' a v a i l a b i l i t y o n h o w t o u s e t h e c a m e r a  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 55/110

3 . 8 C h o i c e s m a d e t o m e e t t h e c o n s t r a i n t s a n d r e q u i r e m e n t s   3 9 

• A m o d u l a r P r o c e s s o r a n d s y n t h e s i s a b l e o n e ( s o f t c o r e p r o c e s s o r ) a v a i l a b l e w i t h  

s u i t e d t o o l s a n d s o f t w a r e s .  

•T h e p r e s e n c e o f a s o c k e t f o r t h e c a m e r a s e n s o r .  

• I t i s a n e d u c a t i o n b o a r d m e a n i n g t h a t i t s h o u l d b e w e l l d o c u m e n t e d a n d w i t h  

s u p p o r t s .  

• J T A G c a b l e s ( f o r   F P G A   p r o g r a m m i n g a n d s o f t c o r e p r o c e s s o r d e b u g i n g )  

• T h e e x a m p l e s ' a v a i l a b i l i t y o n h o w t o u s e t h e c a m e r a  

F o r t h e p r e v i o o u l s y e n u m e r a t e d r e a s o n s , t h i s   F P G A   p l a t f o r m t s t h e r e q u i r e m e n t s  

i n t e r m s o f p o s s i b i l i t i e s , s p a c e a n d t i m e c o n s t r a i n t s .  

3 . 8 . 2 C a m e r a s e n s o r  

T h e c a m e r a s e n s o r s e l e c t e d f o r t h i s p r o j e c t i s t h e T R D B - D C 2 p r o d u c e d b y   T e r a -  

s i c  ( [ T e c 0 6 ] ) . I t i s a 1 . 3 m e g a p i x e l c a m e r a s e n s o r a n d i s p a r t o f t h e 1 . 3 M e g a P i x e l  

D i g i t a l C a m e r a D e v e l o p m e n t P a c k a g e . I t s m a i n i n t e r e s t i n g f e a t u r e s a r e :  

• T h e q u a l i t y i s t t i n g t h e r e q u i r e m e n t s : r e s o l u t i o n i s s u c i e n t f o r t h e t a r g e t e d  

s u r v e i l l a n c e a p p l i c a t i o n  

• W i r e s a n d c o n n e c t o r s a r e t t i n g t h e o n e s o f t h e   F P G A   p l a t f o r m  

• T h e a v a i l a b i l i t y o f e x a m p l e s u s i n g t h e c a m e r a a n d t h e   F P G A   p l a t f o r m  

3 . 8 . 3 P r o g r a m m i n g l a n g u a g e s  

C u r r e n t l y   V e r i l o g   a n d C l a n g u a g e a r e t h e t w o l a n g u a g e s u s e d i n t h i s p r o j e c t .  

T h e c h o i c e o f t h e s e t w o l a n g u a g e s h a s b e e n d o n e w i t h i n t h e o w o f t h e H a r d w a r e / -  

S o f t w a r e C o - D e s i s g n . T h e s e t w o l a n g u a g e s a r e c o r r e s p o n d i n g t o t h e p a r t i t i o n i n g .  

T h e  V e r i l o g   i s u s e d f o r t h e a c q u i s i t i o n c h a i n w h i c h i s t h e h a r d w a r e p a r t o f t h e  

p r o j e c t , w h i l e t h e C l a n g u a g e i s u s e d t h a n k s t o t h e   N i o s I I   ( 3 . 8 . 4 ) f o r t h e m o t i o n  

d e t e c t i o n p a r t ( s o f t w a r e ) .  

T h e y w e r e t w o m a i n r e a s o n s f o r t h e c h o i c e o f t h e   V e r i l o g   . T h e r s t o n e w a s t h e  

f a c t t h a t t h e c a m e r a s e n s o r e x a m p l e s w e r e c o d e d o n l y i n   V e r i l o g   . T h e o t h e r o n e  

i s t h e s i m i l a r i t y b e t w e e n t h e   V e r i l o g   a n d t h e C l a n g u a g e s c o m p a r e d t o t h e   V H D L  

( s a m e s y n t a x , s i m i l a r i t y f o r t h e l o o p m e c h a n i s m s ) .  

T h e m a i n r e a s o n s f o r t h e c h o i c e o f t h e C l a n g u a g e a r e :  

• I t i s t h e l a n g u a g e a v a i l a b l e w i t h o u t a n y c o n g u r a t i o n c o m p a r e d t o C + + l a n g u a g e  

w h e n u s i n g a s o f t c o r e p r o c e s s o r  

• T h e p r o j e c t t e a m h a d a l r e a d y s o m e k n o w l e d g e a b o u t C p r o g r a m m i n g .  

• I t i n t r o d u c e s a l i m i t e d o v e r h e a d c o m p a r e d t o o t h e r h i g h l e v e l l a n g u a g e s  

• I t p r o v i d e s a n e a s i e r w a y t o h a n d l e m e m o r y m a n a g e m e n t , w h i l e s t i l l a l l o w i n g  

s o m e l o w - l e v e l a c c e s s t o t h e m e m o r y .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 56/110

4 0  3 . S y s t e m D e s c r i p t i o n  

• I t i s a p o r t a b l e l a n g u a g e , t h e a l g o r i t h m c a n b e d e v e l o p e d i n C o n d e s k t o p  

c o m p u t e r ( p r o l e d , d e b u g g e d ) a n d t h e n p o r t e d o n t o t h e t a r g e t e d p l a t f o r m  

•M o s t o f t h e t o o l s u s e d t o d e v e l o p e d o n t o t h e t a r g e t e d p l a t f o r m a r e c o m m o n  

w i t h d e s k t o p d e v e l o p m e n t t o o l s ( E c l i p s e I D E a n d t h e G N U t o o l c h a i n i n c l u d i n g  

G N U C C o m p i l e r , G N U D e b u g g e r )  

C o n c e r n i n g t h e S D L s , i t h a s d e c i d e d n o t t o u s e t h e m f o r s o m e k i n d s o f r e a s o n s :  

• F o r t h e   H a n d e l - C   , s o m e l i c e n s e p r o b l e m s h a v e b e e n e n c o u n t e r e d  

• F o r t h e   S p e c - C   , i t w a s i m p o s s i b l e t o m a k e t h e c o m p i l e r w o r k i n t h e L i n u x  

d e v e l o p m e n t c o m p u t e r s  

• F o r t h e   I m p u l s e - C   , t h e r e s e a r c h e s m a d e s h o w n t h a t t h i s l a n g u a g e i s t o o  

s p e c i c , w i t h l e s s d o c u m e n t a t i o n a n d l e s s e x a m p l e s a s t h e p r e v i o u s , i t a p p e a r s  

h a v i n g n o m o r e s p e c i a l f e a t u r e c o m p a r e d t o t h e p r e v i o u s o n e s f o r t h e p r o j e c t .  

M o r e o v e r , t h e m o s t i m p o r t a n t r e a s o n s n o t t o u s e t h e s e l a n g u a g e s a r e m o r e g e n e r a l .  

A l l t h e s e l a n g u a g e s n e e d s s o m e l e a r n i n g t i m e t o b e c o m e e c i e n t w h i l e p r o g r a m m i n g  

w i t h t h e m . A f t e r t h a t , a l l t h e t o o l s n e e d s c o m p i l e r s t h a t c a n n o t b e m o r e r e l i a b l e  

t h a n t h e o n e s p r o v i d e d b y t h e s o c i e t y b u i l d i n g t h e   F P G A   p l a t f o r m a n d / o r t h e  

s o f t c o r e p r o c e s s o r a n d s o m e t i m e s d o n o t w o r k t h e t h e   S p e c - C   c o m p i l e r w i t h d e s k t o p  

c o m p u t e r s .  

L a s t b u t n o t l e a s t , f o r t h e s a m e r e a s o n s a s i n t h e l a s t p a r a g r a p h , t h e r e w e r e n o  

n e e d s o f p y t h o n b e c a u s e i t r e q u i r e d a e m b e d d e d   O S  w h i c h i s h a r d e r t o i m p l e m e n t  

c o m p a r e d t o a s o f t c o r e p r o c e s s o r a n d r e q u i r e a m u c h h i g h e r o v e r h e a d i n t e r m o f  

r e s o u r c e s ' u s e . P y t h o n s p e c i a l f e a t u r e s a r e n o t n e e d e d i n t h i s p r o j e c t a n d a s f o r  

e v e r y n e w p r o g r a m m i n g l a n g u a g e , t h e r e i s a l s o t h e p r o b l e m o f t h e l e a r n i n g c u r v e .  

3 . 8 . 4 s o f t c o r e p r o c e s s o r  

A s t h e p r o j e c t w a s p r o g r e s s i n g , t h e n e e d f o r a s o f t c o r e p r o c e s s o r h a s b e c a m e  

c l e a r e r . I n d e e d , a f t e r a l o n g t i m e o f w o r k o n   V e r i l o g   l a n g u a g e w i t h t h e c a m e r a  

s e n s o r a n d t h e m e m o r i e s , t h e c o n c l u s i o n w a s t h a t i t w a s n o t p o s s i b l e t o r e a l i z e t h e  

p r o j e c t w i t h i n t h e m e e t i n g d e a d l i n e s u s i n g t h i s l a n g u a g e . E v e n w i t h t h e   F P G A  

e x a m p l e s p r o v i d e d b y   A l t e r a   , t h e y w e r e s t i l l s o m e f u n c t i o n s w h o s e c o d e w a s n o t  

a v a i l a b l e , f o r e x a m p l e , t h e s t a c k f u n c t i o n f o r t h e m e m o r i e s ( S D R A M , S R A M ) . T h e  

s e c o n d m a i n r e a s o n w a s t h e l a c k o f d o c u m e n t a t i o n c o n c e r n i n g t h e n e e d e d f u n c t i o n s ,  

e s p e c i a l l y t h e o n e s i n v o l v e d i n t o t h e m e m o r i e s m a n a g e m e n t . T h i s c o n c e r n s a l s o  

e x a m p l e s , l o t o f t h e   A l t e r a   e x a m p l e s o n t h e i r C D w e r e n o t w o r k i n g o n t h e c h o s e n  

b o a r d . M o r e o v e r t h e f r e e e x a m p l e s o f a s h m e m o r y m a n a g e m e n t u s i n g   V e r i l o g  

l a n g u a g e t h a t c a n b e f o u n d o n i n t e r n e t a r e a l s o i n c o m p l e t e o r b u g g e d .  

B u t t h i s d e c i s i o n t o u s e s o f t w a r e i s n o t o n l y d u e t o t h e d i s a d v a n t a g e s o f p r o g r a m -  

m i n g w i t h o u t s o f t c o r e p r o c e s s o r . A s s a i d b e f o r e u s i n g a s o f t c o r e p r o c e s s o r a l l o w s  

t o u s e   C / C + +   a n d o t h e r o b j e c t - o r i e n t e d l a n g u a g e s a n d t o w o r k a t a h i g h e r l e v e l  

o f a b s t r a c t i o n . O n t h e o t h e r h a n d , i t n e e d s a n o t h e r w a y t o t h i n k t h e a r c h i t e c t u r e  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 57/110

3 . 8 C h o i c e s m a d e t o m e e t t h e c o n s t r a i n t s a n d r e q u i r e m e n t s   4 1 

o f t h e s y s t e m . U s i n g a s o f t c o r e p r o c e s s o r m e a n s u s i n g h a r d w a r e / s o f t w a r e c o - d e s i g n  

m e t h o d o l o g y .  

A f t e r s o m e r e s e a r c h e s , t h e c o n c l u s i o n t h a t t h e o p e n c o r e s d i d n o t t t h e p r o j e c t  

r e q u i r e m e n t s b e c a u s e t h e y i s a l a c k o f s u p p o r t / m a n u a l s . T h e y a r e a l s o n o t d e s i g n e d  

f o r t h e c h o s e n   F P G A   p l a t f o r m a n d d o n o t h a v e s o m e n e e d e d f e a t u r e s a s G P I O  

m a n a g e m e n t ( G e n e r a l P u r p o s e I n p u t O u p u t ) f o r e x a m p l e ( T h e o p e n c o r e p r o j e c t s  

w e r e n o t t a r g e t i n g t h e D E 2 p l a t f o r m , w e r e n o t u p t o d a t e o r w e r e n o t u s i n g t h e  

r e q u i r e d f u n c t i o n s ) .  

H e r e a r e t h e r e a s o n s t o u s e t h e   N i o s I I   : 

• I t i s t h e s o f t c o r e p r o c e s s o r d e d i c a t e d t o t h e s e l e c t e d   F P G A   p l a t f o r m , b o t h  

A l t e r a   p r o d u c t s  

• I t i s s u p p o r t e d b y b o t h t h e Q u a r t u s I I s o f t w a r e a n d S O P C b u i l d e r s o f t w a r e  

f r o m   A l t e r a   w h i c h s h o u l d p r o v i d e a t h i g h a n d e a s i e r i n t e g r a t i o n i n t o t h e  

p l a t f o r m , w h i c h i s r e l e v a n t g i v e n t h e t i m e f r a m e .  

• I t a l l o w s t o u s e C a n d C + + l a n g u a g e s  

• I t i s d o c u m e n t e d a n d t h e r e a r e s o m e i n f o r m a t i o n e x a m p l e s a n d f o r u m s o n t h e  

i n t e r n e t .  

• I t h a s t h e 3 2 b i t s i n s t r u c t i o n c a c h e l i k e d e s k t o p c o m p u t e r s .  

• I t u s e s t h e d e v e l o p m e n t c h a i n G N U b a s e d o n E c l i p s e ( A p r o j e c t p r o v i d i n g a  

u n i v e r s a l o p e n - s o u r c e t o o l - s e t f o r d e v e l o p m e n t ) d u e t o a n A N S I - C i m p l e m e n -  

t a t i o n o n t h e   N i o s I I   . 

• t h e r e s o u r c e s ( C y c l o n e I I , S R A M , S D R A M , F L A S H m e m o r i e s , L C D s c r e e n  

a n d s o o n ) a n d t h e a r c h i t e c t u r e s s e e m e d t o b e s u c i e n t e n o u g h f o r t h e p r o j e c t  

• p o s s i b i l i t y t o a c c e l e r a t e s o m e f u n c t i o n s ( C 2 H t e c h n o l o g y ) : a t o o l p r o v i d e d a s  

p a r t o f   A l t e r a   t o o l s c h a i n w h i c h a i m s t o f a c i l i t a t e t h e h a r d w a r e o p t i m i s a t i o n  

o f C f u n c t i o n b y c r e a t i n g t h e r e q u i r e d c o m p o n e n t d i r e c t l y i n H D L . T h i s t o o l  

i s s u p p o s e d t o e a s e H a r d w a r e / S o f t w a r e C o - D e s i s g n m a p p i n g p r o c e s s .  

• S y s t e m d e s i g n e r s c a n c r e a t e t h e i r o w n c u s t o m p e r i p h e r a l s t h a t c a n b e i n t e -  

g r a t e d w i t h i n   N i o s I I   p r o c e s s o r s y s t e m s . F o r p e r f o r m a n c e - c r i t i c a l s y s t e m s  

t h a t s p e n d m o s t C P U c y c l e s e x e c u t i n g a s p e c i c s e c t i o n o f c o d e , i t i s a c o m -  

m o n t e c h n i q u e t o c r e a t e a c u s t o m p e r i p h e r a l t h a t i m p l e m e n t s t h e s a m e f u n c t i o n  

i n h a r d w a r e .  

S o t h e   N i o s I I   , a n o t h e r   A l t e r a   p r o d u c t i s w e l l d o c u m e n t e d a n d t s t h e p r o j e c t ' s  

r e q u i r e m e n t s . T h i s s o f t c o r e p r o c e s s o r i s t h e o c i a l o n e f o r t h e D E 2   A l t e r a   b o a r d  

a n d e v e n w i t h t h a t s e c u r i t y , t h e r e a r e s t i l l s o m e c o s t c o n s u m i n g n o t - s o - d o c u m e n t e d  

b u g s .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 58/110

4 2  3 . S y s t e m D e s c r i p t i o n  

3 . 8 . 5 E m b e d d e d   O S 

F o r t h i s p r o j e c t , n o e m b e d d e d   O S  h a s b e e n i n t e g r a t e d . T h e r e a s o n s a r e q u i t e  

s i m p l e . T h e m a i n a d v a n t a g e o f a n e m b e d d e d   O S  i s t h e p o s s i b i l i t y t o u s e h i g h e r l e v e l  

l a n g u a g e s b u t t h e r e i s n o n e e d t o u s e t h e s e l a n g u a g e s , n e i t h e r f o r t h e a c q u i s i t i o n  

c h a i n n o r f o r t h e m o t i o n d e t e c t i o n a l g o r i t h m . S o i n t e g r a t i n g a e m b e d d e d   O S  w o u l d  

h a v e b e e n l e s s u s e f u l a n d w o u l d h a v e a d d e d c o m p l e x i t y a n d p r o b a b l y o v e r h e a d w h i c h  

c o u l d h a v e s l o w e d d o n e t h e w h o l e a p p l i c a t i o n [ L u , S e c t i o n I V : R e s u l t s ] . F u r t h e r m o r e ,  

i m p l e m e n t i n g a e m b e d d e d   O S  o n t h e   F P G A   i s a l o n g , a n d c o m p l e x t a s k w i t h a n o t  

n e g l i g i b l e e r r o r r a t e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 59/110

Chapter4M o t i o n D e t e c t i o n A l g o r i t h m        

F i g u r e 4 . 1 : L o c a t i o n i n t h e  A3

m o d e l h i g h l i g h t e d b y t h e p u r p l e c i r c l e , t h e a l g o r i t h m  

s t u d i e d i n t h i s c h a p t e r i s e n c i r c l e d b y t h e d o t e d l i n e  

T h e p u r p o s e o f t h i s c h a p t e r i s t o p r o v i d e a n o v e r v i e w o f t h e m o t i o n d e t e c t i o n  

a l g o r i t h m d e v e l o p m e n t .  

4 3 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 60/110

4 4  4 . M o t i o n D e t e c t i o n A l g o r i t h m  

( a ) G l o b a l l o c a t i o n ( b ) E l a b o r a t e d l o c a t i o n  

F i g u r e 4 . 2 : L o c a t i o n i n t h e R u g b y M e t a - M o d e l .  

4 . 1 D e n i t i o n  

A s p r e v i o u s l y s t a t e d , o n e o f t h e p r o j e c t ' s c o n t e x t i s a x e d v i d e o c a m e r a o b s e r v i n g  

d y n a m i c e v e n t s i n a s c e n e . T h i s f a c t h a s b e e n t a k e n i n t o a c c o u n t w h i l e e x p l o r i n g t h e  

b r o a d v a r i e t y o f m o t i o n d e t e c t i o n a l g o r i t h m s o n e c a n n d i n t h e l i t e r a t u r e . B a c k -  

g r o u n d s u b t r a c t i o n m e t h o d i s a c o m m o n u s e d a p p r o a c h f o r d e t e c t i n g m o v i n g o b j e c t s  

i n v i d e o s f r o m s t a t i c c a m e r a s [ P i c 0 4 a ] .  

C o m m o n a p p l i c a t i o n s o f i m a g e d i e r e n c i n g i n c l u d e o b j e c t t r a c k i n g , v e h i c l e s u r v e i l -  

l a n c e s y s t e m s , a n d i n t e r f r a m e d a t a c o m p r e s s i o n . T h e r e a r e a l s o m a n y e x a m p l e s o f  

i t s u s e f o r a n a l y s i n g s a t e l l i t e i m a g e s t o m e a s u r e l a n d e r o s i o n , d e f o r e s t a t i o n , u r b a n  

g r o w t h , c r o p d e v e l o p m e n t a n d f o r a n a l y s i n g m e d i c a l i m a g e s t o m e a s u r e c e l l d i s t r i b u -  

t i o n .  

T h e m a i n i d e a b e h i n d t h i s a p p r o a c h i s t h a t o f d e t e c t i n g t h e m o v i n g o b j e c t s f r o m  

t h e d i e r e n c e b e t w e e n t h e c u r r e n t f r a m e a n d a r e f e r e n c e f r a m e , o f t e n c a l l e d t h e  

b a c k g r o u n d i m a g e , o r b a c k g r o u n d m o d e l . A s a b a s i c , t h e b a c k g r o u n d i m a g e m u s t  

b e a r e p r e s e n t a t i o n o f t h e s c e n e w i t h n o m o v i n g o b j e c t s a n d m u s t b e k e p t r e g u l a r l y  

u p d a t e d s o a s t o a d a p t t o t h e v a r y i n g l u m i n a n c e c o n d i t i o n s a n d g e o m e t r y s e t t i n g s .  

T h e r e f o r e t h e f o u n d a t i o n o f t h e a l g o r i t h m c a n b e s u m m a r i z e d b y t h e f o l l o w i n g  

e q u a t i o n ( 4 . 1 ) :  

|Framei − Backgroundi| > T hreshold ( 4 . 1 )  

w h e r e  Framei i s t h e c u r r e n t f r a m e c a p t u r e d b y t h e v i d e o c a m e r a ,  

Backgroundi i s 

t h e a c t u a l b a c k g r o u n d a n d  Threshold

i s t h e t h r e s h o l d l e v e l d i e r e n t i a t i n g m o t i o n  

p i x e l s f r o m b a c k g r o u n d p i x e l s  

R e f e r e n c e i m a g e s c a n b e g e n e r a t e d b y a v a r i e t y o f m e t h o d s , e . g . o n a b a c k g r o u n d  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 61/110

4 . 2 A n a l y s i s   4 5 

i m a g e a c q u i r e d d u r i n g a p e r i o d o f r e l a t i v e i n a c t i v i t y w i t h i n t h e s c e n e o r f r o m a  

t e m p o r a l l y a d j a c e n t i m a g e f r o m a d y n a m i c s e q u e n c e .  

4 . 2 A n a l y s i s  

T o a n s w e r t h e p r o b l e m s t a t e m e n t (  I s i t p o s s i b l e t o i m p l e m e n t a n i n t e l l i g e n t  

I P v i d e o s u r v e i l l a n c e c a m e r a o n a n  F P G A  

p l a t f o r m t o o p t i m i z e v i d e o  

s u r v e i l l a n c e ?   ) , t h e r e s e a r c h o f a p r o p e r a l g o r i t h m a b l e t o s o l v e t h e i n t e l l i g e n t p a r t  

o f t h e s y s t e m w a s f o c u s e d o n t h e f o l l o w i n g r e q u i r e m e n t :  

• S i m p l e M e t h o d : I f a n a p p a r e n t l y s t r a i g h t f o r w a r d m e t h o d i s a l r e a d y h a r d  

e n o u g h t o i m p l e m e n t , a m o r e e l a b o r a t e d o n e c o u l d p r e v e n t t o a n s w e r t h e q u e s -  

t i o n i n t h e g i v e n t i m e f r a m e .  

• L o w m e m o r y r e q u i r e m e n t : T h e c h o s e n   F P G A   p l a t f o r m (  A l t e r a   D E 2 B o a r d  

w i t h   C y c l o n e I I   p r o c e s s o r ) h a s a l i m i t e d e m b e d d e d a v a i l a b l e m e m o r y .  

A m o r e t h o r o u g h i n v e s t i g a t i o n o f t h e M o t i o n D e t e c t i o n a l g o r i t h m c a n b e f o u n d i n  

t h e r e v i e w l i k e [ P i c 0 4 a ] o r [ C G P P 0 3 ] .  

T h e r s t m e t h o d r e v i e w e d i s t h e b a c k g r o u n d a s t h e   a v e r a g e   (  a s i n g l e v a l u e ( a s  

a m e a n o r m e d i a n ) t h a t s u m m a r i z e s o r r e p r e s e n t s t h e g e n e r a l s i g n i c a n c e o f a s e t  

o f u n e q u a l v a l u e s  ) o r t h e   m e d i a n   (  a m e d i a n i s d e s c r i b e d a s t h e n u m b e r s e p a r a t i n g  

t h e h i g h e r h a l f o f a s a m p l e , a p o p u l a t i o n , o r a p r o b a b i l i t y d i s t r i b u t i o n , f r o m t h e  

l o w e r h a l f .  ) o f t h e p r e v i o u s  n

f r a m e s . T h i s m e t h o d i s r a t h e r f a s t , b u t v e r y m e m o r y  

c o n s u m i n g d u e t o t h e m e m o r y r e q u i r e m e n t n e e d e d t o c a l c u l a t e t h e a v e r a g e o f t h o s e  

n f r a m e s . T h e m e m o r y r e q u i r e m e n t i s   n ∗ size(frame), t h e m o r e f r a m e i s u s e d t o  

c a l c u l a t e t h e a v e r a g e t h e m o r e t h e a l g o r i t h m i s g o i n g t o b e p r e c i s e b u t t h e m o r e  

m e m o r y i t w i l l u s e .  

T h e s e c o n d a l g o r i t h m s t u d i e d i s t h e b a c k g r o u n d a s t h e   r u n n i n g a v e r a g e  (  A s e r i e s o f  

s u c c e s s i v e a v e r a g e s o f a d e n e d n u m b e r o f v a r i a b l e s  ) . T h i s m e t h o d c a n b e c a l c u l a t e d  

b y t h e e q u a t i o n 4 . 2 :  

Bi + 1 = α ∗ F i + (1 − α) ∗ Bi ( 4 . 2 )  

W h e r e  Bi i s t h e c u r r e n t b a c k g r o u n d ,  

F i i s t h e c u r r e n t f r a m e a n d  α

i s t h e l e a r n i n g  

r a t e ( t y p i c a l l y 0 . 0 5 [ P i c 0 4 b ] ) T h i s w a y t h e m e m o r y r e q u i r e m e n t i s l o w e r t h a n t h e  

p r e v i o u s a l g o r i t h m 4 . 2 .  

A n o t h e r m e t h o d i s b a s e d o n t h e p i x e l ' s r e c e n t h i s t o r y t o c r e a t e t h e b a c k g r o u n d .  

S u c h h i s t o r y i s o f t e n :  

•  j u s t t h e p r e v i o u s   n f r a m e s  

• a w e i g h t e d a v e r a g e w h e r e r e c e n t f r a m e s h a v e h i g h e r w e i g h t  

T h e b a c k g r o u n d m o d e l i s c a l c u l a t e d a s a c h r o n o l o g i c a l a v e r a g e f r o m t h e p i x e l ' s h i s -  

t o r y . T h i s h i s t o r y i s o f t e n b a s e d o n a n h i s t o g r a m (  a m a p p i n g  

mit h a t c o u n t s t h e  

n u m b e r o f o b s e r v a t i o n s t h a t f a l l i n t o v a r i o u s d i s j o i n t c a t e g o r i e s  ) . 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 62/110

4 6  4 . M o t i o n D e t e c t i o n A l g o r i t h m  

4 . 3 D e s i g n  

F r a m e d i e r e n c i n g i s a p a r t i c u l a r l y e c i e n t a n d s e n s i t i v e m e t h o d f o r d e t e c t i n g g r e y  

l e v e l c h a n g e s b e t w e e n i m a g e s w h i c h a r e c o - r e g i s t e r e d . M o t i o n i s d e t e c t e d b y d i e r -  

e n c i n g a r e f e r e n c e a n d t h e c u r r e n t i m a g e f r a m e a n d a p p l y i n g a c e r t a i n T h r e s h o l d  

t o t h i s d i e r e n c e ( 4 . 3 ) .  

|Framei − Framei−1| ≥ T h ( 4 . 3 )  

w h e r e  Framei i s t h e c u r r e n t f r a m e c a p t u r e d b y t h e v i d e o c a m e r a ,  

Framei−1 i s p r e -  

v i o u s c a p t u r e d f r a m e a n d  T h

i s t h e t h r e s h o l d l e v e l d i e r e n t i a t i n g m o t i o n p i x e l s  

f r o m b a c k g r o u n d p i x e l s  

T h e f r a m e d i e r e n c i n g a l g o r i t h m m a y b e s u b - d i v i d e d i n t o t h r e e p a r t s [ P i c 0 4 b ] :  

1 . t h e g e n e r a t i o n o f a s u i t a b l e r e f e r e n c e o r b a c k g r o u n d  

2 . t h e a r i t h m e t i c s u b t r a c t i o n o p e r a t i o n  

3 . t h e s e l e c t i o n ( a n d a p p l i c a t i o n ) o f a s u i t a b l e t h r e s h o l d  

4 . 3 . 1 B a c k g r o u n d G e n e r a t i o n  

T h e r s t t a s k i s t h e n t o g e n e r a t e t h e b a c k g r o u n d i m a g e  Bx,y f r o m a s e q u e n c e o f  

f r a m e s  I tx,y w h i c h m a y c o n t a i n m o v i n g o b j e c t s .  

I tx,y b e i n g t h e p i x e l v a l u e a t t h e  x, y

l o c a t i o n i n c a p t u r e d f r a m e a t a g i v e n t i m e   t a n d  Btx,y t h e e x t r a c t e d b a c k g r o u n d .  

T h e F P G A D E 2 B o a r d u s e d e m b e d s a l i m i t e d a m o u n t o f a v a i l a b l e m e m o r y t o u s e ,  

s o t h e d e t e c t i o n o f t h e b a c k g r o u n d m u s t n o t b e v e r y m e m o r y c o n s u m i n g . T h e r e f o r e ,  

o n e o f t h e l e a s t m e m o r y c o n s u m i n g w a y o f a c h i e v i n g t h e b a c k g r o u n d ' s c r e a t i o n i s t o  

e s t i m a t e t h e b a c k g r o u n d f r o m t h e p r e v i o u s f r a m e ( 4 . 4 ) .  

Bi = Framei−1 ( 4 . 4 )  

T h e f o l l o w i n g s t e p i s t o t r a n s f o r m b o t h t h e b a c k g r o u n d   Bx,y a n d t h e c u r r e n t f r a m e  

I x,y i n t o t h e i r g r e y s c a l e v e r s i o n . A s b o t h o f t h o s e i m a g e a r e c o d e d i n a 8 b i t s R G B  

c o l o u r s w e u s e t h e f o l l o w i n g g r e y s c a l e c o n v e r s a t i o n ( 4 . 5 ) :  

Greyx,y = (299 · Redx,y + 587 · Bluex,y + 114 · Greenx,y)1000

( 4 . 5 )  

T h e n e a c h o f t h e 8 b i t c o d e d c o l o u r i s r e p l a c e d b y t h e n e w g r e y v a l u e . T h e s e l e c t e d  

c o e c i e n t s a r e f r o m t h e 6 0 1 s t r e c o m m e n d a t i o n o f t h e C I E ( I n t e r n a t i o n a l C o m m i s s i o n  

o n I l l u m i n a t i o n ) [ o I ]  

S u b s e q u e n t l y , t h e   a r i t h m e t i c s u b t r a c t i o n o p e r a t i o n   c a n b e p e r f o r m e d a s f o l l o w ( 4 . 6 ) :  

Dx,y = |I x,y − Bx,y| ( 4 . 6 )  

o f w h i c h t h e r e s u l t  Dx,y i s t h e a b s o l u t e d i e r e n c e p i x e l v a l u e b e t w e e n  

I x,y a n d Bx,y

p r e v i o u s l y d e n e d .  

A t t h i s p o i n t t h e t w o r s t s t e p o f t h e f r a m e d i e r e n c i n g a l g o r i t h m a r e d o n e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 63/110

4 . 3 D e s i g n   4 7 

4 . 3 . 2 T h r e s h o l d i n g  

T h r e s h o l d i n g i s t h e s i m p l e s t m e t h o d o f i m a g e s e g m e n t a t i o n . I n d i v i d u a l p i x e l s i n  

a g r e y s c a l e f r a m e a r e m a r k e d a s o b j e c t p i x e l s i f t h e i r v a l u e i s g r e a t e r t h a n s o m e  

t h r e s h o l d v a l u e a n d a s b a c k g r o u n d p i x e l s o t h e r w i s e .  

T h e f r a m e d i e r e n c i n g a l g o r i t h m i s r e a l l y s e n s i t i v e ( [ P i c 0 4 b ] a n d [ R o s 9 5 , S e c t i o n  

1 ] ) a b o u t t h e t h r e s h o l d   T h  u s e d t o d i e r e n t i a t e o b j e c t p i x e l s f r o m b a c k g r o u n d  

p i x e l s .  

T h e p r o p e r v a l u e o f t h e t h r e s h o l d i s d e p e n d e n t o n t h e s c e n e , p o s s i b l y u c t u a t i n g  

c a m e r a l e v e l s , a s w e l l a s v i e w i n g c o n d i t i o n s ( e . g . i l l u m i n a t i o n ) w h i c h m a y v a r y o v e r  

t i m e . A t o o h i g h   T h  c o u l d i n h i b i t t h e d e t e c t i o n o f a r e a l l y s u b t l e c h a n g e a n d h e n c e  

c r e a t e a f a l s e n e g a t i v e . O n t h e c o n t r a r y , a t o o l o w   T h  c o u l d l e a d t o d e t e c t n o i s e a s  

a m o v e m e n t a n d t h e n c r e a t e f a l s e p o s i t i v e .  

A s t h e m o t i o n d e t e c t i o n a l g o r i t h m r e l i e s h e a v i l y o n a c o r r e c t t h r e s h o l d , a n a u t o m a t i c  

t h r e s h o l d i n g a p p e a r s a s a g o o d c h o i c e d u e t o i t s a d a p t i v e p r o p e r t y d u r i n g r u n t i m e  

t h u s p r e v e n t i n g a x e d t h r e s h o l d b e c o m i n g i r r e l e v a n t . T h e A u t o m a t i c t h r e s h o l d i n g  

T h  o f d i e r e n c e i m a g e s a l g o r i t h m u s e d i s d e s c r i b e d i n [ I D T 9 5 , C h a p t e r 2 . 2 ] : F i r s t ,  

t h e d i e r e n c e i m a g e  Dx,y i s a n a l y s e d t o d e t e r m i n e t h e m e d i a n M E D ( 4 . 7 ) :  

M ED = medx,y∈F Dx,y ( 4 . 7 )  

T h e n t h e m e d i a n a b s o l u t e d e v i a t i o n M A D i s c o m p u t e d ( 4 . 8 ) :  

M AD = medx,y∈F |Dx,y − M ED|( 4 . 8 )  

A s s u m i n g t h a t l e s s t h a n h a l f t h e i m a g e i s i n m o t i o n , t h e m e d i a n s h o u l d c o r r e s p o n d t o  

t y p i c a l n o i s e v a l u e s , a n d a s u i t a b l e t h r e s h o l d s h o u l d c o r r e s p o n d t o t h e v a l u e o b t a i n e d  

b y t h e f o l l o w i n g c a l c u l a t i o n ( 4 . 9 ) b a s e d o n [ I D T 9 5 , C h a p t e r 2 . 2 ] :  

T h = M ED + 3 ∗ 1.4826 ∗ M AD( 4 . 9 )  

w h e r e 1 . 4 8 2 6 i s a n o r m a l i s a t i o n f a c t o r w i t h r e s p e c t t o a G a u s s i a n d i s t r i b u t i o n .  

N o w t h a t t h e t h r e s h o l d   T h  i s o b t a i n e d , t h e l a s t s t e p i s t o a p p l y i t t o t h e d i e r e n c e  

f r a m e  Dx,y t o o b t a i n t h e f o r e g r o u n d  

F x,y b i n a r y i m a g e f r o m t h e b a c k g r o u n d ( 4 . 1 0 ) .  

F x,y = 1 if Dx,y ≥ T h

0 else

( 4 . 1 0 )  

1 m e a n i n g  F x,y i s a f o r e g r o u n d p i x e l h e n c e p a r t o f a m o v i n g o b j e c t ; 0 m e a n i n g  

F x,yi s a b a c k g r o u n d p i x e l .  

4 . 3 . 3 S e l e c t i n g a n E c i e n t M e d i a n S e a r c h A l g o r i t h m  

T h e m e d i a n o f N n u m e r i c a l v a l u e s c a n b e d e n e d b y :  

• T h e m e d i a n o f a l i s t o f N v a l u e s i s f o u n d b y s o r t i n g t h e i n p u t a r r a y i n i n c r e a s i n g  

o r d e r , a n d t a k i n g t h e m i d d l e v a l u e .  

• T h e m e d i a n o f a l i s t o f N v a l u e s h a s t h e p r o p e r t y t h a t i n t h e l i s t t h e r e a r e a s  

m a n y g r e a t e r a s s m a l l e r v a l u e s t h a n t h i s e l e m e n t .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 64/110

4 8  4 . M o t i o n D e t e c t i o n A l g o r i t h m  

T h e c o n c e p t i s f a i r l y s i m p l e t o u n d e r s t a n d b u t i t s i m p l e m e n t a t i o n c a n b e c o m p u t i n g  

i n t e n s i v e a n d t h e r e f o r e t h e s e l e c t i o n o f a f a s t M e d i a n S e a r c h A l g o r i t h m i s n e c e s s a r y .  

F r o m t h e r e v i e w o f f a s t m e d i a n s e a r c h a l g o r i t h m [ D e v 9 8 ] , t h e s e l e c t e d C i m p l e m e n -  

t a t i o n i s t h e a n o n - r e c u r s i v e s e a r c h b a s e d o n [ W i r ] . I t w a s s e l e c t e d f o r d i e r e n t  

r e a s o n s :  

• O n e o f t h e f a s t e s t c o n s i d e r i n g t h e b e n c h m a r k d o n e i n [ D e v 9 8 , S e c t i o n 5 ]  

• N o n r e c u r s i v e : a r e c u r s i v e a l g o r i t h m i s n o t e a s i l y m a p p e d i n t o h a r d w a r e f o r  

a c c e l e r a t i n g i t s c o m p u t a t i o n  

4 . 4 P r o l i n g  

F i g u r e 4 . 3 : T h e p r o l e r a n a l y s e s t h e a p p l i c a t i o n . T h e r e s u l t s h i g h t l i g h t t h e c r i t i c a l  

p a r t o f t h e a p p l i c a t i o n . T h i s r e s u l t s c a n g u i d e t h e H a r d w a r e / S o f t w a r e C o - D e s i s g n ,  

h e n c e p o t e n t i a l l y m a p t h e c r i t i c a l p a r t s o n t o H a r d w a r e . [ M o u 0 8 ]  

p e r f o r m a n c e a n a l y s i s ( m o r e c o m m o n l y p r o l i n g ) : i n v e s t i g a t i o n o f a p r o g r a m ' s  

b e h a v i o u r u s i n g i n f o r m a t i o n g a t h e r e d a s t h e p r o g r a m r u n s , i . e . i t i s a f o r m o f d y n a m i c  

p r o g r a m a n a l y s i s , a s o p p o s e d t o s t a t i c c o d e a n a l y s i s .   [ W i k b ]  

T h e p u r p o s e o f p r o l i n g t h e M o t i o n D e t e c t i o n a l g o r i t h m i s t o d i s c o v e r b o t t l e n e c k s  

a n d t o d e t e r m i n e w h i c h p a r t s o f t h e p r o g r a m s i m u l a t i n g t h e c h o s e n a l g o r i t h m t o  

o p t i m i z e f o r s p e e d , m e m o r y e t c . .  

P r o l i n g i s a p a r t o f t h e H a r d w a r e / S o f t w a r e C o - D e s i s g n ( 4 . 3 ) . T h e G N U G p r o f  

p r o l e r [ G K M ] u s e d t o a n a l y s e t h e C v e r s i o n o f t h e a l g o r i t h m c a n o u t p u t b o t h t h e a t  

p r o l e s ( c o m p u t a t i o n o f t h e a v e r a g e c a l l t i m e s , f r o m t h e c a l l s ) a n d t h e c a l l - g r a p h  

( s h o w i n g c a l l t i m e s , f r e q u e n c i e s o f t h e f u n c t i o n s a n d a l s o t h e c a l l - c h a i n s i n v o l v e d  

b a s e d o n t h e c a l l e e ) o f t h e a p p l i c a t i o n .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 65/110

4 . 4 P r o l i n g   4 9 

A s o f t w a r e w r i t t e n i n C , b a s e d o n t h e p r e v i o u s l y d e s i g n e d a l g o r i t h m a s b e e n p r o -  

l e d o n a d e s k t o p c o m p u t e r ( I n t e l P e n t i u m 4 @ 2 . 8 0 G h z - 1 G B R A M ) r u n n i n g U b u n t u  

8 . 0 4 . A s i m p l i e d v e r s i o n o f t h e a p p l i c a t i o n c a l l g r a p h c a n b e f o u n d i n A p p e n d i x 1 .  

T h o s e t w o p i c t u r e s h a v e b e e n u s e d t o t e s t t h i s a l g o r i t h m a n d h a v e t h e f o l l o w i n g  

c h a r a c t e r i s t i c s :  

• R e s o l u t i o n : 6 4 0 x 4 8 0 p i x e l s ;  

• C o l o u r d e p t h : 2 4 b i t s ;  

• M o v i n g e l e m e n t s i z e : 4 5 0 x 2 0 0 p i x e l s .  

( a ) F r a m e 1 : b a c k g r o u n d ( b ) F r a m e 2 : n e w f r a m e  

( c ) R e s u l t o f m o t i o n d e t e c t i o n  

F i g u r e 4 . 4 : R e s u l t s o f m o t i o n d e t e c t i o n e x p e r i m e n t s : f r a m e ( a ) i s c o n s i d e r e d a s t h e  

b a c k g r o u n d f r a m e , w h i l e f r a m e ( b ) i s t h e C u r r e n t f r a m e . T h e f r a m e d i e r e n c e  

a l g o r i t h m i s u s e d t o d e t e c t m o t i o n . ( c ) i s t h e r e s u l t o f t h e c o m p a r i s o n : b l a c k p i x e l s  

a r e w h e n n o m o t i o n i s d e t e c t e d a n d g r e y p i x e l s e n l i g h t e n s t h e m o t i o n .  

T h e t a b l e 4 . 4 s h o w s t h e t i m i n g p r o l e s r e s u l t s o b t a i n e d a f t e r r u n n i n g t h e a l g o -  

r i t h m o n t h e t w o p i c t u r e s 4 . 4 ( a ) a n d 4 . 4 ( a ) p r o d u c i n g 4 . 4 ( c ) :  

T h e t i m e s p e n t i n e a c h f u n c t i o n s a r e n o t s h o w n b e c a u s e t h e y a r e n o t r e l e v a n t d u e  

t o t h e o v e r h e a d i n t r o d u c e d b y t h e p r o l e r a l l o w i n g i t t o t r a c e a l l t h e f u n c t i o n s c a l l s  

a n d t h e t i m e s s p e n t i n t h e m . H o w e v e r t h e t i m e o v e r a l l p e r c e n t a g e s p e n t i n e a c h  

f u n c t i o n s i s m o r e r e l e v a n t , i t ' s h i g h l i g h t i n g t h e c r i t i c a l p a r t , i n t e r m o f e x e c u t i o n  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 66/110

5 0  4 . M o t i o n D e t e c t i o n A l g o r i t h m  

F u n c t i o n C a l l e d ( # ) % T i m e  

B M P _ L o a d _ D a t a _ 2 4 b 2 4 2 . 7 6 (  ≈

2 1 e a c h )  

B M P _ S a v e _ F i l e 1 1 6 . 6 0  

B M P _ G r e y S c a l e c o n v e r s i o n 2 1 2 . 3 6 (  ≈

6 e a c h )  

M D _ A u t o m a t i c T h r e s h o l d 1 1 0 . 8 9  

→k t h _ s m a l l e s t ( M e d i a n S e a r c h A l g o r i t h m ) 2 9 . 9 3 (  

≈5 e a c h )  

M D _ B a c k g r o u n d _ S u b s t i t u t i o n 1 7 . 4 3  

B M P _ R e a d _ H e a d e r 2 0  

B M P _ C o p y _ H e a d e r 1 0  

T a b l e 4 . 1 : A p p l i c a t i o n p r o l e d R e s u l t s ( % T i m e ) s o r t e d b y t h e t o t a l a m o u n t o f t i m e  

s p e n t i n e a c h f u n c t i o n a n d i t s c h i l d r e n , T h e i m p o r t a n t r e s u l t s a r e h i g h l i g h t e d i n r e d  

t i m e , o f t h e a p p l i c a t i o n . A n d t h e r e f o r e c a n u n d e r c o v e r b o t t l e n e c k i n t h e a l g o r i t h m  

u s e d .  

S o m e p a r t o f t h e r e s u l t s f o u n d i n T a b l e 4 . 4 a r e n o t a r e n o t r e a l l y p e r t i n e n t , t h o s e  

p a r t s ( i n b l a c k ) c o n c e r n s o m e p o r t i o n o f t h e C c o d e u s e d o n l y t o l o a d a n d s a v e B M P  

F i l e s o n a D e s k t o p c o m p u t e r . T h o s e p o r t i o n s o f c o d e r e p r e s e n t r o u g h l y 6 0 % o f t h e  

o v e r a l l e x e c u t i o n t i m e . T h e i n t e r e s t i n g p a r t s ( i n r e d ) r e l a t e d t o A l g o r i t h m p r e v i o u s l y  

d e n e d ( 4 . 3 ) t o o k a p p r o x i m a t e l y 4 0 % o f t h e c o m p u t a t i o n t i m e .  

T h e t a b l e 4 . 4 s h o w s t h e p e r c e n t a g e o f e x e c u t i o n t i m e o f e a c h i m p o r t a n t f u n c t i o n  

f r o m t h o s e 4 0 % i n d e x e d o n a 1 0 0 % b a s i s . T h o s e r e s u l t s s h o w t h a t t h e G r e y s c a l e  

F u n c t i o n C a l l e d ( # ) % T i m e  

B M P _ G r e y S c a l e c o n v e r s i o n 2 3 0 . 4 3 (  ≈

1 5 e a c h )  

M D _ A u t o m a t i c T h r e s h o l d 1 2 6 . 8 2  

→ k t h _ s m a l l e s t ( M e d i a n S e a r c h A l g o r i t h m ) 2 2 4 . 4 5 (  ≈

1 2 e a c h )  

M D _ B a c k g r o u n d _ S u b s t i t u t i o n 1 1 8 . 3 0  

T a b l e 4 . 2 : A l g o r i t h m p r o l e d R e s u l t s ( % T i m e ) s o r t e d b y t h e t o t a l a m o u n t o f t i m e  

s p e n t i n e a c h f u n c t i o n a n d i t s c h i l d r e n  

c o n v e r s i o n a n d t h e A u t o m a t i c T h r e s h o l d i n g a r e t h e h e a v i e s t c o m p u t a t i o n t a s k s w i t h  

r e s p e c t i v e l y  ≈

3 0 % a n d  ≈

5 2 % o f t h e e x e c u t i o n t i m e . T h e M e d i a n S e a r c h A l g o r i t h m  

( k t h _ s m a l l e s t i n t h e T a b l e , u s e d t w i c e f o r t h e A u t o m a t i c T h r e s h o l d i n g ) c o n s u m e s  

a l o n e  ≈

1 2 % o f t h e e x e c u t i o n t i m e . T h e B a c k g r o u n d S u b s t i t u t i o n i s r e l a t i v e l y l e s s  

p r o c e s s i n g i n t e n s i v e w i t h o n l y  ≈

1 8 % .  

T h o s e r e s u l t b y t h e m s e l v e s a r e a g o o d h i n t s f o r h i g h l i g h t i n g w h e r e t h e a l g o r i t h m  

c o u l d b e o p t i m i z e d , b u t t h e y c a n n o t i n d i c a t e w h i c h p a r t o f t h e a l g o r i t h m c o u l d b e  

m a p p e d o n t o h a r d w a r e , a c c e l e r a t i n g t h e m . H o w e v e r t h o s e r e s u l t s c o r r e l a t e d w i t h r e l -  

e v a n t m e t r i c s c o u l d h e l p t h e H a r d w a r e / S o f t w a r e C o - D e s i s g n p r o c e s s b y p r e s e l e c t i n g  

p a r t o f t h e a l g o r i t h m w h i c h c o u l d b e n e t t o b e m a p p e d o n t o h a r d w a r e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 67/110

4 . 5 M e t r i c s   5 1 

4 . 5 M e t r i c s  

M e t r i c s : A s o f t w a r e m e t r i c i s a m e a s u r e o f s o m e p r o p e r t y o f a p i e c e o f s o f t w a r e  

o r i t s s p e c i c a t i o n s .  [ W i k c ]  

I n t h i s s e c t i o n , t h e a i m i s t o u s e m e t r i c s a n d t o o l s b a s e d o n t h o s e m e t r i c s t o g u i d e  

t h e D e s i g n S p a c e E x p l o r a t i o n a n d H a r d w a r e / S o f t w a r e C o - D e s i s g n d u r i n g t h e i m -  

p l e m e n t a t i o n o f t h e c h o s e n a l g o r i t h m , h e n c e t o m a p t h e c o m p u t a t i o n a l p a r t o f t h e  

a l g o r i t h m o n t o t h e c o m p o n e n t s o f t h e s y s t e m a r c h i t e c t u r e .  

T h e t o o l u s e t o a n a l y s e t h e a l g o r i t h m a n d l o o k t h r o u g h i t a g a i n s t s o m e s p e c i c  

m e t r i c s i s t h e d e s i g n f r a m e w o r k c a l l e d   D e s i g n T r o t t e r   . D e s i g n T r o t t e r i s a s e t o f c o -  

o p e r a t i v e t o o l s w h i c h a i m a t g u i d i n g e m b e d d e d s y s t e m d e s i g n e r s e a r l y i n t h e d e s i g n  

o w b y m e a n s o f d e s i g n s p a c e e x p l o r a t i o n [ M D A  

+0 5 ] .  

D e s i g n T r o t t e r i s a n a c a d e m i c t o o l w h i c h i s s t i l l i n d e v e l o p m e n t w i t h a c e r t a i n  

n u m b e r s o f i s s u e s a n d l i m i t a t i o n s . T h e f r a m e w o r k e m p l o y s f a s t l i s t - b a s e d s c h e d u l i n g  

a n d h e u r i s t i c m e t h o d s t o e x p l o r e t h e s e a r c h s p a c e s o t h a t f e a s i b l e a n d n e a r - o p t i m a l  

s o l u t i o n s c a n b e f o u n d r a p i d l y a n d t h e n g u i d e s t h e d e v e l o p e r i n t h e h a r d w a r e /  

s o f t w a r e p a r t i t i o n p h a s e .  

4 . 5 . 1 C h o s e n M e t r i c s  

T h e c h o i c e o f r e l e v a n t m e t r i c s h a s t o b e m a d e t o g u i d e t h e d e s i g n e r a n d t h e s y n t h e s i s  

t o o l t o w a r d s a n e c i e n t a p p l i c a t i o n a r c h i t e c t u r e m a t c h i n g .  

D e s i g n T r o t t e r i s b a s e d o n d i e r e n t m e t r i c s w h i c h a r e d e n e d i n [ D T m 0 3 ] a n d  

[ A A S  

+0 7 ] .  

γ 

γ i s e s p e c i a l l y r e l e v a n t t o m e a s u r e t h e d e g r e e o f i n h e r e n t p a r a l l e l i s m i n t h e a l g o r i t h m .  

γ c a n b e c a l c u l a t e d f o r a f u n c t i o n b y t h e f o r m u l a e 4 . 1 1 a s i n [ A A S  

+0 7 , S e c t i o n 3 ] .  

γ  = 1 −Nb operations

CriticalP ath( 4 . 1 1 )  

A h i g h  γ 

i n d i c a t e a n o p t i m i z a t i o n p o t e n t i a l f o r s p e e d - u p a n d c o n s u m p t i o n r e -  

d u c t i o n w h e n m a p p e d t o a n h i g h l y p a r a l l e l i s e d a r c h i t e c t u r e .  

M OM 

M e m o r y O r i e n t a t i o n M e t r i c :   M OM 

M OM c a n b e c a l c u l a t e d f o r a f u n c t i o n b y t h e f o r m u l a e 4 . 1 2 a s i n [ D T m 0 3 , S e c t i o n  

3 . 3 ] .  

M OM  =Nb global memory accesses

Nb processing operations + Nb global memory accesses( 4 . 1 2 )  

M OM  i n d i c a t e s t h e f r e q u e n c y o f m e m o r y a c c e s s e s i n a g r a p h .   M OM  v a l u e s  

a r e n o r m a l i z e d i n t h e [ 0 ; 1 ] i n t e r v a l . W h e n  M OM 

g e t s c l o s e r t o 1 t h e f u n c t i o n  

i s d o m i n a t e d b y m e m o r y a c c e s s e s . H e n c e i n c a s e o f h a r d t i m e c o n s t r a i n t s , h i g h  

p e r f o r m a n c e m e m o r i e s a r e r e q u i r e d ( l a r g e b a n d w i d t h , d u a l - p o r t m e m o r y ) a s w e l l a s  

a n e c i e n t u s e o f m e m o r y h i e r a r c h y a n d d a t a l o c a l i t y .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 68/110

5 2  4 . M o t i o n D e t e c t i o n A l g o r i t h m  

COM 

C o n t r o l O r i e n t a t i o n M e t r i c :   COM 

COM c a n b e c a l c u l a t e d f o r a f u n c t i o n b y t h e f o r m u l a e 4 . 1 3 a s i n [ D T m 0 3 , S e c t i o n  

3 . 4 ] .  

COM  =Nb controls

Nb processings + Nb memory accesses + Nb controls( 4 . 1 3 )  

I t i n d i c a t e s t h e a p p e a r a n c e f r e q u e n c y o f c o n t r o l o p e r a t i o n s ( i . e . , t e s t s t h a t c a n n o t  

b e e l i m i n a t e d d u r i n g c o m p i l a t i o n ) .   COM  v a l u e s a r e n o r m a l i z e d i n t h e [ 0 ; 1 ] i n t e r v a l .  

W h e n  COM 

g e t s c l o s e r t o 1 t h e f u n c t i o n i s d o m i n a t e d b y c o n t r o l s .  

4 . 5 . 2 R e s u l t s  

T h e m a i n i d e a i s n o w t o a p p l y t h o s e m e t r i c s t o t h e c h o s e n a l g o r i t h m c o r r e l a t e d w i t h  

t h e r e s u l t o f t h e p r o l i n g s t e p .  

G r e y s c a l e C o n v e r s i o n  

T h e g r e y s c a l e c o n v e r s i o n (  B M P _ G r e y S c a l e C o n v e r s i o n   i n 4 . 4 ) o f b o t h t h e b a c k -  

g r o u n d a n d t h e c u r r e n t f r a m e i s t h e r s t f u n c t i o n t o b e s t u d i e d . T h e T a b l e 4 . 5 . 2 i s  

t h e r e s u l t o f t h e c a l c u l a t i o n o f t h o s e t h r e e m e t r i c s u s i n g D e s i g n T r o t t e r .  

M e t r i c R e s u l t  

γ 0 . 5 

M OM  0 . 7 

COM 0 . 0 

T a b l e 4 . 3 : M e t r i c s R e s u l t s (  γ  ,  M OM ,  COM ) f o r t h e G r e y s c a l e C o n v e r s i o n u s i n g  

D e s i g n T r o t t e r  

T h e G r e y s c a l e C o n v e r s i o n i s q u i t e d e p e n d a n t o n m e m o r y a c c e s s e s , a s t h e   M OM 

p o i n t s i t w i t h a 0 . 7 r e s u l t . I t i s s o m e t h i n g p r e t t y e a s y t o f o r e s e e b e c a u s e t h i s s t e p  

i s f u n d a m e n t a l l y a c c e s s i n g d a t a i n m e m o r y , p r o c e s s t h e m a n d t h e n s t o r e t h e m b a c k .  

T h i s i m p l i e s t h a t t h e m e m o r y a c c e s s e s s h o u l d b e o p t i m i s e d i n t h e a r c h i t e c t u r e t o  

a v o i d m e m o r y b o t t l e n e c k s .  

M o r e i m p o r t a n t ,  γ 

r e s u l t o f 0 . 5 s h o w s t h a t i t t h i s s t e p c o u l d b e n e t f r o m a p a r a l -  

l e l i s e d a r c h i t e c t u r e . E v e n m o r e w h e n o n e c a n c o n s i d e r t h a t b o t h o f t h e g r e y a s c a l e  

c o n v e r s i o n c o u l d b e c a r r i e d o u t i n p a r a l l e l w i t h o u t e v e n t h i n k i n g a b o u t o p t i m i z i n g  

t h e i n n e r s e l f a l g o r i t h m b e c a u s e t h e d a t a m a n i p u l a t e d a r e n o t t h e s a m e . T h o s e r e -  

s u l t s o u t l i n e a n o t h e r f a c t s , t h i s p o r t i o n o f t h e a l g o r i t h m c o n t a i n a l m o s t n o c o n t r o l  

o p e r a t i o n (  COM 

= 0 ) .  

B a c k g r o u n d S u b s t i t u t i o n  

T h e b a c k g r o u n d s u b s t i t u t i o n (  M D _ B a c k g r o u n d _ S u b s t i t u t i o n   i n 4 . 4 ) i s t h e s e c o n d  

f u n c t i o n t o b e s t u d i e d . T h e T a b l e 4 . 5 . 2 i s t h e r e s u l t o f t h e c a l c u l a t i o n o f t h o s e t h r e e  

m e t r i c s u s i n g D e s i g n T r o t t e r .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 69/110

4 . 5 M e t r i c s   5 3 

M e t r i c R e s u l t  

γ 0 . 6 5 6  

M OM 0 . 6 5 6  

COM  0 . 0 

T a b l e 4 . 4 : M e t r i c s R e s u l t s (  γ 

, M OM 

, COM 

) f o r t h e B a c k g r o u n d S u b s t i t u t i o n u s i n g  

D e s i g n T r o t t e r  

T h e B a c k g r o u n d S u b s t i t u t i o n i s q u i t e d e p e n d a n t o n m e m o r y a c c e s s e s , a s t h e  

M OM  p o i n t s i t w i t h a 0 . 6 5 6 r e s u l t . A s p r e v i o u s l y s t a t e d f o r t h e G r e y s c a l e C o n v e r -  

s i o n i t w a s s o m e t h i n g a l m o s t p r e d i c t a b l e b e c a u s e t h i s s t e p i s f u n d a m e n t a l l y a c c e s s i n g  

d a t a i n m e m o r y , p r o c e s s t h e m a n d t h e n s t o r e t h e m b a c k . T h i s i m p l i e s t h a t t h e m e m -  

o r y a c c e s s e s s h o u l d b e o p t i m i s e d i n t h e a r c h i t e c t u r e t o a v o i d m e m o r y b o t t l e n e c k s .  

T h o s e r e s u l t s o u t l i n e a n o t h e r f a c t s , t h i s p o r t i o n o f t h e a l g o r i t h m c o n t a i n a l m o s t n o  

c o n t r o l o p e r a t i o n (  COM 

= 0 ) . H o w e v e r o n t h i s p a r t i c u l a r p a r t o f t h e a l g o r i t h m ,  

a s t h e   γ  r e s u l t o f a l m o s t 0 . 7 h i g h l i g h t s i t , c o u l d r e a l l y b e n e t f r o m a p a r a l l e l i s e d  

a r c h i t e c t u r e . I t e v e n m o r e t r u e , w h e n t h e f a s t e s t a r c h i t e c t u r e a n d s c h e d u l i n g ( i n  

t e r m o f n u m b e r o f c y c l e s ) p r o p o s e d b y D e s i g n T r o t t e r i s c o m p o s e d b y 4 A L U s .  

M e d i a n S e a r c h a l g o r i t h m  

T h e M e d i a n S e a r c h a l g o r i t h m (  k t h _ s m a l l e s t   i n 4 . 4 ) i s t h e t h i r d f u n c t i o n t o b e s t u d -  

i e d . T h e T a b l e 4 . 5 . 2 i s t h e r e s u l t o f t h e c a l c u l a t i o n o f t h o s e t h r e e m e t r i c s u s i n g  

D e s i g n T r o t t e r .  

M e t r i c R e s u l t  

γ  0 . 3 5 7  

M OM 0 . 7 8 6  

COM 0 . 0 

T a b l e 4 . 5 : M e t r i c s R e s u l t s (  γ 

, M OM 

, COM 

) f o r t h e M e d i a n S e a r c h a l g o r i t h m  

D e s i g n T r o t t e r  

T h e M e d i a n S e a r c h a l g o r i t h m i s h e a v i l y d e p e n d a n t o n m e m o r y a c c e s s e s , a s t h e  

M OM u n d e r l i n e s i t w i t h r o u g h l y   0 . 8 

M OM r e s u l t . T h i s i s e v e n m o r e i m p o r t a n t  

g i v e n t h a t t h i s p a r t o f t h e T h r e s h o l d i n g p a r t o f t h e a l g o r i t h m i s r e p e a t e d t w i c e .  

O n e m o r e t i m e , T h i s i m p l i e s t h a t t h e m e m o r y a c c e s s e s s h o u l d b e o p t i m i s e d i n t h e  

a r c h i t e c t u r e t o a v o i d m e m o r y b o t t l e n e c k s t h e r e f o r e s l o w i n g d o w n t h e e x e c u t i o n s p e e d  

o f t h e o v e r a l l a p p l i c a t i o n .  

T h e r e i s l e s s i n h e r e n t p a r a l l e l i s m i s t h i s p a r t o f t h e F r a m e D i e r e n c i n g a l g o r i t h m a s  

t h e 0 . 3 5  γ 

r e s u l t i n d i c a t e s i t .  

A u t o m a t i c T h r e s h o l d  

T h e A u t o m a t i c T h r e s h o l d (  M D _ A u t o m a t i c T h r e s h o l d   i n 4 . 4 ) i s t h e l a s t f u n c t i o n t o b e  

s t u d i e d . I t i s i m p o r t a n t t o s t a t e t h a t f o r t h i s p a r t , t h e M e d i a n S e a r c h a l g o r i t h m h a s  

n o t b e e n a n a l y s e d d u r i n g t h e m e t r i c s c a l c u l a t i o n d u e t o i t s r e s u l t s a l r e a d y e x p r e s s e d .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 70/110

5 4  4 . M o t i o n D e t e c t i o n A l g o r i t h m  

T h e T a b l e 4 . 5 . 2 i s t h e r e s u l t o f t h e c a l c u l a t i o n o f t h o s e t h r e e m e t r i c s u s i n g D e s i g n  

T r o t t e r .  

M e t r i c R e s u l t  

γ  0 . 2 5  

M OM 0 . 7 5  

COM 0 . 0 8 3  

T a b l e 4 . 6 : M e t r i c s R e s u l t s (  γ 

, M OM 

, COM 

) f o r t h e A u t o m a t i c T h r e s h o l d ( w i t h o u t  

t h e M e d i a n S e a r c h a l g o r i t h m i n c l u d e d ) D e s i g n T r o t t e r  

T h e A u t o m a t i c T h r e s h o l d i s h e a v i l y d e p e n d a n t o n m e m o r y a c c e s s e s , a s t h e  M OM 

u n d e r l i n e s i t w i t h r o u g h l y   0 . 8 M OM 

r e s u l t . A u t o m a t i c T h r e s h o l d c o u l d n o t r e a l l y  

b e n e t t o b e p a r a l l e l i s e d r e g a r d i n g t o i t s   γ  r e s u l t o f 0 . 2 5 . T h i s p a r t o f t h e a p p l i c a t i o n  

i s s l i g h t l y m o r e c o n t r o l o r i e n t e d ( a  COM 

r e s u l t o f 0 . 0 8 3 ) t h a n t h e p r e v i o u s s t u d i e d  

p a r t . T h i s i s d u e t o t h e 4 . 1 0 p o r t i o n o f t h e a l g o r i t h m .  

4 . 5 . 3 C o n c l u s i o n  

D e s i g n T r o t t e r i s a t o o l e s p e c i a l l y u s e f u l t o g i v e a n i n s i g h t o n t h e p a r a l l e l i s m l e v e l  

o f d i e r e n t p a r t o f t h e a l g o r i t h m s t u d i e d . H o w e v e r , D e s i g n T r o t t e r i s s t i l l u n d e r g o i n g  

d e v e l o p m e n t a n d h a s a r a t h e r l i m i t e d i m p l e m e n t a t i o n o f t h e C l a n g u a g e ( n o w h i l e  

s t a t e m e n t s u p p o r t e d f o r i n s t a n c e ) . I t i s f a r f r o m b e i n g s t r a i g h t f o r w a r d t o t r a n s l a t e  

t h e C v e r s i o n o f a n a l g o r i t h m t o t h e C v e r s i o n f o r D e s i g n T r o t t e r . T h e r e i s m a n y  

r e s t r i c t i o n o n h o w t o w r i t e i t f o r D e s i g n T r o t t e r t o b e a b l e t o h a n d l e a n d a n a l y s e i t .  

T h e r e f o r e , i t t a k e s s o m e t i m e t o r e w r i t e a n e x i s t i n g s o u r c e c o d e i n t o o n e t h a t D e s i g n  

T r o t t e r c a n a n a l y s e .  

H o w e v e r r e s u l t s g i v e n b y t h e t o o l s a r e a p p r e c i a b l e i n d i c a t i o n s t o h e l p t h e d e s i g n e r s  

a n d d e v e l o p e r s t o m a k e t h e i r c h o i c e s . F o r i n s t a n c e , t h e o v e r a l l r e s u l t t e n d s t o s h o w  

t h a t t h e a l g o r i t h m d e s i g n e d c o u l d b e n e t f r o m a p a r a l l e l i s e d a r c h i t e c t u r e l i k e   F P G A  

, g i v e n t h a t f r o m a l l t h e f u n c t i o n s s t u d i e d t w o c o u l d b e f a i r l y p a r a l l e l i s e d e s p e c i a l l y  

o n e w h i c h i s u s e d t w i c e d u r i n g t h e c o u r s e o f e x e c u t i o n .  

M o r e o v e r a s p e c i c t a r g e t e d p r o c e s s o r , w i t h m u l t i p l e A L U o r s p e c i c c u s t o m h a r d -  

w a r e f u n c t i o n ( s u c h a s t h e   N i o s I I   f o r i n s t a n c e ) c o u l d h e l p t o s p e e d u p t h e e x e c u t i o n  

t i m e o r c y c l e u s e d t o p r o c e s s t h e a l g o r i t h m .  

A p p a r e n t l y t h e F r a m e D i e r e n c i n g a l g o r i t h m i s n o t r e a l l y c o n t r o l o r i e n t e d w i t h m o s t  

o f t h e   COM  m e t r i c r e s u l t s c l o s e t o 0 o r e q u a l t o 0 . T h e r e s u l t s o b t a i n e d t h r o u g h  

t h e u s e o f D e s i g n T r o t t e r u s i n g t h e c h o s e n M e t r i c s s e e m e d t o p r o v e t h a t t h e S y s t e m  

A r c h i t e c t u r e c h o s e n i n 3 i s a r e l e v a n t c h o i c e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 71/110

Chapter5I m p l e m e n t a t i o n      

F i g u r e 5 . 1 : L o c a t i o n i n t h e  A3

p a r a d i g m , h i g h l i g h t e d b y t h e p u r p l e c i r c l e .  

I n t h i s c h a p t e r , t h e a p p l i c a t i o n i m p l e m e n t a t i o n i s d e s c r i b e d a n d d e t a i l e d . E a c h  

s e c t i o n o u t l i n e s t h e i m p l e m e n t a t i o n o f o n e o f t h e g o a l s d e s c r i b e d i n t h e C h a p t e r 1 .  

T h e r e f o r e , t h i s c h a p t e r i s a s t e p - b y - s t e p d e s c r i p t i o n o f t h e i m p l e m e n t a t i o n o f t h e  

p r o j e c t . T h e r s t s e c t i o n d e s c r i b e s t h e b l o c k s w i t h a b l a c k - b o x a p p r o a c h : t h e m a i n  

5 5 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 72/110

5 6  5 . I m p l e m e n t a t i o n  

( a ) G l o b a l l o c a t i o n ( b ) E l a b o r a t e d l o c a t i o n  

F i g u r e 5 . 2 : L o c a t i o n i n t h e R u g b y M e t a - M o d e l , h i g h l i g h t e d b y t h e g r e y b a r o n ( a )  

a n d g r e y a r r o w s o n ( b ) .  

f u n c t i o n a l i t i e s o f t h e b l o c k a r e g i v e n b e f o r e g i v e n i t s i n p u t s o f o u t p u t s a n d t h e i r g o a l .  

T h e s o u r c e c o d e s o f t h e d i e r e n t h a r d w a r e b l o c k s a n d t h e a l g o r i t h m ( t h e   N i o s I I  

v e r s i o n ) a r e o n t h e C D - R o m .  

5 . 1 T r a n s m i s s i o n c h a i n  

T h e r s t s t e p o f t h e a p p l i c a t i o n i s t h e i m p l e m e n t a t i o n o f a v i d e o c a m e r a o n t h e  

D E 2  F P G A   p l a t f o r m . I t i s i m p l e m e n t e d i n f u l l h a r d w a r e , u s i n g   V e r i l o g   a s t h e  

h a r d w a r e l a n g u a g e . T h i s i s b e c a u s e , r s t l y , t h e c a m e r a s e n s o r i s c o n n e c t e d t o t h e  

D E 2 B o a r d t h r o u g h G e n e r a l P u r p o s e I n p u t / O u t p u t ( G P I O ) p i n s , w h i c h r e q u i r e s a  

l o w l e v e l a c c e s s a n d b e c a u s e , s e c o n d l y , t h e r e w e r e a l r e a d y s o m e e x i s t i n g I P - b l o c k t o  

u s e t h e c a m e r a s e n s o r i n   V e r i l o g   . T h e b l o c k d i a g r a m o f t h i s s t e p c a n b e s e e i n  

F i g u r e 5 . 3 o n p a g e 5 7 . T o s e e t h e c o n g u r a t i o n o f t h e G P I O p i n s o f t h e c a m e r a  

s e n s o r , p l e a s e r e f e r t o F i g u r e 5 . 4 , o n p a g e 5 8 .  

5 . 1 . 1 I m a g e c a p t u r e  

T h i s s e c t i o n i s t h e d e s c r i p t i o n o f t h e m a i n b l o c k s i n v o l v e d i n t h e i m a g e c a p t u r e  

f r o m t h e c a m e r a s e n s o r .  

C C D _ C a p t u r e  

T h e R T L d i a g r a m o f t h i s b l o c k c a n b e s e e o n F i g u r e 5 . 5 o n p a g e 5 9 . T h i s R T L  

v i e w i s p r e s e n t e d i n t h e r e p o r t b e c a u s e i t i s s i m p l e e n o u g h t o b e r e a d a b l e a n d t o l l  

i n a A 4 p a g e . R T L d i a g r a m s o f t h e o t h e r b l o c k s a r e i n t h e C D - R o m .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 73/110

5 . 1 T r a n s m i s s i o n c h a i n   5 7 

F i g u r e 5 . 3 : S i m p l i e d b l o c k d i a g r a m o f t h e t r a n s m i s s i o n c h a i n : b l u e b l o c k s a r e  

t h e r e q u i r e d b l o c k s , w h i l e r e d b l o c k s d e s c r i b e s t h e f e a t u r e s . T h e c a m e r a s e n s o r i s  

c o n t r o l l e d b y a n I n t e r I n t e g r a t e d C i r c u i t B u s ( I 2 C ) c o m m a n d t o s e l e c t t h e e x p o s u r e  

t i m e , a n d s e n d d a t a t o a b l o c k w h i c h t r a n s l a t e t h o s e f o r t h e r e s t o f t h e c i r c u i t . T h e  

o t h e r p a r t s a r e t h e s t e p s o f t h e t r a n s m i s s i o n , f r o m r a w d a t a t o t h e V G A d i s p l a y .  

T h e a i m o f t h i s b l o c k i s t o g e t r a w d a t a f r o m t h e c a m e r a s e n s o r a n d t r a n s f e r t h e m  

t o t h e o t h e r p a r t s o f t h e c i r c u i t . I t h a s s e v e r a l i n p u t s a n d o u t p u t s ( E x i s t i n g B l o c k ) :  

• I n p u t s :  

  i C L K : m a i n c l o c k .  

  i R S T : m a i n r e s e t s i g n a l .  

  i S t a r t : s t a r t s i g n a l , w h i c h b e g i n t h e i n f o r m a t i o n f r o m t h e c a m e r a s e n s o r  

t o b e p r o c e s s .  

  i E n d : e n d s i g n a l , w h i c h s t o p t h e i n f o r m a t i o n f r o m t h e c a m e r a s e n s o r t o  

b e p r o c e s s .  

  i F V A L : v a l i d f r a m e o f p i x e l i f 1 , i n v a l i d i f 0 .  

  i L V A L : v a l i d l i n e o f p i x e l i f 1 , i n v a l i d i f 0 .  

  i D A T A : r a w d a t a f r o m t h e w e b - c a m .  

• O u t p u t s :  

  o D V A L : v a l i d a t e t h e p i x e l .  

  o D A T A : r e t u r n t h e r a w d a t a o f t h e a c t u a l p i x e l .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 74/110

5 8  5 . I m p l e m e n t a t i o n  

F i g u r e 5 . 4 : C a m e r a s e n s o r G P I O o r g a n i z a t i o n : o n e s e n s o r r e q u i r e s o n l y 1 5 p i n s .  

  o X _ C o n t : r e t u r n t h e X c o o r d i n a t e o f t h e a c t u a l p i x e l .  

  o Y _ C o n t : r e t u r n t h e Y c o o r d i n a t e o f t h e a c t u a l p i x e l .  

  o F r a m e _ C o n t : r e t u r n t h e n u m b e r o f f r a m e c a p t u r e d .  

R A W 2 R G B G S  

T h e a i m o f t h i s b l o c k i s t o t r a n s l a t e r a w d a t a f r o m t h e c a m e r a s e n s o r t o t h r e e -  

c o l o u r d a t a R e d , G r e e n a n d B l u e ( R G B ) . T h e s e c o n d f u n c t i o n a l i t y o f t h i s b l o c k i s  

t o c a l c u l a t e t h e g r e y v a l u e o f e a c h p i x e l , u s i n g e q u a t i o n ( 5 . 1 ) :  

Grey =(299 · Red + 587 · Blue + 114 · Green)

1000( 5 . 1 )  

I t i s u s e d w i t h i n t e g e r n u m b e r s b e c a u s e i t i s v e r y e x p e n s i v e t o u s e o a t n u m b e r s i n  

h a r d w a r e , a s i t r e q u i r e s m o r e l o g i c e l e m e n t s a n d t h e r e f o r e b i g g e r a r e a . T h e s e l e c t e d  

c o e c i e n t s a r e f r o m t h e 6 0 1 s t r e c o m m e n d a t i o n o f t h e C I E ( I n t e r n a t i o n a l C o m m i s s i o n  

o n I l l u m i n a t i o n ) [ o I ] . T h e c o n v e r s i o n o f a R G B p i c t u r e t o a g r e y - s c a l e d o n e i s t h e  

r s t s t e p o f t h e b a c k g r o u n d s u b t r a c t i o n a l g o r i t h m . I t i s a l s o p o s s i b l e t o d o i t i n  

s o f t w a r e .  

T h e b l o c k h a s s e v e r a l i n p u t s a n d o u t p u t s ( M o d i e d B l o c k ) :  

• I n p u t s :  

  i C L K : m a i n c l o c k .  

  i R S T : m a i n r e s e t s i g n a l .  

  i D V A L : v a l i d a t e t h e p i x e l .  

  i D A T A : r a w d a t a f r o m t h e b l o c k C C D _ C a p t u r e .  

  i X _ C o n t : r e t u r n t h e X c o o r d i n a t e o f t h e a c t u a l p i x e l .  

  i Y _ C o n t : r e t u r n t h e Y c o o r d i n a t e o f t h e a c t u a l p i x e l .  

• O u t p u t s :  

  o D V A L : v a l i d a t e t h e p i x e l .  

  o R e d : r e d v a l u e o f t h e p i x e l .  

  o B l u e : b l u e v a l u e o f t h e p i x e l .  

  o G r e e n : g r e e n v a l u e o f t h e p i x e l .  

  o G r e y : g r e y v a l u e o f t h e p i x e l .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 75/110

5 . 1 T r a n s m i s s i o n c h a i n   5 9 

F i g u r e 5 . 5 : R T L v i e w o f t h e C C D _ C a p t u r e b l o c k : i n t h i s b l o c k , f r o m b o t t o m t o  

t o p , ( 1 ) i s t h e l o g i c a l e l e m e n t s i n v o l v e d i n t h e f r a m e c o u n t e r , ( 2 ) e n l i g h t e n s t h e l o g i c  

i n v o l v e d i n t h e t r a n s m i s s i o n o f d a t a ( t h e p i x e l c o l o u r ) , ( 3 ) r e g r o u p s t h e e l e m e n t s  

u s e d t o e x t r a c t t h e D V A L v a l u e o f t h e c u r r e n t p i x e l a n d , n a l l y , ( 4 ) r e g r o u p s t h e  

e l e m e n t s t h a t a l l o w s t o e x t r a c t b o t h t h e X a n d Y c o o r d i n a t e s o f t h e p i x e l .  

M i r r o r _ C o l  

T h e m a i n p u r p o s e o f t h i s b l o c k i s t o p r e p a r e a n d f o r m a t i n f o r m a t i o n t o b e s t o r e d o n  

t h e S D R R A M . T h e r e f o r e , i t g e t s d a t a f r o m t h e R A W 2 R G B G S b l o c k a n d s e n d s t h e m  

i n t h e S d r a m _ C o n t r o l _ 4 P o r t b l o c k . T h e n u m b e r o f t h e p i x e l i s s t o r e d s e p a r a t e l y ,  

w h i l e t h e c o l o u r v a l u e s a r e s t o r e d b y s p l i t t i n g t h e g r e e n v a l u e i n t w o a n d s h a r i n g t h e  

m e m o r y s p a c e f o r t w o c o l o u r s ( R e d a n d t h e v e G r e e n l e a s t s i g n i c a n t b i t s & B l u e  

a n d t h e v e G r e e n m o s t s i g n i c a n t b i t s ) . I t i s b e c a u s e t h e S D R A M b l o c k h a s t w o  

s t o r a g e s t a c k o f 1 6 b i t s . I t h a s s e v e r a l i n p u t s a n d o u t p u t s ( M o d i e d B l o c k ) :  

• I n p u t s :  

  i C C D _ D V A L : v a l i d a t e t h e p i x e l .  

  i C C D _ P I X C L K : c l o c k o f t h e c a m e r a s e n s o r .  

  i R S T : m a i n r e s e t s i g n a l .  

  i C C D _ R : r e d v a l u e o f t h e p i x e l .  

  i C C D _ G : b l u e v a l u e o f t h e p i x e l .  

  i C C D _ B : g r e e n v a l u e o f t h e p i x e l .  

  i C C D _ G r : g r e y v a l u e o f t h e p i x e l .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 76/110

6 0  5 . I m p l e m e n t a t i o n  

• O u t p u t s :  

  o C C D _ D V A L : v a l i d a t e t h e p i x e l .  

  o C C D _ R : r e d v a l u e o f t h e p i x e l .  

  o C C D _ G : b l u e v a l u e o f t h e p i x e l .  

  o C C D _ B : g r e e n v a l u e o f t h e p i x e l .  

  o C C D _ G r : g r e y v a l u e o f t h e p i x e l .  

5 . 1 . 2 D i s p l a y I m a g e o n a S c r e e n  

T h i s s e c t i o n i s t h e d e s c r i p t i o n o f t h e m a i n b l o c k s i n v o l v e d i n t h e d i s p l a y o f a v i d e o .  

S d r a m _ C o n t r o l _ 4 P o r t  

T h e a i m o f t h i s b l o c k i s t o g e t a n a c c e s s t o t h e S D R A M o f t h e b o a r d . I n t h i s  

b l o c k , a l l i n f o r m a t i o n f o r a p i c t u r e a r e s t o r e d t e m p o r a r i l y . I t c o n s i s t s o f f o u r F i r s t  

I n F i r s t O u t ( F I F O ) s t a c k s t o o p t i m i z e t h e w r i t i n g a n d t h e r e a d i n g o f d a t a . I t h a s  

s e v e r a l i n p u t s a n d o u t p u t s ( E x i s t i n g B l o c k ) :  

• I n p u t s :  

  R E F _ C L K : m a i n c l o c k .  

  R E S E T _ N : m a i n r e s e t .  

  W R 1 _ D A T A : d a t a i n p u t .  

  W R 1 : w r i t e r e q u e s t .  

  W R 1 _ A D D R : w r i t e s t a r t a d d r e s s .  

  W R 1 _ M A X _ A D D R : w r i t e m a x i m u m a d d r e s s .  

  W R 1 _ L E N G T H : w r i t e l e n g t h .  

  W R 1 _ L O A D : w r i t e r e g i s t e r l o a d & s t a c k 1 c l e a r .  

  W R 1 _ C L K : w r i t e s t a c k 1 c l o c k .  

  W R 2 _ D A T A : d a t a i n p u t .  

  W R 2 : w r i t e r e q u e s t .  

  W R 2 _ A D D R : w r i t e s t a r t a d d r e s s .  

  W R 2 _ M A X _ A D D R : w r i t e m a x i m u m a d d r e s s .  

  W R 2 _ L E N G T H : w r i t e l e n g t h .  

  W R 2 _ L O A D : w r i t e r e g i s t e r l o a d & s t a c k 2 c l e a r .  

  W R 2 _ C L K : w r i t e s t a c k 2 c l o c k .  

  R D 1 : r e a d r e q u e s t .  

  R D 1 _ A D D R : r e a d s t a r t a d d r e s s .  

  R D 1 _ M A X _ A D D R : r e a d m a x i m u m a d d r e s s .  

  R D 1 _ L E N G T H : r e a d l e n g t h .  

  R D 1 _ L O A D : r e a d r e g i s t e r l o a d & s t a c k 1 c l e a r .  

  R D 1 _ C L K : r e a d s t a c k 1 c l o c k .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 77/110

5 . 1 T r a n s m i s s i o n c h a i n   6 1 

  R D 2 : r e a d r e q u e s t .  

  R D 2 _ A D D R : r e a d s t a r t a d d r e s s .  

  R D 2 _ M A X _ A D D R : r e a d m a x i m u m a d d r e s s .  

  R D 2 _ L E N G T H : r e a d l e n g t h .  

  R D 2 _ L O A D : r e a d r e g i s t e r l o a d & s t a c k 2 c l e a r .  

  R D 2 _ C L K : r e a d s t a c k 2 c l o c k .  

  D Q : S D R A M d a t a b u s .  

• O u t p u t s :  

  W R 1 _ F U L L : w r i t e s t a c k 1 f u l l .  

  W R 1 _ U S E : w r i t e s t a c k 1 u s e d .  

  W R 2 _ F U L L : w r i t e s t a c k 2 f u l l .  

  W R 2 _ U S E : w r i t e s t a c k 2 u s e d .  

  R D 1 _ D A T A : d a t a o u t p u t .  

  R D 1 _ E M P T Y : r e a d s t a c k 1 e m p t y .  

  R D 1 _ U S E : r e a d s t a c k 1 u s e d .  

  R D 2 _ D A T A : d a t a o u t p u t .  

  R D 2 _ E M P T Y : r e a d s t a c k 2 e m p t y .  

  R D 2 _ U S E : r e a d s t a c k 2 u s e d .  

  S A : S D R A M a d d r e s s o u t p u t .  

  B A : S D R A M b a n k a d d r e s s .  

  C S _ N : S D R A M c h i p s e l e c t s .  

  C K E : S D R A M c l o c k e n a b l e .  

  R A S _ N : S D R A M r o w a d d r e s s s t r o b e .  

  C A S _ N : S D R A M c o l u m n a d d r e s s s t r o b e .  

  W E _ N : S D R A M w r i t e e n a b l e .  

  D Q M : S D R A M d a t a m a s k l i n e s .  

  S D R _ C L K : S D R A M c l o c k .  

V G A _ C o n t r o l l e r  

T h e a i m o f t h i s b l o c k i s t o d i s p l a y d a t a o n a V G A - S c r e e n . T h e r e f o r e i t g e t s d a t a  

f r o m t h e S D - R a m a n d e n c o d e t h e m f o r V G A s t a n d a r d . I f o n e w a n t s t o d i s p l a y  

g r e y s c a l e d p i c t u r e , t h e V G A d i s p l a y o n l y n e e d s t o g e t t h e s a m e v a l u e o f g r e y o n t h e  

t h r e e c o l o u r s . T h e S w i t c h a l l o w s t h e u s e r t o s e l e c t t h e c o l o u r t o b e d i s p l a y e d : R G B  

i m a g e o r G r e y - s c a l e d i m a g e . T h e o R e q u e s t s i g n a l i s s e n t b y t h e s c r e e n t o g e t t h e  

i n f o r m a t i o n t o d i s p l a y . F i r s t l y , s y n c h r o n i z a t i o n d a t a i s s e n t t o p r e p a r e t h e s c r e e n .  

T h e n , R e d , G r e e n a n d B l u e v a l u e s a r e s e n t t o t h e V G A - s c r e e n . I t h a s s e v e r a l i n p u t s  

a n d o u t p u t s ( M o d i e d B l o c k ) :  

• I n p u t s :  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 78/110

6 2  5 . I m p l e m e n t a t i o n  

  i C L K : m a i n c l o c k .  

  i R S T : m a i n r e s e t s i g n a l .  

  i R e d : r e d v a l u e o f t h e p i x e l .  

  i B l u e : b l u e v a l u e o f t h e p i x e l .  

  i G r e e n : g r e e n v a l u e o f t h e p i x e l .  

  S w i t c h : a l l o w t h e u s e r t o s e l e c t t h e c o l o r t o d i s p l a y ( R G B o r G r e y S c a l e ) .  

• O u t p u t s :  

  o R e q u e s t : s e n d r e q u e s t s i g n a l t o t h e V G A - S c r e e n .  

  V G A _ B L A N K : u s e f o r V G A s y n c h r o n i z a t i o n .  

  V G A _ H _ S Y N C : u s e f o r V G A s y n c h r o n i z a t i o n .  

  V G A _ S Y N C ( G N D ) : u s e f o r V G A s y n c h r o n i z a t i o n .  

  V G A _ V _ S Y N C : u s e f o r V G A s y n c h r o n i z a t i o n .  

  V G A _ R : V G A r e d v a l u e o f t h e p i x e l .  

  V G A _ G : V G A g r e e n v a l u e o f t h e p i x e l .  

  V G A _ B : V G A b l u e v a l u e o f t h e p i x e l .  

5 . 1 . 3 O t h e r F e a t u r e s  

T h i s s e c t i o n i s t h e d e s c r i p t i o n o f t h e b l o c k s p r o v i d i n g n i c e b u t n o t c r i t i c a l f e a t u r e s .  

S E G 7 _ C o n t r o l l e r  

T h e a i m o f t h i s b l o c k i s t o d i s p l a y t h e n u m b e r o f f r a m e s c a p t u r e d o n t h e 7 - s e g m e n t  

b l o c k s o f t h e b o a r d . I t s p l i t s t h e f r a m e n u m b e r ( w r i t t e n o n 3 2 b i t s ) i n e i g h t p a r t o f  

4 b i t s ( f o r e a c h d i s p l a y ) . T h e n u m b e r s h o w n o n t h e 7 - s e g m e n t d i s p l a y s i s w r i t t e n i n  

h e x a d e c i m a l . I t h a s o n e i n p u t a n d s e v e r a l o u t p u t s ( E x i s t i n g B l o c k ) :  

• I n p u t s :  

  i D I G : n u m b e r o f c a p t u r e d f r a m e .  

• O u t p u t s :  

  S E G 0 t o S E G 7 : t h e e i g h t a v a i l a b l e 7 - s e g m e n t d i s p l a y s .  

I 2 C _ C C D _ C o n g  

T h e p u r p o s e o f t h i s b l o c k i s t o c o n t r o l a n d c o n g u r e t h e e x p o s u r e t i m e o f t h e  

c a m e r a s e n s o r . I t a l l o w s t h e u s e r , t h r o u g h t h e s w i t c h e s , t o c h a n g e t h i s t i m e a n d ,  

t h e r e f o r e , t o e n l i g h t e n t h e i m a g e i n c a s e i t i s t o o d a r k . T h i s b l o c k u s e t h e I 2 C  

p r o t o c o l t o c o m m u n i c a t e t h e n e w e x p o s u r e t i m e o f t h e s e n s o r . I 2 C i s a m u l t i - m a s t e r  

s e r i a l c o m p u t e r b u s t h a t i s u s e d t o a t t a c h l o w - s p e e d p e r i p h e r a l s t o a m o t h e r b o a r d ,  

e m b e d d e d s y s t e m o r c e l l p h o n e . I t h a s s e v e r a l i n p u t s a n d o n e o u t p u t ( E x i s t i n g B l o c k ) :  

• I n p u t s :  

  I 2 C _ S D A T : a c t u a l e x p o s u r e t i m e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 79/110

5 . 2 R e c o r d i n g a n d s t o r a g e c h a i n   6 3 

  i C L K : m a i n c l o c k .  

  i R S T : m a i n r e s e t .  

  i E x p o s u r e : v a l u e o f s e l e c t e d e x p o s u r e t i m e .  

• O u t p u t s :  

  I 2 C _ S C L K : n e w v a l u e o f t h e e x p o s u r e t i m e .  

L C D _ T E S T  

T h e a i m o f t h i s b l o c k i s t o d i s p l a y i n f o r m a t i o n o n t h e L C D s c r e e n o f t h e D E 2  

B o a r d . I t h a s s e v e r a l i n p u t s a n d o u t p u t s ( C r e a t e d B l o c k ) :  

• I n p u t s :  

  i C L K : m a i n c l o c k .  

  i S w i t c h N : a c t i v a t e t h e L C D s c r e e n .  

  i R S T _ N : m a i n r e s e t .  

• O u t p u t s :  

  o T e s t L E D : a c t i v a t e o n e L E D w h e n L C D i s a c t i v a t e d .  

  L C D _ D A T A : d a t a s e n t t o t h e L C D .  

  L C D _ R W : r e a d ( 0 ) o r w r i t e ( 1 ) m o d e .  

  L C D _ E N : e n a b l e t h e L C D .  

  L C D _ R S : u s h t h e s c r e e n .  

5 . 2 R e c o r d i n g a n d s t o r a g e c h a i n  

T h i s s e c t i o n d e s c r i b e s t h e s e c o n d g o a l o f t h e p r o j e c t : t o r e c o r d a n d s t o r e a v i d e o  

c a p t u r e d b y t h e c a m e r a s e n s o r . I n C h a p t e r 1 , t h e s o f t c o r e p r o c e s s o r i s i n v o l v e d i n  

t h e w e b - s e r v e r a n d a l g o r i t h m s p a r t s . B u t , t h e n e e d o f a s o f t c o r e p r o c e s s o r c o m e s  

e a r l i e r . I n f a c t s , i t a p p e a r s t o b e v e r y h a r d t o u s e b o t h t h e S D - C a r d a n d t h e S D - R a m  

o n l y w i t h   V e r i l o g   b l o c k s . T h e r e f o r e , t h e i m p l e m e n t a t i o n o f t h e   N i o s I I   p r o c e s s o r  

i s d e s c r i b e d i n t h i s s e c t i o n i n s t e a d o f t h e n e x t o n e , a s w r i t t e n p r e v i o u s l y .  

5 . 2 . 1 I m p l e m e n t a t i o n o f t h e   N i o s I I  

I n o r d e r t o a c c e s s t h e m e m o r y b l o c k o f t h e b o a r d , a n d l a t e r i m p l e m e n t t h e a l -  

g o r i t h m i n   C / C + +   , a c o n v e n i e n t s o l u t i o n i s t o u s e a s o f t c o r e p r o c e s s o r . A s a n  

A l t e r a   D E 2 B o a r d i s u s e d , a   N i o s I I   p r o c e s s o r i s u s e d a s t h e s o f t c o r e p r o c e s s o r .  

B u t a c u s t o m v e r s i o n h a s t o b e c r e a t e d t o s a t i s e d t h e p o s s i b i l i t i e s o f t h e b o a r d u s e d  

f o r t h i s p r o j e c t . T o d o s o , t h e   N i o s I I   m a n u a l w a s u s e d t o h a v e a b e t t e r u n d e r -  

s t a n d i n g o f t h e d i e r e n t m o d u l e s [ C o r 0 7 ] . F i g u r e 5 . 6 , o n p a g e 6 4 s h o w s s o m e o f t h e  

m o d u l e s a c c e s s i b l e f o r t h e   N i o s I I   s o f t c o r e p r o c e s s o r , w h i l e F i g u r e 5 . 7 , o n p a g e 6 4  

d e t a i l s t h e b l o c k d i a g r a m o f t h e   N i o s I I   c o r e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 80/110

6 4  5 . I m p l e m e n t a t i o n  

F i g u r e 5 . 6 : G e n e r i c   N i o s I I   d i a g r a m : i t i n c l u d e s s e v e r a l c o m p o n e n t s a r o u n d t h e  

N i o s   c o r e p r o c e s s o r [ C o r 0 7 ] .  

F i g u r e 5 . 7 : G e n e r i c   N i o s I I   c o r e b l o c k d i a g r a m : i t d e s c r i b e s t h e c o m p o n e n t s i n -  

c l u d e d i n t h e   N i o s   c o r e [ C o r 0 7 ] .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 81/110

5 . 2 R e c o r d i n g a n d s t o r a g e c h a i n   6 5 

I n o r d e r t o c r e a t e t h i s c u s t o m v e r s i o n o f t h e   N i o s I I   p r o c e s s o r , o n e n e e d s t o f o l l o w  

s e v e r a l s t e p s :  

1 . C r e a t e a   Q u a r t u s I I   p r o j e c t  

2 . C r e a t e t h e   N i o s I I   u s i n g S O P C B u i l d e r  

3 . M a k e t h e p i n s p l a n o f t h e F P G A ( i . e . a s s o c i a t e e a c h p i n o f t h e b o a r d t o i n p u t s  

a n d / o r o u t p u t s )  

4 . A d d t h e t t i n g m o d u l e s o n t h e   N i o s I I   ( i . e . V G A C o n t r o l l e r , m e m o r y c o n -  

t r o l l e r , e t c . )  

5 . V e r i f y t h a t i t w o r k s ( i . e . b u i l d a n d r u n a t e s t p r o g r a m o n t h e   N i o s I I   ) 

T h e c u s t o m v e r s i o n u s e d i n t h i s p r o j e c t c o n t a i n s t h e f o l l o w i n g m o d u l e s :  

• N i o s   s t a n d a r d c o r e , w i t h J T A G d e b u g l e v e l 2 ( R I S C 3 2 b i t s p r o c e s s o r @ 1 0 0  

M H z ) .  

• S R A M c o n t r o l l e r .  

• L E D r e d & g r e e n p a r a l l e l o u t p u t s .  

• J T A G M o d u l e .  

• T r i - s t a t e A v a l o n b r i d g e t o c o n t r o l a s h m e m o r y .  

• F l a s h m e m o r y c o n t r o l l e r .  

• L C D c o n t r o l l e r .  

• B u t t o n & s w i t c h p a r a l l e l i n p u t s .  

• D M A 9 0 0 0 c o n t r o l l e r ( E t h e r n e t p o r t o f t h e D E 2 B o a r d ) .  

• 7 - s e g m e n t s c o n t r o l l e r .  

• S D - C a r d c o n t r o l l e r ( 3 - b i t s i n p u t s / o u t p u t s ) .  

• V a r i o u s p a r a l l e l i n p u t s / o u t p u t s ( P I O ) f o r t h e p r o c e s s o r t o c o m m u n i c a t e w i t h  

t h e r e s t o f t h e s y s t e m .  

A J T A G d e b u g l e v e l 2 w a s u s e d . I t m e a n s t h a t o n e c a n d e b u g t h e p r o g r a m o n t h e  

N i o s I I   d i r e c t l y , a n d u s e s o m e b r e a k p o i n t s a n d v i e w s o m e v a r i a b l e s v a l u e s . T h e r e  

a r e v e l e v e l o f d e b u g , f o r m 0 t o 5 . E a c h l e v e l a l l o w s m o r e v a r i a b l e s v a l u e s t o b e  

v i e w e d a n d m o r e b r e a k p o i n t s t o b e p u t , b u t r e q u i r e s m o r e l o g i c e l e m e n t s .  

5 . 2 . 2 R e c o r d c a p t u r e d v i d e o  

T h e r s t p a r t o f t h i s b l o c k i s t h e m e m o r y b l o c k . I n f a c t , m e m o r y i s v e r y i m p o r t a n t  

i n t h i s s t e p , a s i t r e q u i r e s t o s t o r e t e m p o r a r i l y a l o t o f f r a m e c a p t u r e d b y t h e w e b -  

c a m . T h e r s t p r o b l e m t h a t a p p e a r e d i s t h a t o n e f r a m e i s a r o u n d 1 M B :  

640 · 480 · 24

8= 921600Bytes = 900kB

( 5 . 2 )  

( 8 b i t s p e r c o l o u r * 3 c o l o u r s ( r e d , g r e e n a n d b l u e ) = 2 4 b i t s p e r p i x e l , a f r a m e i s  

6 4 0 x 4 8 0 p i x e l s , 1 b y t e s = 8 b i t s & 1 k B = 1 0 2 4 B . )  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 82/110

6 6  5 . I m p l e m e n t a t i o n  

T h e a v a i l a b l e t e m p o r a r y m e m o r y o n t h e b o a r d i s 8 M B f o r t h e S D R A M , w h i c h  

m e a n s n o m o r e t h a n 8 i m a g e s s i m u l t a n e o u s l y . I t i s q u i t e a p r o b l e m t o c a p t u r e a  

v i d e o , r u n n i n g 2 4 f r a m e p e r s e c o n d w h i l e p r o c e s s i n g 3 i m a g e s s i m u l t a n e o u s l y w i t h  

t h e p r o c e s s o r ( t h e b a c k g r o u n d i m a g e , t h e a c t u a l i m a g e a n d t h e t e m p o r a r y g r e y - s c a l e d  

i m a g e ) . I t m e a n s t h a t t h e p r o c e s s o r n e e d t o a c c e s s t h e S D - C a r d a r o u n d 3 t i m e s p e r  

s e c o n d . I t i s i m p o s s i b l e t o h a v e s u c h a s p e e d t o a c c e s s t h i s k i n d o f m e m o r y .  

5 . 2 . 3 S t o r e r e c o r d e d v i d e o  

A s t h e p r e v i o u s b l o c k i s n e a r l y i m p o s s i b l e t o m a k e w i t h t h e a v a i l a b l e d e v e l o p m e n t  

b o a r d , t h i s p a r t c a n n o t b e e i t h e r d o n e n o r t e s t e d . I f t h e S D R A M c h i p w a s a r o u n d  

2 5 6 M B , a v i d e o c o u l d h a v e b e e n r e c o r d e d a n d p r o c e s s e d i n t h e s a m e t i m e . T o h a v e  

a b e t t e r p r o c e s s i n g , t h e o p t i m a l s o l u t i o n s h o u l d h a v e u s e d t w o c h i p s o f 2 5 6 M B , o n e  

a s t h e p r o c e s s o r R A M , o n e f o r t h e h a r d w a r e b l o c k s t o r e c o r d t h e v i d e o .  

5 . 2 . 4 A c c e s s r e c o r d e d v i d e o  

( a ) N o - d a t a o p e r a t i o n  

( b ) R e a d - b l o c k o p e r a t i o n  

( c ) W r i t e - b l o c k o p e r a t i o n  

F i g u r e 5 . 8 : D i e r e n t o p e r a t i o n o n t h e S D - C a r d : t h o s e d i a g r a m s e n l i g h t e n t h e u s e o f  

a 2 - b i t s c o m m u n i c a t i o n c h a n n e l b e t w e e n t h e   F P G A   a n d t h e S D - C a r d [ A s s 0 6 ] .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 83/110

5 . 3 I n t e l l i g e n t c a m e r a   6 7 

T h e w a y t o u s e t h e S D - C a r d w i t h t h e   F P G A   i s t o g e t a 1 - b i t a c c e s s t o t h e S D -  

C a r d . T h e S D - C a r d c o n t r o l l e r m o d u l e o f t h e c u s t o m o f t h e   N i o s I I   u s e d i n t h i s  

p r o j e c t h a s a 3 - b i t s o u t p u t : o n e b i t f o r t h e c l o c k , o n e b i t f o r t h e c o m m a n d a n d o n e  

b i t f o r t h e d a t a . F i g u r e 5 . 8 ( a ) s h o w s a n o - d a t a o p e r a t i o n w i t h t h e S D - C a r d , F i g u r e  

5 . 8 ( b ) s h o w s a b a s i c r e a d - b l o c k o p e r a t i o n a n d n a l l y F i g u r e 5 . 8 ( c ) s h o w s a b a s i c  

w r i t e - b l o c k o p e r a t i o n ( t h o s e g u r e s a r e o n p a g e 6 6 ) .  

F i g u r e 5 . 9 : B l o c k d i a g r a m o f t h e S D - C a r d c u s t o m d r i v e r  

T h e r e a r e n o e x i s t i n g I P - b l o c k t o u s e e a s i l y t h e S D - C a r d . T h e t i m e t o d e v e l o p a  

s p e c i c c u s t o m d r i v e r t o u s e i t d u r i n g t h e p r o j e c t w a s t o o l o n g . M o r e o v e r , t h e a i m  

o f t h i s p r o j e c t w a s t o i m p l e m e n t a n i n t e l l i g e n t s u r v e i l l a n c e v i d e o c a m e r a , u s i n g t h e  

S D - C a r d a s a t o o l t o s t o r e d a t a , n o t t o d e v e l o p a c u s t o m S D - C a r d d r i v e r . T h i s p a r t  

w a s n o t d o n e , b u t c a n b e c o n s i d e r e d a s a l o n g t e r m f u t u r e w o r k . I n f a c t , t h i s b l o c k  

s h o u l d c o n t a i n e d t h e m a i n c o m m a n d s t o s e n d t o t h e S D - C a r d a n d a n i n p u t t o s e n d  

t h e d a t a . F i g u r e 5 . 9 , o n p a g e 6 7 , b r i e y d e s c r i b e s h o w t h e b l o c k s h o u l d l o o k l i k e t o  

t i n t h e s y s t e m .  

5 . 3 I n t e l l i g e n t c a m e r a  

T h i s s e c t i o n d e s c r i b e s m a i n l y t h e i m p l e m e n t a t i o n o f t h e m o t i o n d e t e c t i o n a l g o -  

r i t h m . A r s t d r a f t w a s m a d e t o m a k e a l l m e a s u r e m e n t s i n C h a p t e r 4 . T h e n a l  

v e r s i o n , d e t a i l e d b e l o w i s t h e d r a f t a d a p t e d t o t h e s p e c i c i t i e s o f t h e   N i o s I I   p r o -  

c e s s o r a n d u s i n g t h e i n p u t s a n d o u t p u t s a v a i l a b l e t o i t .  

5 . 3 . 1 M o t i o n d e t e c t i o n a l g o r i t h m  

T h e a l g o r i t h m w a s i n c - c o d e f o r b e i n g s t u d i e d . F r o m t h i s w o r k i n g d r a f t , a   N i o s I I  

v e r s i o n o f t h e c o d e w a s w r i t t e n . T h e m a i n p o i n t s t h a t h a v e b e e n c h a n g e d c o n c e r n e d :  

• s t r i n g s : t h e   N i o s I I   d o e s n o t r e c o g n i s e d c h a r * t y p e a s a s t r i n g b u t c h a r [ x ]  

( w i t h x t h e n u m b e r o f c h a r a c t e r ) ;  

• l e s p a t h : t h e d r a f t u s e d d e s k t o p p a t h t o a c c e s s l e . W i t h t h e u s e o f t h e h o s t  

l e s y s t e m , t h o s e p a t h s h a d t o b e c h a n g e d ( a s e x p l a i n e d i n C h a p t e r 6 , p a g e  

6 9 ) ;  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 84/110

6 8  5 . I m p l e m e n t a t i o n  

• s m a l l b u g s .  

F o r m o r e d e t a i l s a b o u t t h e a l g o r i t h m , p l e a s e s e e C h a p t e r 4 f o r t h e a n a l y s i s a n d  

d e s i g n a n d C h a p t e r 6 f o r t h e r e s u l t s o f t e s t s a n d e x p e r i m e n t s .  

A l t h o u g h t h e a i m o f s t u d y i n g t h e a l g o r i t h m b y c a l c u l a t i n g m e t r i c s a n d p r o l i n g  

i t t o g e t a n i d e a o f t h e h a r d w a r e a n d s o f t w a r e c o - d e s i g n , t h e a l g o r i t h m i s f u l l y  

i m p l e m e n t e d i n s o f t w a r e . T h e r s t r e a s o n i s t h a t t h e t o o l , C 2 H , p r o v i d e d i n   A l t e r a  

d e v e l o p m e n t s o f t w a r e , i s v e r y h a r d t o u s e . T h e s e c o n d r e a s o n i s t h a t , i f t h e c o d e t o  

b e a c c e l e r a t e d d o e s n o t f u l l s o m e r e q u i r e m e n t s , t h e r e c a n b e n o a c c e l e r a t i o n . T h e  

n a l r e a s o n i s t h a t t h e m a i n b o t t l e n e c k s o f t h e a l g o r i t h m a r e m e m o r y a c c e s s e s , a n d  

t h i s c a n n o t b e a c c e l e r a t e d , e x c e p t b y a d d i n g o t h e r m e m o r y c h i p s .  

5 . 4 N o n i m p l e m e n t e d b l o c k s  

A s t h e r e c o r d i n g a n d s t o r a g e p a r t s w e r e n o t f u l l y i m p l e m e n t e d , t h e f o l l o w i n g  

b l o c k s w e r e n o t i m p l e m e n t e d . I t i s h o w e v e r p o s s i b l e t o i m p l e m e n t t h e m b y u s i n g t h e  

p r e v i o u s l y p r o p o s e d s o l u t i o n , w h i c h i s d e s c r i b e d i n C h a p t e r 7 .  

• I P c a m e r a : t h i s p a r t s h o u l d h a s p r e s e n t s t h e i m p l e m e n t a t i o n o f a w e b - s e r v e r  

o n t h e s o f t c o r e p r o c e s s o r . A s i t i s c o n d i t i o n e d b y t h e i m p l e m e n t a t i o n o f t h e  

S D - C a r d d r i v e r , b e c a u s e t h e a i m o f t h i s b l o c k i s t o a c c e s s d a t a s t o r e d i n t o t h e  

S D - C a r d , t h e w e b - s e r v e r i s n o t i m p l e m e n t e d .  

• O p t i m i z e d i n t e l l i g e n t c a m e r a : t h i s p a r t o f t h e p r o j e c t s h o u l d h a v e p r e s e n t s t h e  

i m p l e m e n t a t i o n o f t h e v i d e o c o m p r e s s i o n a l g o r i t h m . A s n o v i d e o s a r e s t o r e d  

b y t h e s y s t e m , i t i s i m p o s s i b l e t o i m p l e m e n t t h i s f e a t u r e .  

• C o m p l e t e i n t e l l i g e n t I P c a m e r a : t h i s b l o c k s h o u l d h a v e p r e s e n t s t h e i m p l e -  

m e n t a t i o n o f a l l t h e b l o c k s t o g e t h e r . A s n o t a l l t h e b l o c k s a r e w o r k i n g o r  

i m p l e m e n t e d , t h e i m p l e m e n t a t i o n o f t h i s p a r t i s n o t d o n e .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 85/110

Chapter6T e s t i n g & E x p e r i m e n t s    

F i g u r e 6 . 1 : L o c a t i o n i n t h e   A3p a r a d i g m , h i g h l i g h t e d b y t h e p u r p l e c i r c l e  

T h e r s t s e c t i o n o f t h i s c h a p t e r d e a l s w i t h t h e t e s t i n g s c e n a r i o s u s e d t o v a l i d a t e  

t h e i m p l e m e n t a t i o n , t o b e s u r e t o h a v e a s o l i d f u l l y f u n c t i o n a l b a s i s o n w h i c h t h e  

i m p l e m e n t a t i o n o f o t h e r b l o c k s c a n b e f o l l o w e d t h r o u g h . T h e s e c o n d s e c t i o n d e -  

t a i l s t h e d i e r e n t e x p e r i m e n t s m a d e t o e n s u r e t h a t t h e i m p l e m e n t a t i o n m e e t s t h e  

6 9 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 86/110

7 0  6 . T e s t i n g & E x p e r i m e n t s  

( a ) G l o b a l l o c a t i o n ( b ) E l a b o r a t e d l o c a t i o n  

F i g u r e 6 . 2 : L o c a t i o n i n t h e R u g b y M e t a - M o d e l , h i g h l i g h t e d b y t h e g r e y b a r o n ( a )  

a n d g r e y a r r o w s o n ( b ) .  

r e q u i r e m e n t s a n d c o n s t r a i n t s d e n e d i n C h a p t e r 1 a n d C h a p t e r 3 ( m a i n l y t h e s p e e d  

c r i t e r i a ) .  

6 . 1 T e s t i n g  

T h i s s e c t i o n p r e s e n t s t h e m a i n t e s t s c e n a r i o s u s e d t o v e r i f y t h a t t h e a c t u a l i m p l e -  

m e n t a t i o n i s f u n c t i o n i n g a s e x p e c t e d . T h e s e c t i o n i s t h e r e f o r e m a i n l y o r g a n i z e d a s  

t h e p r e v i o u s c h a p t e r , w i t h e a c h s t e p o f t h e i m p l e m e n t a t i o n t e s t e d o n e a f t e r a n o t h e r .  

6 . 1 . 1 T r a n s m i s s i o n c h a i n t e s t i n g  

T h e r s t s t e p o f t h e i m p l e m e n t a t i o n n e e d s t o f u n c t i o n a s r e q u i r e d f o r t h e p r o j e c t  

t o c o n t i n u e . T h e t e s t s c e n a r i o u s e d h e r e i s q u i t e s t r a i g h t f o r w a r d , a s t h e m a i n f u n c -  

t i o n a l i t i e s t o b e t e s t e d a r e t h e c a p t u r e o f a p i c t u r e w i t h a v i d e o c a m e r a a n d t h e  

d i s p l a y o f t h i s p i c t u r e o n a V G A s c r e e n . T h e s c e n a r i o c o n s i s t s i n c a p t u r i n g a p i c t u r e  

w i t h t h e c a m e r a s e n s o r a n d d i s p l a y i n g i t o n t h e V G A s c r e e n .  

6 . 1 . 2 M o t i o n d e t e c t i o n a l g o r i t h m t e s t i n g  

I n o r d e r t o v a l i d a t e t h e m o t i o n d e t e c t i o n a l g o r i t h m , t h e r s t d r a f t w a s t e s t e d o n  

a d e s k t o p c o m p u t e r , t o b e p r o l e d a n d a n a l y s e d w i t h d i e r e n t m e t r i c s t o c a l c u l a t e  

t h e a l g o r i t h m ' s c o m p l e x i t y f o r i n s t a n c e . ( p l e a s e r e f e r t o C h a p t e r 4 ) . T h e n , o n c e t h e  

d r a f t v a l i d a t e d a n d t h e   N i o s I I   i m p l e m e n t e d , t h e n a l v e r s i o n o f t h e a l g o r i t h m i s t o  

b e t e s t e d . T h e i m a g e s u s e d t o t e s t t h i s a l g o r i t h m b o t h o n t h e d e s k t o p c o m p u t e r a n d  

o n t h e   N i o s I I   a r e t h e s a m e . T h o s e t w o p i c t u r e s h a v e t h e f o l l o w i n g c h a r a c t e r i s t i c s :  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 87/110

6 . 2 E x p e r i m e n t s   7 1 

• R e s o l u t i o n : 6 4 0 x 4 8 0 p i x e l s ;  

• C o l o u r d e p t h : 2 4 b i t s ;  

• M o v i n g e l e m e n t s i z e : 4 5 0 x 3 0 0 p i x e l s .  

( a ) F r a m e 1 : b a c k g r o u n d ( b ) F r a m e 2 : n e w f r a m e  

( c ) R e s u l t o f m o t i o n d e t e c t i o n  

F i g u r e 6 . 3 : R e s u l t s o f m o t i o n d e t e c t i o n e x p e r i m e n t s : f r a m e ( a ) i s c o n s i d e r e d a s t h e  

b a c k g r o u n d f r a m e , w h i l e f r a m e ( b ) i s t h e c u r r e n t f r a m e . I t i s s u b t r a c t e d b y t h e  

b a c k g r o u n d t o d e t e c t m o t i o n . ( c ) i s t h e r e s u l t o f t h e c o m p a r i s o n : b l a c k p i x e l s a r e  

w h e n n o m o t i o n i s d e t e c t e d a n d g r e y p i x e l s e n l i g h t e n s t h e m o t i o n .  

T h e r e s u l t s o b t a i n e d a r e s a t i s f a c t o r y , a s t h e a l g o r i t h m i s a b l e t o d e t e c t a m o t i o n .  

T h e r e s u l t o f t h e t e s t , r u n n i n g o n t h e   N i o s I I   i s s h o w n i n F i g u r e 6 . 3 ( p a g e 7 1 ) . T h i s  

e x a m p l e s h o w s t h a t t h e a l g o r i t h m r u n n i n g o n t h e   N i o s I I   h a s t h e s a m e b e h a v i o u r  

a s w h e n r u n n i n g o n a d e s k t o p c o m p u t e r .  

6 . 2 E x p e r i m e n t s  

T h i s s e c t i o n p r e s e n t s t h e m a i n e x p e r i m e n t s d o n e t o v e r i f y t h a t t h e i m p l e m e n t a t i o n  

s a t i s e s t h e r e q u i r e m e n t s a n d c o n s t r a i n t s o f t h e s y s t e m .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 88/110

7 2  6 . T e s t i n g & E x p e r i m e n t s  

6 . 2 . 1 T r a n s m i s s i o n c h a i n t e s t i n g  

D u r i n g t h i s p h a s e , s e v e r a l e x p e r i m e n t s w e r e d o n e t o u n d e r s t a n d t h e e x i s t i n g b l o c k s  

t o a d a p t t h e m t o t h e p r o j e c t r e q u i r e m e n t s a n d c o n s t r a i n t s i n a r s t e x p e r i m e n t .  

T h e n , a f t e r h a v i n g m o d i e d t h e b l o c k s , a n e x p e r i m e n t w a s p e r f o r m e d t o o b s e r v e t h e  

d a t a a c q u i s i t i o n a n d t o v a l i d a t e t h e t e s t s r e s u l t s .  

6 . 2 . 2 M o t i o n d e t e c t i o n a l g o r i t h m e x p e r i m e n t s  

T h e e x p e r i m e n t s s c e n a r i o i s q u i t e s i m p l e : c o m p a r e t w o b y t w o a s e t o f 3 0 p i c t u r e s .  

T h o s e p i c t u r e s h a v e t h e f o l l o w i n g c h a r a c t e r i s t i c s :  

• R e s o l u t i o n : 1 5 0 x 1 5 0 p i x e l s ;  

• C o l o u r d e p t h : 2 4 b i t s ;  

• M o v i n g e l e m e n t s i z e : 1 5 x 1 5 p i x e l s ( i n F i g u r e 6 . 4 , t h e s m a l l p e n g u i n p i c t u r e ) .  

T h e p i c t u r e s a r e l o c a t e d o n t h e h o s t c o m p u t e r , u s i n g t h e h o s t l e s y s t e m p o s s i b i l i t y  

o f t h e   N i o s I I   I D E , t o f a c i l i t a t e r e s u l t s e x t r a c t i o n a n d i m a g e s t o r a g e o n t h e F P G A .  

T h e r e s u l t s o b t a i n e d a r e s a t i s f a c t o r y , a s t h e a l g o r i t h m i s a b l e t o d e t e c t a m o t i o n o n  

a q u i t e d i c u l t b a c k g r o u n d . E x a m p l e s o f t h e r e s u l t s a r e s h o w n i n F i g u r e 6 . 4 ( p a g e  

7 3 ) . A s t h e f r a m e s a r e s u b t r a c t e d , w h e n n o m o t i o n i s d e t e c t e d , t h e r e s u l t i s b l a c k  

p i x e l s . H o w e v e r , i f a m o t i o n i s d e t e c t e d , t h e r e s u l t d i s p l a y s t h e p i x e l s ( i n g r e y - s c a l e  

v a l u e ) c o n s i d e r e d a s d i e r e n t f o r m t h e b a c k g r o u n d t h u s d e t e c t e d a s m o v i n g o b j e c t s .  

T h o s e e x a m p l e s u n d e r l i n e t h e c o m p l e x i t y o f t h e b a c k g r o u n d . T h e y a l s o s h o w t h a t  

t h e r e s u l t e d p i c t u r e s o n l y d i s p l a y t h e p i x e l s i n m o t i o n .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 89/110

6 . 2 E x p e r i m e n t s   7 3 

( a ) F r a m e 1 : b a c k g r o u n d 1 ( b ) F r a m e 2 : n e w f r a m e 1  

( c ) R e s u l t o f m o t i o n d e t e c t i o n 1 ( d ) F r a m e 3 : b a c k g r o u n d 2  

( e ) F r a m e 2 : n e w f r a m e 2 ( f ) R e s u l t o f m o t i o n d e t e c t i o n 2  

F i g u r e 6 . 4 : R e s u l t s o f m o t i o n d e t e c t i o n e x p e r i m e n t s : f r a m e s ( a ) a n d ( d ) a r e c o n -  

s i d e r e d a s b a c k g r o u n d b e c a u s e t h e y a r e t h e o l d f r a m e s . F r a m e s ( b ) a n d ( e ) a r e  

t h e c u r r e n t f r a m e s , a n d a r e s u b t r a c t e d b y t h e b a c k g r o u n d t o d e t e c t m o t i o n . F r a m e s  

( c ) a n d ( f ) a r e t h e r e s u l t s o f t h e c o m p a r i s o n s : b l a c k p i x e l s a r e w h e n n o m o t i o n i s  

d e t e c t e d a n d g r e y p i x e l s e n l i g h t e n t h e m o t i o n .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 90/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 91/110

Chapter7C o n c l u s i o n a n d F u t u r e W o r k      

T h e r s t s e c t i o n o f t h i s c h a p t e r p r e s e n t s t h e c o n c l u s i o n s o f t h e p r o j e c t . T h e  

s e c o n d s e c t i o n l i s t s p o s s i b l e f u t u r e w o r k o n t h i s p r o j e c t , b o t h f o r s h o r t - a n d l o n g -  

t e r m p e r s p e c t i v e s .  

7 . 1 C o n c l u s i o n  

T h e r s t p a r t o f t h e c o n c l u s i o n i s a r e m i n d e r o f t h e p r o b l e m s t a t e m e n t d e n e d  

i n t h e r s t c h a p t e r . T h e n t h e w o r k d o n e t o a t t e m p t a n s w e r i n g t h i s q u e s t i o n i s  

s u m m a r i z e d . F i n a l l y , a n a l a n s w e r i s g i v e n a n d a p o s s i b l e w a y t o a n s w e r d i e r e n t l y  

t o t h i s p r o b l e m i s p r o p o s e d .  

7 . 1 . 1 W h a t h a s b e e n d o n e t o a n s w e r t h e p r o b l e m  

A s d e n e d i n C h a p t e r 1 , t h e p r o b l e m s t a t e m e n t o f t h i s p r o j e c t i s :  

I s i t p o s s i b l e t o i m p l e m e n t a n i n t e l l i g e n t I P v i d e o s u r v e i l l a n c e c a m e r a o n  

a F i e l d P r o g r a m m a b l e G a t e A r r a y (  F P G A  

) p l a t f o r m t o o p t i m i z e v i d e o  

s u r v e i l l a n c e ?  

T h e f o l l o w i n g p a r a g r a p h s u m m a r i z e s t h e m a i n i s s u e s e n c o u n t e r e d d u r i n g t h i s  

p r o j e c t a n d t h e n t h e m a i n f u l l y o p e r a t i o n a l b l o c k s t h a t w e r e i m p l e m e n t e d a r e d e -  

s c r i b e d .  

P r o b l e m s e n c o u n t e r e d  

T h e m a i n t e c h n i c a l p r o b l e m e n c o u n t e r e d c o n c e r n s m e m o r y . T h e r s t p o i n t i s  

t h a t i t i s i m p o s s i b l e t o g i v e a r e a d ( o r w r i t e ) a c c e s s o f a s i n g l e m e m o r y c h i p t o t w o  

( o r m o r e ) d i e r e n t b l o c k s . T h a t p r e v e n t s c o n i c t s o n t h i s s p e c i c c h i p . B u t t h a t  

a l s o f o r b i d t h e s o f t c o r e p r o c e s s o r t o a c c e s s t h e m e m o r y w h e r e h a r d w a r e b l o c k s w r i t e  

p i c t u r e s c a p t u r e d b y t h e s e n s o r . T h e s e c o n d p o i n t i s t h a t t h e r e s o l u t i o n o f t h e s e n s o r  

i s q u i t e b i g ( 6 4 0 x 4 8 0 p i x e l s ) a n d c o l o u r v a l u e s o f p i x e l s a r e s t o r e d n o t c o m p r e s s e d .  

T h i s m e a n s t h a t t h e m e m o r y c h i p m u s t b e b i g g e r t h a t t h e o n e u s e d t o r e c o r d m o r e  

t h a n a f e w p i c t u r e ( l e s s t h a n t e n n o w ) . T h o s e m e m o r y p r o b l e m s h a v e b e e n a c r u c i a l  

c o n c e r n s d u r i n g t h e w h o l e d e v e l o p p e m e n t .  

7 5 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 92/110

7 6  7 . C o n c l u s i o n a n d F u t u r e W o r k  

A s e c o n d t e c h n i c a l p r o b l e m s i s t h e S D - C a r d a c c e s s . I n f a c t s , i t r e q u i r e s t o d e v e l o p  

a c u s t o m d r i v e r f r o m t h e S D - C a r d s p e c i c a t i o n . W h i c h m e a n s w a s t i n g a l o t o f t i m e  

t o s t u d y a n d u n d e r s t a n d t h i s s p e c i c a t i o n b e f o r e i m p l e m e n t a n d t e s t i n g a d r i v e r j u s t  

t o u s e a t o o l .  

A n i m p o r t a n t p o i n t w h i c h b e c a m e a p r o b l e m i s t h a t e v e n i f t h e r e a r e I n t e l l e c t u a l  

P r o p e r t y ( I P ) b l o c k s f o r s o m e p a r t s o f t h e s y s t e m , i t i s n e i t h e r e a s y n o r s t r a i g h t f o r -  

w a r d t o i m p l e m e n t t h e m t o g e t h e r a n d g e t a n a l w o r k i n g p r o t o t y p e . I n f a c t s , e a c h  

I P b l o c k s h a s i t s o w n a r c h i t e c t u r e r e q u i r e m e n t s . T h e r e f o r e , i f o n e w a n t t o l o w e r t h e  

d e v e l o p m e n t t i m e b y u s i n g I P b l o c k s , m o s t o f t h e t i m e o n e d i d n o t s u c c e e d b y w a s t -  

i n g t i m e t r y i n g t o t t h e s e l e c t e d I P b l o c k t o t h e d e s i r e d s y s t e m . T h e k n o w l e d g e  

r e q u i r e d t o e a s e t h o s e I P b l o c k s i n t e g r a t i o n a n d c o m m u n i c a t i o n i s f a r f r o m b e i n g  

n e g l i g i b l e .  

A n o t h e r p r o b l e m e n c o u n t e r e d i s t h e s k i l l s r e q u i r e d t o u s e d e v e l o p m e n t t o o l s a n d  

l a n g u a g e s u s e d d u r i n g t h i s p r o j e c t . I n f a c t s , t h e t o o l s a r e q u i t e s p e c i c a n d a r e  

d e p e n d a n t o f t h e s e l e c t e d p l a t f o r m (  A l t e r a   o r  X i l i n x   ) . T h i s r e q u i r e t o m a k e  

c h o i c e v e r y e a r l y d u r i n g t h e p r o j e c t , o f t e n w i t h o u t t h e m o s t c o m p l e t e v i e w o f i t .  

M o r e o v e r , t h e l e a r n i n g c u r v e i s v e r y s t e e p i n t h e b e g i n n i n g , t h e d e v e l o p e r s a n d d e -  

s i g n e r s h a v e t o l e a r n h o w t o u s e t h e p r o v i d e d t o o l s a n d b e c o m e e c i e n t w h i l e u s i n g  

n e w l a n g u a g e s . T h i s l e a r n i n g c u r v e s h o u l d b e m i n i m i z e d d u r i n g e a r l y d e s i g n c h o i c e ,  

m o s t l y b e c a u s e t h o s e d i c u l t i e s r e v e a l t h e m s e l v e s a l o n g t h e p r o j e c t p r o g r e s s e s . B u t  

i t s t i l l s t a y s h i g h , a s h a r d w a r e a n d s o f t w a r e c o - d e s i g n i m p l i e s m i x i n g d i e r e n t l a n -  

g u a g e s a n d t o o l s t o g e t h e r , a n d t h e r e f o r e u n d e r s t a n d i n g t h e c o m m u n i c a t i o n b e t w e e n  

t h o s e . W h i c h i s a c o r e i s s u e a s e x p e r i e n c e d w i t h t h e m e m o r y m a n a g e m e n t p r o b l e m .  

E s p e c i a l l y f o r p e o p l e c o m i n g f r o m a m o r e s o f t w a r e o r i e n t e d d e v e l o p m e n t e l d a n d  

w h o a r e n o t n e w t o t h e H a r d w a r e / S o f t w a r e C o - D e s i s g n c o n c e p t . M o r e o v e r s o m e o f  

t h e d o c u m e n t a t i o n s t h a t c o u l d h a v e b e e n h e l p f u l h a v e b e e n p u b l i s h e d a f e w w e e k s  

b e f o r e t h e e n d o f t h i s p r o j e c t , m a k i n g t h e m n e a r l y i m p o s s i b l e t o b e n e t f r o m t h e m .  

O p e r a t i o n a l b l o c k s  

E v e n i f t h e p r e v i o u s p r o b l e m s d i d n o t a l l o w t h e p r o j e c t t o b e f u l l y n i s h e d , t h e  

f o l l o w i n g b l o c k s a r e f u n c t i o n i n g a c c o r d i n g t o t h e r e q u i r e m e n t s a n d c o n s t r a i n t s p r e -  

v i o u s l y d e n e d . I n f a c t s , t h e t r a n s m i s s i o n c h a i n , t h e f u n d a m e n t a l b l o c k , u p o n w h i c h  

t h e r e s t o f t h e i m p l e m e n t a t i o n i s d o n e , w o r k p e r f e c t l y .  

T h e s o f t c o r e p r o c e s s o r b l o c k i s a l s o c o m p l e t e l y w o r k i n g . M o r e o v e r , s o m e c o m -  

p o n e n t s c a n b e a d d e d i n t h i s b l o c k t o e n h a n c e t h e p o s s i b i l i t i e s . W i t h t h e s o f t c o r e  

p r o c e s s o r r u n n i n g , t h e m o t i o n d e t e c t i o n a l g o r i t h m i s a l s o f u l l y i m p l e m e n t e d .  

A s d e t a i l e d i n C h a p t e r 5 ( p a g e 5 5 ) , s t u d i e s a b o u t r e c o r d i n g , s t o r a g e a n d S D - C a r d  

h a v e a l s o b e e n d o n e . T h e s p e c i c a t i o n s o f c o n s t r a i n t s o f t h e s y s t e m a n d t h e d e t a i l e d  

a l g o r i t h m a n a l y s i s a n d d e s i g n a l s o p r o v i d e a c l e a r m e t h o d o l o g y t o c o n t i n u e t h i s  

p r o j e c t .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 93/110

7 . 2 F u t u r e w o r k s   7 7 

7 . 1 . 2 A n s w e r t o t h e p r o b l e m  

T h e a n s w e r t o t h e p r o b l e m s t a t e m e n t s e e m s t o b e     y e s   . I t i s p r e s u m a b l y p o s s i b l e  

t o i m p l e m e n t a n i n t e l l i g e n t I P v i d e o s u r v e i l l a n c e c a m e r a o n a   F P G A   p l a t f o r m t o  

o p t i m i z e v i d e o s u r v e i l l a n c e . S e v e r a l p o i n t s h i g h l i g h t t h i s . I n f a c t s , w i t h a n o t h e r  

d e v e l o p m e n t p l a t f o r m a n d a l a r g e r t i m e f r a m e , t h e m a i n p r o b l e m e n c o u n t e r e d c o u l d  

h a v e b e e n s o l v e d v e r y T h e n e x t p a r a g r a p h p r e s e n t s a p o s s i b l e s o l u t i o n . L a s t b u t n o t  

l e a s t , t h e i m p l e m e n t a t i o n o f t h e a l g o r i t h m o n t h e   F P G A   i s f u n c t i o n i n g . T h e r e f o r e ,  

r e c o r d i n g a n d s t o r i n g d a t a o n l y w h e n a n e v e n t h a p p e n s i s p o s s i b l e a n d j u s t a  

s t e p f u r t h e r . S o o p t i m i z i n g v i d e o s u r v e i l l a n c e s e e m s t o b e p o s s i b l e b y u s i n g   F P G A  

p l a t f o r m .  

7 . 1 . 3 S o l u t i o n p r o p o s a l f o r a c o m p l e t e o p e r a t i o n a l s y s t e m  

A s e x p l a i n a b o v e , n e i t h e r o f t h e a c c e s s i b l e d e v e l o p m e n t b o a r d t t e d p e r f e c t l y t h e  

s y s t e m d e s i g n . A s o l u t i o n t o a c h i e v e a p r o t o t y p e t o s h o w t h a t u s i n g a n   F P G A   c a n 

e n h a n c e a v i d e o s u r v e i l l a n c e c a m e r a i s t o b u i l d a c u s t o m d e v e l o p m e n t b o a r d . A s a  

m a t t e r o f f a c t s , t h i s c u s t o m b o a r d s h o u l d p r e s e n t t h e f o l l o w i n g c h a r a c t e r i s t i c s :  

• C o n n e c t o r s :  

  V G A ;  

  E t h e r n e t ;  

  J T A G ;  

  G P I O ;  

  S w i t c h e s ;  

  B u t t o n s ;  

  S D - C a r d c o n t r o l l e r .  

• C h i p s :  

  F P G A   ( t h e   C y c l o n e I I   w a s p o w e r f u l e n o u g h ) ;  

  S D R A M : 2 x 2 5 6 M e g a B y t e s ( o n e c h i p f o r t h e   N i o s I I   p a r t a n d o n e f o r  

t h e h a r d w a r e p a r t ) ;  

7 . 2 F u t u r e w o r k s  

T h i s s e c t i o n g i v e a n o n e x h a u s t i v e l i s t o f p o s s i b l e f u t u r e w o r k . S h o r t t e r m f u t u r e  

w o r k s a r e p r e s e n t e d r s t , t h e n f o l l o w e d b y t h e l o n g t e r m o n e s .  

7 . 2 . 1 S h o r t t e r m f u t u r e w o r k s  

T h i s s e c t i o n p r e s e n t s t h e s h o r t t e r m s f u t u r e w o r k s t o c o n t i n u e t h i s p r o j e c t .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 94/110

7 8  7 . C o n c l u s i o n a n d F u t u r e W o r k  

A r s t p o s s i b i l i t y c o u l d b e t o s t u d y a n d i m p l e m e n t t h e S D - C a r d d r i v e r ( o r c o n -  

t r o l l e r ) e s p e c i a l l y w i t h t h e n e w d a t a a v a i l a b e o n t h e   A l t e r a   w e b s i t e c o n c e r n i n g  

t h i s p a r t i c u l a r p o i n t . I t a l l o w s d a t a t o b e r e a d a n d w r i t e f r o m t h e   N i o s I I   o n a n  

S D - C a r d a n d , t h e r e f o r e , a v o i d s u s i n g h o s t l e s y s t e m s o l u t i o n t o t e s t a n d e x p e r i -  

m e n t s t h e a l g o r i t h m . W h i c h s h o u l d a l s o s p e e d u p t h e a l g o r i t h m p r o c e s s i n g s p e e d b y  

a v o i d i n g t h e l a t e n c y a n d o v e r h e a d a d d e d b y u s i n g t h e d e b u g m o d e o f t h e   N i o s I I  

a n d t h e J T A G c a b l e .  

A s e c o n d s h o r t t e r m i m p r o v e m e n t s h o u l d b e t h e i m p l e m e n t a t i o n o f s o m e p a r t  

o f t h e M o t i o n D e t e c t i o n a l g o r i t h m d i r e c t l y i n t o h a r d w a r e f u n c t i o n a v a i l a b l e f o r t h e  

N i o s I I   . T h e u s e o f t h e C 2 H t o o l s c o u l d b e p l a n e d f o r i n s t a n c e .  

A t h i r d s h o r t t e r m p o s s i b i l i t y i s t o i m p l e m e n t t h e w e b - s e r v e r t o a l l o w a u s e r t o  

a c c e s s d a t a f a s t e r t h a n t h r o u g h t h e J T A G c o n n e c t i o n . I t a l s o e n h a n c e t h e i m p l e -  

m e n t a t i o n o f t h e S D - C a r d c o n t r o l l e r .  

7 . 2 . 2 L o n g t e r m f u t u r e w o r k s  

T h i s s e c t i o n p r e s e n t s t h e l o n g t e r m s f u t u r e w o r k s t o i m p r o v e t h i s p r o j e c t  

R e c o r d i n g a n d s t o r i n g c h a i n  

A s t h i s p a r t o f t h e p r o j e c t r e q u i r e a s p e c i c d e v e l o p m e n t p l a t f o r m , i t i s c o n s i d e r e d  

a s a l o n g t e r m f u t u r e w o r k . M o r e o v e r , t h i s i m p l e m e n t a t i o n c o u l d u n d e r l i n e t h e  

a n s w e r t o t h e p r o b l e m g i v e n i n t h e p r e v i o u s s e c t i o n . I n f a c t , t o i m p l e m e n t t h i s  

c h a i n , i t r e q u i r e s r s t t o d e v e l o p a c u s t o m d e v e l o p m e n t p l a t f o r m , a s d e s c r i b e d i n  

S e c t i o n 7 . 1 . 3 .  

V i d e o c o m p r e s s i o n a l g o r i t h m  

A g o a l o f t h i s p r o j e c t w a s t o i m p l e m e n t a v i d e o c o m p r e s s i o n a l g o r i t h m . T h i s a l l o w s  

t h e o w n e r t o s a v e m o r e s p a c e a n d m o n e y b y r e d u c i n g t h e n u m b e r o f m e m o r y c a r d  

r e q u i r e d t o s t o r e s u r v e i l l a n c e d a t a . A p o s s i b l e f u t u r e w o r k c o u l d b e t o i m p l e m e n t  

t h i s a l g o r i t h m u p o n t h e v i d e o s u r v e i l l a n c e c a m e r a . T h i s p a r t c a n e n l i g h t e n t h e  

a d v a n t a g e s o f h a v i n g a p l a t f o r m b a s e d o n a n   F P G A   r a t h e r o n a s i n g l e p r o c e s s o r :  

h a v i n g t w o a l g o r i t h m s ( m o t i o n d e t e c t i o n a n d v i d e o c o m p r e s s i o n ) r u n n i n g o n o n e  

c h i p a l s o r e d u c e d a t a t r e a t m e n t c o s t s .  

P o w e r c o n s u m p t i o n  

A n o t h e r c o n s t r a i n t c o u l d b e t h e p o w e r c o n s u m p t i o n a s s u r v e i l l a n c e s y s t e m s c o u l d  

b e u s e i n n o - e l e c t r i c i t y e n v i r o n m e n t . T h i s c o n s t r a i n t i s n o t s o r e l e v a n t b e c a u s e e v e n  

f o r s u r v e i l l a n c e s y s t e m s , t h e y a r e m o s t l y p l u g g e d t o a e l e c t r i c i t y s o u r c e . M o r e o v e r ,  

t h e c o n s t r a i n t w i l l d e p e n d m a i n l y o f t h e p l a t f o r m u s e d . A s a f u t u r e w o r k , o n e i d e a  

c o u l d b e t o r e d u c e t h e p o w e r c o n s u m p t i o n o f t h e g l o b a l s y s t e m . I t c a n b e d o n e e i t h e r  

b y r e d u c i n g o r o p t i m i z e d t h e a r e a u s e d b y t h e s y s t e m o n t h e   F P G A   , b u t a l s o b y  

s t u d y i n g t h e p o s s i b i l i t y o f a n A S I C s i m p l e m e n t a t i o n w i t h a f u l l y w o r k i n g p r o t o t y p e  

o n  F P G A   d e v e l o p m e n t p l a t f o r m ( i n c l u d i n g a l l c h i p s i n o n e A S I C : m e m o r i e s ,   F P G A  

, e t c . ) .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 95/110

P a r t I I  

A p p e n d i c e s & R e f e r e n c e s    

7 9 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 96/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 97/110

G l o s s a r y      

T h i s a p p e n d i x p r e s e n t s s e v e r a l d e n i t i o n s .  

A H a r d w a r e / s o f t w a r e c o - d e s i g n d e n i t i o n  

O n e o f t h e k e y n o t i o n i n t h i s p r o j e c t i s t h e h a r d w a r e a n d s o f t w a r e c o - d e s i g n  

[ W o l 0 3 ] . T h i s c o n c e p t h a s b e e n c r e a t e d a l i t t l e m o r e t h a n a d e c a d e a g o i n r e s p o n s e  

t o t h e r a i s e o f t h e e m b e d d e d s y s t e m s , t h e c o m p l e x i t y a n d t h e h e t e r o g e n e i t y o f t h o s e  

s y s t e m s . A s a n e x a m p l e , a l r e a d y i n 1 9 9 8 , 9 8 % o f t h e p r o c e s s o r s w e r e f o u n d i n e m -  

b e d d e d s y s t e m s . E m b e d d e d s y s t e m s a r e s i n g l e - f u n c t i o n n e d , t i g h t l y c o n s t r a i n t e d ,  

r e a c t i v e a n d r e a l t i m e s y s t e m s . W h e n d e s i g n i n g a e m b b e d d e d s y s t e m , t h e p a r t i -  

t i o n n i n g b e t w e e n h a r d w a r e a n d s o f t w a r e i s a c r u c i a l p o i n t . H a r d w a r e h a s b e t t e r  

p e r f o r m a n c e s b u t i s m o r e d i c u l t t o c o d e c o n t r a r y t o s o f t w a r e .  

F i g u r e 3 . 3 , o n p a g e 2 7 , e n l i g h t e n s t h a t t o d e a l w i t h t i m e a n d p e r f o r m a n c e c o n -  

s t r a i n t s , a d e s i g n e r h a s t o m a k e c h o i c e s a b o u t p a r t i t i o n n i n g . T h i s p a r t i t i o n n i n g  

a n d s c h e d u l i n g a r e t h e 2 m a i n d i m e n s i o n s o f t h e C o - D e s i g n . S o f t w a r e - h a r d w a r e C o -  

D e s i g n c a n b e s u m m a r i z e d i n t h e f o l l o w i n g w a y .  

S o f t w a r e / h a r d w a r e c o - d e s i g n p r o v i d e s a w a y o f c u s t o m i z i n g t h e h a r d w a r e a n d t h e  

s o f t w a r e a r c h i t e c t u r e s t o c o m p l e m e n t o n e a n o t h e r i n w a y s w h i c h i m p r o v e s y s t e m  

 f u n c t i o n a l i t y , p e r f o r m a n c e , r e l i a b i l i t y , s u r v i v a b i l i t y a n d c o s t / e e c t i v e n e s s .  [ S F L 8 5 ]  

B  O S 

I t i s t h e s o f t w a r e c o m p o n e n t o f a c o m p u t e r s y s t e m t h a t i s r e s p o n s i b l e f o r t h e  

m a n a g e m e n t a n d c o o r d i n a t i o n o f a c t i v i t i e s a n d t h e s h a r i n g o f t h e r e s o u r c e s o f t h e  

c o m p u t e r i s c a l l e d a n o p e r a t i n g s y s t e m . T h e O p e r a t i n g S y s t e m ( O S ) a c t s a s a n  

h o s t f o r a p p l i c a t i o n p r o g r a m s t h a t a r e r u n n i n g o n t h e m a c h i n e . A s a h o s t , o n e o f  

t h e p u r p o s e s o f a n o p e r a t i n g s y s t e m i s t o h a n d l e t h e d e t a i l s o f t h e o p e r a t i o n o f t h e  

h a r d w a r e .  

C e m b e d d e d   O S 

A n e m b e d d e d o p e r a t i n g s y s t e m i s a n   O S  f o r e m b e d d e d s y s t e m s . T h e s e   O S  a r e s p e -  

c i a l i z e d , c o m p a c t a n d e c i e n t . T h e y d o n ' t h a v e a l l t h e f u n c t i o n s t h e n o n - e m b e d d e d  

c o m p u t e r h a v e b e c a u s e t h e y d o n ' t n e e d t h e m . T h e e m b e d d e d   O S  a r e d e s i g n e d t o  

o p e r a t e a s r e a l - t i m e o p e r a t i n g s y s t e m s .  

8 1 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 98/110

8 2  . G l o s s a r y  

D H a r d w a r e D e s c r i p t i o n L a n g u a g e d e n i t i o n  

I n e l e c t r o n i c s , a n H a r d w a r e D e s c r i p t i o n L a n g u a g e o r H D L i s a c o m p u t e r l a n g u a g e  

f o r f o r m a l d e s c r i p t i o n o f e l e c t r o n i c c i r c u i t s . I t c a n d e s c r i b e a n o p e r a t i o n m a d e b y  

a c i r c u i t , i t s d e s i g n a n d o r g a n i z a t i o n . I t c a n a l s o s i m u l a t e a n d t e s t s t o v e r i f y t h i s  

o p e r a t i o n .  

A H a r d w a r e D e s c r i p t i o n L a n g u a g e i s w r i t t e n i n s t a n d a r d t e x t - b a s e d a n d d e s c r i b e s  

t h e t e m p o r a l b e h a v i o u r c i r c u i t s t r u c t u r e o f a n e l e c t r o n i c s y s t e m ( f o r e x a m p l e F P G A ) .  

d i e r i n g f r o m t h e s o f t w a r e p r o g r a m m i n g l a n g u a g e s , a n H D L ' s s y n t a x a n d s e m a n t i c s  

t a k e i n a c c o u n t t h e t i m e a n d t h e c o n c u r r e n c y b e t w e e n p r o c e s s e s . T h e l a n g u a g e s  

d e s c r i b i n g t h e c i r c u i t c o n n e c t i v i t y b e t w e e n a c l a s s i e d h i e r a r c h y o f b l o c k s a r e n e t l i s t  

l a n g u a g e s .  

E x e c u t a b l e s p e c i c a t i o n s f o r h a r d w a r e c a n b e w r i t t e n w i t h H D L s . T h e s i m u l a t i o n  

p r o g r a m a s i t i s t a k e s a l s o t h e t i m e i n a c c o u n t a l l o w t h e p r o g r a m m e r s t o m o d e l a  

p i e c e o f h a r d w a r e b e f o r e i t i s c r e a t e d p h y s i c a l l y . W i t h t h e h a r d w a r e d e s c r i p t i o n s a  

s o f t w a r e p r o g r a m c a l l e d a s y n t h e s i z e r c a n i n f e r h a r d w a r e l o g i c o p e r a t i o n s f r o m t h e  

l a n g u a g e s t a t e m e n t s a n d p r o d u c e a n e q u i v a l e n t n e t l i s t o f g e n e r i c h a r d w a r e p r i m i t i v e s  

t o i m p l e m e n t t h e s p e c i e d b e h a v i o u r o n t h e p l a t f o r m .  

A s d e s i g n i n g a s y s t e m i n H D L i s g e n e r a l l y m u c h h a r d e r a n d m o r e t i m e c o n s u m i n g  

t h a n w r i t i n g t h e e q u i v a l e n t p r o g r a m i n a C l i k e l a n g u a g e . T o s o l v e t h i s d i c u l t y ,  

t h e r e h a s b e e n m u c h w o r k d o n e o n a u t o m a t i c c o n v e r s i o n o f C c o d e i n t o H D L .  

E S y s t e m D e s c r i p t i o n L a n g u a g e d e n i t i o n  

A S y s t e m D e s c r i p t i o n L a n g u a g e ( S D L ) i s m o r e t h a n a H D L b e c a u s e i t c a n b e u s e d  

f o r d e s i g n i n g t h e w h o l e s y s t e m , u n l i k e H D L w h i c h a r e u s e d o n l y f o r c o d i n g b l o c k s .  

C o n c e r n i n g t h e i r c h a r a c t e r i s t i c s , t h e S D L s a r e :  

• M a d e f o r S y s t e m - o n - C h i p d e s i g n  

• U s e d t o m o v e t o H i g h e r l e v e l s o f a b s t r a c t i o n  

• U s e d t o d e s i g n a c o m p l e t e s y s t e m - > t o b e c o m p l e t e d  

F h i g h - l e v e l p r o g r a m m i n g l a n g u a g e d e n i t i o n  

A s h o r t d e n i t i o n o f a h i g h - l e v e l p r o g r a m m i n g l a n g u a g e i s t h a t t h e y m a y b e m o r e  

a b s t r a c t , e a s i e r t o u s e o r m o r e p o r t a b l e a c r o s s p l a t f o r m s t h a n l o w - l e v e l l a n g u a g e s .  

H i g h l e v e l l a n g u a g e s a r e s u p p o s e d t o m a k e c o m p l e x p r o g r a m m i n g s i m p l e r a n d l o w  

l e v e l l a n g u a g e s m a k e m o r e e c i e n t c o d e . T h e y c o n s u m e m o r e m e m o r y , h a v e a l a r g e r  

b i n a r y s i z e a n d a r e s l o w e r a t t h e e x e c u t i o n .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 99/110

G s o f t c o r e p r o c e s s o r d e n i t i o n   8 3 

I n f a c t t h e d i e r e n c e b e t w e e n l o w a n d h i g h l e v e l l a n g u a g e s c o u l d b e v e r y r e l a t i v e ,  

o r i g i n a l l y , C l a n g u a g e w a s c o n s i d e r e d a s h i g h l e v e l l a n g u a g e a n d n o w d e p e n d i n g o n  

t h e c o n t e x t , i t c a n b e a l s o c o n s i d e r e d a s a l o w l e v e l l a n g u a g e b e c a u s e i t s t i l l a l l o w s  

m e m o r y t o b e a c c e s s e d b y a d d r e s s , a n d p r o v i d e s d i r e c t a c c e s s t o t h e a s s e m b l y l e v e l  

G s o f t c o r e p r o c e s s o r d e n i t i o n  

A s o f t c o r e p r o c e s s o r p r o c e s s o r i s a p r o c e s s o r i m p l e m e n t e d i n t o a r e p r o g r a m m a b l e  

s y s t e m l i k e a   F P G A   . I t i s a S y s t e m o n P r o g r a m m a b l e C h i p o r S o P C .  

t h e s o f t c o r e p r o c e s s o r i s a v e r y e x i b l e a r c h i t e c t u r e , i t c a n b e r e c o n g u r e d a t a n y  

t i m e , c o n t r a r y t o a h a r d c o r e p r o c e s s o r w h o s e c o r e h a s i t o w n n o n - r e p r o g r a m m a b l e  

c h i p . A s o f t c o r e p r o c e s s o r c a n b e a d a p t e d t o t h e m a t e r i a l c o n s t r a i n t s ( p e r f o r m a n c e s ,  

r e s o u r c e s , p o w e r c o n s u m p t i o n , . . . ) . H o w e v e r , s o f t c o r e p r o c e s s o r p e r f o r m a n c e s a r e  

i n f e r i o r t o t h e h a r d c o r e o n e s b u t a s o f t c o r e p r o c e s s o r i s e a s i e r t o m a i n t a i n a n d c a n  

i m p l e m e n t e d i n t o a n A S I C ( A p p l i c a t i o n S p e c i c I n t e g r a t e d C i r c u i t ) .  

H E m b e d d e d   F P G A   d e n i t i o n  

F P G A   m e a n s e l d - p r o g r a m m a b l e g a t e a r r a y a n d s t a n d s f o r a s e m i c o n d u c t o r d e -  

v i c e c o n t a i n i n g p r o g r a m m a b l e l o g i c c o m p o n e n t s c a l l e d l o g i c b l o c k s i n c l u d i n g m e m -  

o r i e s , a n d p r o g r a m m a b l e i n t e r c o n n e c t s . T h e d e s i g n e r c a n p r o g r a m t h e l o g i c b l o c s a n d  

t h e i n t e r c o n n e c t s l i k e a o n e - c h i p p r o g r a m m a b l e b r e a d b o a r d .  

I n t h e d e s i g n o w o f a n e w p r o d u c t , t h e e a r l y d e s i g n s a r e u s i n g F P G A s t h e n  

m i g r a t e d i n t o a x e d v e r s i o n t h a t m o r e r e s e m b l e s a n A S I C . A S I C m e a n s a p p l i c a t i o n -  

s p e c i c i n t e g r a t e d c i r c u i t a n d s t a n d s f o r a n a n i n t e g r a t e d c i r c u i t c u s t o m i z e d f o r a  

p a r t i c u l a r u s e . T o b e c o n g u r e d , t h e   F P G A   h a s t o b e d e s c r i b e d b y a l o g i c c i r c u i t  

d i a g r a m o r o r a s o u r c e c o d e u s i n g a h a r d w a r e d e s c r i p t i o n l a n g u a g e ( d e n e d i n a n o t h e r  

p a r a g r a p h ) .  

T a b l e H , p a g e 8 3 , s u m m a r i z e s t h e p r o s a n d t h e c o n s o f t h e F P G A s .  

P r o s C o n s  

T i m e - t o - m a r k e t s h o r t e r t h a n  

A S I C s  

S l o w e r t h a n A S I C s  

D e v e l o p m e n t c o s t c h e a p e r  

t h a n A S I C s  

M o r e e x p e n s i v e f o r m a s s p r o -  

d u c t i o n s t h a n A S I C s  

l o w e r n o n - r e c u r r i n g e n g i n e e r -  

i n g c o s t s t h a n A S I C s  

M o r e p o w e r c o n s u m i n g t h a n  

A S I C s  

r e - p r o g r a m m a b l e i n t h e e l d  

T a b l e 1 : P r o s a n d c o n s o f   F P G A   : d e s p i t e i t s l o w e r p e r f o r m a n c e s c o m p a r e d t o  

A S I C s , F P G A s a r e m o r e e x i b l e a n d e a s y t o d e v e l o p  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 100/110

8 4  . G l o s s a r y  

I O t h e r a c r o n y m s  

I . 1 S D d e n i t i o n  

S D s t a n d s f o r S e c u r e C a r d , a t y p e o f m e m o r y c a r d .  

I . 2 M M C d e n i t i o n  

M M C s t a n d s f o r M u l t i m e d i a C a r d , a t y p e o f m e m o r y c a r d .  

I . 3 A S I C d e n i t i o n  

A S I C s t a n d s f o r A p p l i c a t i o n S p e c i c I n t e g r a t e d C i r c u i t .  

I . 4 S o P C d e n i t i o n  

S o P C s t a n d s f o r S y s t e m o n P r o g r a m m a b l e C h i p .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 101/110

A l g o r i t h m s i m p l i e d c a l l g r a p h      

H e r e i s t h e s i m p l i e d c a l l g r a p h o f t h e s o f t w a r e w r i t t e n i n C , b a s e d o n t h e a l g o r i t h m  

u s e d i n t h e p r o j e c t , r a n o n a d e s k t o p c o m p u t e r .  

F i g u r e 1 : S i m p l i e d c a l l g r a p h o f t h e C v e r s i o n o f t h e a l g o r i t h m : T h e g r e e n b o x e s  

a r e D e s k t o p v e r s i o n s p e c i c ( u s e d t o l o a d a n d s a v e B M P l e s ) a n d t h e r e d b o x e s a r e  

t h e a l g o r i t h m p a r t s i m p l e m e n t e d i n c  

8 5 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 102/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 103/110

T i m e p l a n      

T h e t i m e p l a n o f t h e p r o j e c t i s F i g u r e 2 o n p a g e 8 8 .  

8 7 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 104/110

8 8  . T i m e p l a n  

F i g u r e 2 : G A N T T D i a g r a m o f t h e P r o j e c t  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 105/110

C D - R o m c o n t e n t    

T h e C D - R o m o f t h e r e p o r t c o n t a i n s t h e f o l l o w i n g i t e m s :  

• E l e c t r o n i c v e r s i o n o f t h e p r e s e n t r e p o r t ;  

• R T L v i e w o f a l l h a r d w a r e b l o c k s ;  

• S e t o f 3 0 p i c t u r e s a n d r e s u l t s u s e d i n t h e a l g o r i t h m e x p e r i m e n t ;  

• A l g o r i t h m s o u r c e c o d e (  N i o s I I   v e r s i o n ) ;  

• H a r d w a r e b l o c k s s o u r c e c o d e .  

8 9 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 106/110

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 107/110

R e f e r e n c e s    

[ A A S  

+0 7 ] R a s m u s A b i l d g r e n , A l e k s a n d r a s , S a r a m e n t o v a s    , P a u l i u s R u z g y s    , P e t e r  

K o c h , a n d Y a n n i c k L e M o u l l e c . A l g o r i t h m - a r c h i t e c t u r e a n i t y p a r a l -  

l e l i s m c h a n g e s t h e p i c t u r e . 2 0 0 7 .  

[ A i r 8 3 ] U n i t e d S t a t e s A i r f o r c e .   V H S I C H a r d w a r e D e s c r i p t i o n L a n g u a g e   , 1 9 8 3 .  

[ A S R  

+0 5 ] R a s m u s A b i l d g r e n , A l e k s a n d r a s S a r a m e n t o v a s , P a u l i u s R u z g y s , P e t e r  

K o c h , a n d Y a n n i c k L e M o u l l e c . A l g o r i t h m - a r c h i t e c t u r e a n i t y p a r a l -  

l e l i s m c h a n g e s t h e p i c t u r e .   A a l b o r g U n i v e r s i t y  , 2 0 0 5 .  

[ A s s 0 6 ] T e c h n i c a l C o m m i t t e e S D C a r d A s s o c i a t i o n .   S D S p e c i c a t i o n s , P a r t 1 :  

P h y s i c a l L a y e r , S i m p l i e d S p e c i c a t i o n   , 2 0 0 6 .  

[ C e l 0 5 ] C e l o x i c a .   H a n d e l - C L a n g u a g e R e f e r e n c e M a n u a l  , 2 0 0 5 .  

[ C G 0 5 ] C a d e n c e a n d M e n t o r G r a p h i c .   O p e n S y s t e m C L a n g u a g e R e f e r e n c e M a n -  

u a l  , 2 0 0 5 .  

[ C G P P 0 3 ] R i t a C u c c h i a r a , C o s t a n t i n o G r a n a , M a s s i m o P i c c a r d i , a n d A n d r e a P r a t i .  

D e t e c t i n g m o v i n g o b j e c t s , g h o s t s a n d s h a d o w s i n v i d e o s t r e a m s . 2 0 0 3 .  

[ C o m 0 7 ] I n t e r n a t i o n a l S t a n d a r d C o m i t t e e .   P r o g r a m m i n g l a n g u a g e C   , 2 0 0 7 .  

[ C o r 0 6 a ] A l t e r a C o r p o r a t i o n .   D E 2 D e v e l o p m e n t a n d E d u c a t i o n B o a r d U s e r m a n -  

u a l 1 . 4 ( N i o s I I , C y c l o n e I I )  , 2 0 0 6 .  

[ C o r 0 6 b ] X i l i n x C o r p o r a t i o n .   R C 2 0 3 d e v e l o p m e n t a n d e d u c a t i o n b o a r d D a t a s h e e t  , 

2 0 0 6 .  

[ C o r 0 7 ] A l t e r a C o r p o r a t i o n .   N i o s I I P r o c e s s o r R e f e r e n c e H a n d b o o k  , 2 0 0 7 .  

[ C o r 0 8 ] A l t e r a C o r p o r a t i o n .   S t r a t i x D e v i c e H a n d b o o k  , 2 0 0 8 .  

[ C u s 0 3 ] M a u r i c e C u s s o n . L a v i d é o s u r v e i l l a n c e : l e s r a i s o n s d e s e s s u c c è s e t d e s e s  

é c h e c s .   h t t p : / / w w w . c r i m i n o l o g i e . c o m / c u s s o n / c u s v i d e o . p d f  , 2 0 0 3 . w r i t t e n  

i n F r e n c h , l a s t v i s i t d a t e : A p r i l 2 0 0 8 .  

[ D e v 9 8 ] N i c o l a s D e v i l l a r d . F a s t m e d i a n s e a r c h : a n a n s i c i m p l e m e n t a t i o n . 1 9 9 8 .  

[ D ö m 0 3 ] R a i n e r D ö m e r . T h e S p e c C L a n g u a g e . 2 0 0 3 .  

9 1 

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 108/110

9 2  R e f e r e n c e s  

[ D T m 0 3 ]   M u l t i - G r a n u l a r i t y M e t r i c s f o r t h e E r a o f S t r o n g l y P e r s o n a l i z e d S O C s  , 

2 0 0 3 . P r o c e e d i n g s o f t h e D e s i g n , A u t o m a t i o n a n d T e s t i n E u r o p e C o n -  

f e r e n c e a n d E x h i b i t i o n ( D A T E ' 0 3 ) .  

[ f o u 0 6 ] P y t h o n S o f t w a r e f o u n d a t i o n .   P y t h o n r e f e r e n c e m a n u a l   , 2 0 0 6 .  

[ G a j 8 8 ] D a n i e l D . G a j s k i .   S i l i c o n C o m p i l a t i o n   . A d d i s o n - W e s l e y P u b l i s h i n g C o m -  

p a n y , 1 9 8 8 .  

[ G H C 0 7 ] J i r i G a i s l e r , S a n d i H a b i n c , a n d E d v i n C a t o v i c .   G R L I B I P l i b r a i r y U s e r ' s  

m a n u a l  , 2 0 0 7 .  

[ G K M ] S u s a n L . G r a h a m , P e t e r B . K e s s l e r , a n d M a r s h a l l K . M c K u s i c k . g p r o f :  

a C a l l G r a p h E x e c u t i o n P r o l e r .  

[ H J K 9 9 ] A h m e d H e m a n i , A x e l J a n t s c h , a n d S h a s h i K u m a r . T h e r u g b y m o d e l : A  

f r a m e w o r k f o r t h e s t u d y o f m o d e l i n g , a n a l y s i s , a n d s y n t h e s i s c o n c e p t s i n  

e l e c t r o n i c s y s t e m s .   P r o c e e d i n g s o f D e s i g n A u t o m a t i o n a n d T e s t i n E u r o p e  

( D A T E )  , 1 9 9 9 .  

[ H J K 0 0 ] A h m e d H e m a n i , A x e l J a n t s c h , a n d S h a s h i K u m a r . T h e r u g b y m e t a -  

m o d e l .   E l e c t r o n i c S y s t e m D e s i g n L a b  , 2 0 0 0 .  

[ I D T 9 5 ]   I m a g e d i e r e n c e t h r e s h o l d s t r a t e g i e s a n d s h a d o w d e t e c t i o n   , 1 9 9 5 . P r o -  

c e e d i n g s o f t h e 6 t h B r i t i s h M a c h i n e V i s i o n C o n f e r e n c e .  

[ I n c 0 7 ] X i l i n x I n c o r p o r a t i o n .   M i c r o B l a z e P r o c e s s o r r e f e r e n c e G u i d e  , 2 0 0 7 .  

[ I n c 0 8 a ] A l t e r a I n c o r p o r a t i o n .   N i o s I I S o f t w a r e D e v e l o p e r ' s H a n d b o o k  , 2 0 0 8 .  

[ I n c 0 8 b ] A l t e r a I n c o r p o r a t i o n .   Q u a r t u s I I D e v e l o p m e n t S o f t w a r e H a n d b o o k v 8 . 0  , 

2 0 0 8 .  

[ i n c 0 8 c ] T h e M a t h W o r k s i n c o r p o r a t i o n .   M a t l a b 7 D e s k t o p T o o l s a n d D e v e l o p m e n t  

E n v i r o n m e n t  , 2 0 0 8 .  

[ K G 8 3 ] R o b e r t H . K u h n a n d D a n i e l D . G a j s k i . G u e s t e d i t o r ' s i n t r o d u c t i o n : N e w  

v l s i t o o l s .   I E E E C o m p u t e r , p a g e s 1 1 - 1 4  , 1 9 8 3 .  

[ K o c ] P e t e r K o c h . H a r d w a r e / S o f t w a r e C o d e s i g n c o n s t r a i n t s .  

[ L a b 0 2 ] J e a n J . L a b r o s s e .   M i c r o C / O S - I I  . C M P B o o k s , 2 0 0 2 .  

[ L a e 0 7 ] A r n i m L a e u g e r . S d / m m c b o o t l o a d e r .  

h t t p : / / w w w . o p e n c o r e s . o r g / p r o j e c t s . c g i / w e b / s p i _ b o o t / o v e r v i e w   , 2 0 0 7 .  

l a s t v i s i t d a t e : A p r i l 2 0 0 8 .  

[ L u ] P i n g - H o n g L u . L i g h t s o u r c e m o t i o n t r a c k i n g ( u s i n g t e r a s i c d e 2 b o a r d ) .  

h t t p : / / i n s t r u c t 1 . c i t . c o r n e l l . e d u / c o u r s e s / e c e 5 7 6 / F i n a l P r o j e c t s / f 2 0 0 7 / p l 3 2 8 / p l 3 2 8 / i n d e x

: V i s i t e d 2 2 / 0 5 / 2 0 0 8 .  

[ M D A  

+0 5 ] Y a n n i c k L e M o u l l e c , J e a n - P h i l i p p e D i g u e t , N a d e r B e n A m o r , T h i e r r y  

G o u r d e a u x , a n d J e a n - L u c P h i l i p p e . A l g o r i t h m i c - l e v e l S p e c i c a t i o n a n d  

C h a r a c t e r i z a t i o n o f E m b e d d e d M u l t i m e d i a A p p l i c a t i o n s w i t h D e s i g n  

T r o t t e r .   J o u r n a l o f V L S I S i g n a l P r o c e s s i n g 4 2  , 2 0 0 5 .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 109/110

R E F E R E N C E S   9 3 

[ M o u 0 8 ] Y a n n i c k L e M o u l l e c . A S P I 8 - S 2 - 1 1 : H W / S W C o - d e s i g n - M M 5 : A u t o -  

m a t e d H W / S W p a r t i t i o n i n g a n d m e t r i c s f o r H W / S W p a r t i t i o n i n g S l i d e s ,  

2 0 0 8 .  

[ o I ] I n t e r n a t i o n a l C o m m i s s i o n o n I l l u m i n a t i o n . I t u - r r e c o m m e n d a t i o n b t . 6 0 1 -  

2 .  E n c o d i n g p a r a m e t e r s o f d i g i t a l t e l e v i s i o n f o r s t u d i o s  . 

[ P i c 0 4 a ] M a s s i m o P i c c a r d i . B a c k g r o u n d s u b t r a c t i o n t e c h n i q u e s : A r e v i e w . 2 0 0 4  

I E E E I n t e r n a t i o n a l C o n f e r e n c e o n S y s t e m s , M a n a n d C y b e r n e t i c s , I E E E ,  

2 0 0 4 .  

[ P i c 0 4 b ] M a s s i m o P i c c a r d i . B a c k g r o u n d s u b t r a c t i o n t e c h n i q u e s : A r e v i e w . T h e  

A R C C e n t r e o f E x c e l l e n c e f o r A u t o n o m o u s S y s t e m s ( C A S ) F a c u l t y o f  

E n g i n e e r i n g , U n i v e r s i t y o f T e c h n o l o g y ( U T S ) , S y d n e y , 2 0 0 4 .  

[ P o r 0 7 ] M a c i e j P o r t a l s k i . H a r d w a r e a s p e c t s o f x e d r e l a y s t a t i o n d e s i g n f o r  

o f d m ( a ) b a s e d w i r e l e s s r e l a y n e t w o r k s . M a s t e r ' s t h e s i s , A a l b o r g U n i -  

v e r s i t y , D e p a r t m e n t o f E l e c t r o n i c s S y s t e m s , 2 0 0 7 .  

[ P T 0 5 ] D a v i d P e l l e r i n a n d S c o t t T h i b a u l t .   P r a c t i c a l F P G A P r o g r a m m i n g i n C   . 

C M P B o o k s , 2 0 0 5 .  

[ R o s 9 5 ] P a u l L . R o s i n . T h r e s h o l d i n g f o r c h a n g e d e t e c t i o n . 1 9 9 5 .  

[ S F L 8 5 ] C o n n i e U . S m i t h , G e o r e y A . F r a n k , a n d J o h n L . A n a r c h i t e c t u r e d e s i g n  

a n d a s s e s s m e n t s y s t e m f o r s o f t w a r e / h a r d w a r e c o d e s i g n . 1 9 8 5 .  

[ T D M P 8 5 ] T h o m a s , D o n a l d a , M o o r b y , a n d P h i l l i p .   T h e V e r i l o g H a r d w a r e D e s c r i p -  

t i o n L a n g u a g e  , 1 9 8 5 .  

[ t e a 0 7 ] T e a c h i n g t e a m . A p p l i e d s i g n a l p r o c e s s i n g a n d i m p l e m e n t a t i o n , i n t r o -  

d u c t i o n s l i d e s . 2 0 0 7 .  

[ T e c 0 6 ] T e r a s i c T e c h n o l o g i e s .   T R D B _ D C 2 C a m e r a D e v e l o p m e n t P a c k a g e U s e r  

G u i d e  , 2 0 0 6 .  

[ U n i 8 9 ] O x f o r d U n i v e r s i t y . O x f o r d e n g l i s h d i c t i o n a r y . 1 9 8 9 .  

[ W i k a ] W i k i p e d i a . o r g .   C + + P r o g r a m m i n g  . h t t p : / / e n . w i k i p e d i a . o r g / w i k i / C % 2 B % 2 B  

: V i s i t e d 2 2 / 0 5 / 2 0 0 8 .  

[ W i k b ] W i k i p e d i a . o r g . P e r f o r m a n c e a n a l y s i s .  

h t t p : / / e n . w i k i p e d i a . o r g / w i k i / P e r f o r m a n c e _ a n a l y s i s : L a s t V i s i t e d  

2 2 / 0 5 / 2 0 0 8 .  

[ W i k c ] W i k i p e d i a . o r g . S o f t w a r e m e t r i c . h t t p : / / e n . w i k i p e d i a . o r g / w i k i / S o f t w a r e _ m e t r i c  

: V i s i t e d 2 2 / 0 5 / 2 0 0 8 .  

[ W i k d ] W i k i p e d i a . o r g . V e r i l o g ( i n t e r n e t ) . h t t p : / / e n . w i k i p e d i a . o r g / w i k i / V e r i l o g  

: V i s i t e d 2 2 / 0 5 / 2 0 0 8 .  

[ W i n 0 6 ] H e r m a n n W i n k l e r . D d r s d r a m c o n t r o l l e r c o r e .  

h t t p : / / w w w . o p e n c o r e s . o r g / p r o j e c t s . c g i / w e b / d d r _ s d r / o v e r v i e w   , 2 0 0 6 .  

l a s t v i s i t d a t e : A p r i l 2 0 0 8 .  

8/2/2019 Intelligent Ip Camera - Fpga Motion Detection Implementation

http://slidepdf.com/reader/full/intelligent-ip-camera-fpga-motion-detection-implementation 110/110

9 4  R e f e r e n c e s  

[ W i r ] N i k l a u s W i r t h .   A l g o r i t h m s + D a t a s t r u c t u r e s = P r o g r a m s  . 

[ W o l 0 3 ] W a y n e W o l f . A D e c a d e o f H a r d w a r e / S o f t w a r e C o d e s i g n .   I E E E   , 2 0 0 3 .