C C T V B A S E D SENSING T E C H N I Q U E S F O R A D A P T I V E C O N T R O L OF TRAFFIC SIGNALS IN M U L T I P R O C E S S O R A R C H I T E C T U R E S S U B M I T T E D FOR T H E D E G R E E OF M A S T E R OF P H I L O S O P H Y IN E L E C T R O N I C A N D T E L E C O M M U N I C A T I O N E N G I N E E R I N G 0 2 . 6 UNIVERSITY OF MORATUWA UM Thesis coll. SRI LANKA APRIL 2002 7 ( 0 0 / 0 , University of Moratuwa 79891 D e c l a r a t i o n T h e w o r k p r e s e n t e d in t h i s t h e s i s h a s n o t b e e n s u b m i t t e d for t h e f u l f i l l m e n t o f a n y o t h e r d e g r e e . G . G . D . N i s h a n t h a Prof . J . A . K . S . J a y a s i n g h e ( C a n d i d a t e ) ( S u p e r v i s o r ) Abstract As the problem of urban traffic congestion spreads, there is a pressing need for the introduction of advanced technology and equipment to improve the state of the art of traffic control. In this context, the techniques used for sensing traffic flow information plays a vital role, ensuring accurate real t ime controllabil i ty. Closed Circuit Television (CCTV) has gained popularity because of its ability to provide diverse information on relatively large regions leading to opportuni t ies for performing substantially more complex tasks than conventional detect ion schemes . By processing these video images, traffic parameters such as speed, traffic composi t ion, queue length etc. can be extracted. In addition C C T V images can be further processed for other useful information such as detection of vehicle shapes, vehicle types, occurrence of traffic violations and vehicle identification numbers etc. To introduce C C T V based vehicle detection for automation of road traffic control in Sri Lanka involves an unaffordable investment cost to purchase foreign technology and equipment unless some locally developed system is introduced. This thesis presents complete design of a C C T V system, which involves mul t i tude of design and implementat ional aspects. It involves deve lopment of an image grabber, a remote communicat ion interface and detection a lgor i thms. In addition to visual moni tor ing of remote road traffic scenes, the designed system is capable of assessing many different traffic parameters , which can be used for adapt ive control of road traffic. T h e underlined project is an attempt to seek the possibility of introducing image- based traffic sensing technology to Sri Lanka. Significant attention has given to reduce the cost of development throughout the project to ensure that the concept of C C T V can be realized in practice in Sri Lanka for road traffic control. . T o Eve ry body W h o he lped mc Acknowledgements First I thank with deep grati tude to my project supervisor, Dr. J A K S Jayasinghe, for the excellent guidance and inspiration he has provided m e through out this work. He provided a lot of encouragement and help for which I will be forever grateful. 1 also thank Dr. (Mrs.) Deleeka Dias, Head/Electronics and Prof. (Mrs . ) I. J. Dayawansa for their kind attention and valuable suggest ions offered. T h e work carried out by them at official levels, towards the continuation of this project is deeply appreciated. My thanks also go to Dr. Amal S. Kumarage and Dr. J .M.S.J. Bandera for their valuable advises. 1 specially thank the administration of road development Authori ty ( R D A ) and Road Construct ion and development company ( R C D C ) for al locating funds for this research project. I would like to personally thank Mr. G A M Sumanasekara (DGM/Mecan ica l , RCDC) for his kind cooperation offered for the upliftment of this project. I also thank Mr. Santha Kumara G a m e g e and Mr. Wasantha Ranjewwa for their s incere cooperation offered throughout the project. I am extremely grateful to my colleague Hemantha Kodikara Arachchi , wi thout whose valuable support and inspirations I could have never achieved this goal . Thanks are due to all my good friends in the research lab Ranaweera , Chandana , a n d N u w a n for helping mc in many ways to make this project a success. 1 also thank the two final year students Dewasurendra and Waravvita for spending their valuable t ime to participate on Held visits and helping m e in many other ways . I also thank Mr. Jayantha Perera and Mr. Senadeera for their help offerd to m e throughout this project. Mr. Thushara and Mr. D D Sumanapala are also remembered for spending their t ime after working hours to keep the research lab open. Finally my thank goes to a l l w ho helped me to make this venture a success . iii Contents Abstract Dedication Acknowledgements Contents List of Abbreviations List of Figures List of Tables Chapter 1 Introduction 1.1. The congestion problem 1.2. Solutions to the congestion problem 1.3. C C T V based traffic detection 1.3.1 .The importance of CCTV techniques 1.4. Scope of the project Chapter 2 Vehicular traffic parameters 2 .1 . Traffic parameter definitions 2.1.1 Quantity measure 2.1.2 Quality assessment measure 2.1.3 Movement measure 2.1.4 Composition and Classification measure Chapter 3 Vehicle detectors 3.1 Vehicle detection technologies 3.1.1. U Urasonic Detectors 3.1.2. Microwave Detectors 3.1.3. Acoustic Arrays Detectors 3.1.4. Magnetic Detectors 3.1.5. Infrared (Passive and active) Detectors 3.1.6. Inductive Loop Detectors 3.1.7. Video Image Processing VIP Detectors 3.2. The relative cost of detectors 3.3. Advantages of VIP detectors C h a p t e r 4 V i d e o i m a g e p r o c e s s i n g t e c h n o l o g y < ^ ; • > V 1 5 4 . 1 . CCTV system topology 15 4 .1 .1 . Composition of a CCTV system 15 4.1.1.1. CCTV cameras 16 4.1.1.2 Camera Mounting and traffic viewing consideration 17 4.1.1.3. Camera orientation and field of view 19 4.1.2. Control Hardware 20 4.1.3. Control software 21 4.1.4. Processing software 21 4.2. Integration of a CCTV system 22 C h a p t e r 5 T h e I m a g e G r a b b e r d e s i g n 2 5 5.1 . System Architecture 25 5.1.1. Sensor Interface Unit (SIU) 25 5.1.2. Digitizing and Storage Unit (DSU) 26 5.1.2.1. Clock generation 27 5.1.2.2. Signal conditioning 27 5.1.2.2.1 Conditioning for sync separation 27 5.1.2.2.2 Conditioning at A/D input 28 5.1.2.3 SYNC separation 29 5.1.2.3.1 Horizontal S Y N C separation 29 5.1.2.3.2. Vertical SYNC separation 29 5.1.2.4. Control Unit 31 5.1.2.5. Finite State Machine (FSM) 31 5.1.2.5.1. FSM State transition diagram 31 5.1.2.5.2. State transition table 33 5.1.2.5.3. FSM State function and output equation 34 5.1.2.5.4. Modes of Operation 35 5.1.2.5.5. Operation in the Capture Mode (MODE_C) 35 5.1.2.5.6. Data Transfer Mode (MODE J T ) 36 5.1.2.6. Static RAM Storage 36 5.1.2.6.1. RAM Organization 37 5.1.2.6.1. RAM control logic 38 5.1.2.6.3. RAM Read/Write operation and buss control 39 5.1.3. Microprocessors Unit (MPU) 41 5.1.3.1. MPU architecture 41 5.1.3.2. STE interface 42 5.1.3.2.1. STE signal definitions 43 5.3. 5.1.3.3. MPU device address 44 ' 5.1.4. Transmission Unit (TXU) 45 5.1.5. Power Supply Unit (PSU) 46 System Performance 46 Data Transfer Routines 47 5.3.1. Data link control 47 5.3.2. Data Flow Control 48 5.3.3. Provision built in to the MPU for remote data access 49 5.3.3.1. Method of increasing field transmission rate 50 5.3.3.2. Implementation of data transmission routines 51 5.3.3.2.1. Image Capturing command 53 5.3.3.2.2. Full Image transfer command 55 5.3.3.2.3. Window transfer command 57 5.3.3.2.4. Line transfer command 59 5.3.3.2.5. Window store command and.Line store command 59 5.3.3.2.6. Stored data transfer command 60 5.3.3.3. Transmission control at host PC 60 5.3.3.4 The user interface 61 C h a p t e r 6 V e h i c l e d e t e c t i o n 6 4 6 .1 . General image processing problems applied to traffic monitoring 64 6.2. Solutions to the general problems of image processing applied to 65 traffic monitoring 6.2.1. Avoiding a bandwidth extensive transmission facility 66 6.2.1.1. Processing at the camera site itself 66 6.2.1.2. Reduce the amount data to a manageable rate 66 6.2.1.3. Introduce offline-processing 68 6.2.1.4. Elimination of high speed processing requirements 68 6.2.1.5. Noise reduction 68 6.2.1.6. Correction to ambient light changes 69 6.2.1.7. Avoiding problems due to neighboring vehicles 69 6.3. A Review of research towards traffic monitoring using video images 70 6.4. Methodologies Of Vehicle Detection 74 6.4.1. Back ground frame differencing 74 6.4.1.1. Manipulation of back ground image 75 6.4.2. Inter Frame Differencing 77 6.4.3. Vehicle Detection at selected windows 77 6.4.3.1. Traffic parameter extraction 78 6.4.4. Tracking objects by feature matching 80 Chapter 7 Detection algorithms implemented on the designed system 82 7.1 . System limitations 82 7.1.1. Image Grabber provision 83 7.2. Algorithm development for vehicle detection 84 7.2.1. The detection approach 84 7.2.2. Sampling rate requirements 84 7.2.3. Effect of vehicle speed 84 7.2.4. Detection Algorithm 85 7.2.4.1.Notation 85 7.2.4.2. Processing steps 86 7.2.5. Calculation of traffic parameters 91 7.3. Interpretation of estimated traffic parameters 92 7.4. Functionality review 92 Chapter 8 Offline processing of traffic video 94 8.1. Site selection 94 8.2. Results of offline processing 95 Chapter 9 Conclusion 96 References 98 VII Abbreviations A T C S Advanced Traffic Control Systems C C D Charge Coupled Device CCTV Closed Circuit Television IVHS Intelligent Vehicles and Highway Systems MPEG Motion Picture Expert Group PATH- Partners for Advanced transit and highway T S C Traffic Control System U S B Universal Serial Bus VIP Video Image Processing List of figures Fig. 4.1 C C T V based traffic monitoring and intelligent traffic control 16 Fig 4.2 Camera mounting parameters 18 Fig 4.3 Line of site detection geometry 19 Fig 5.1 The image grabber architecture 25 Fig 5.2 Simplified block diagram of DSU 26 Fig 5.3 • C L K Circuit 27 Fig 5.4 Gain/Offset control amplifier at SYNC separation 27 Fig 5.5 ' Gain/Offset control amplifier at A/D conversion 28 Fig 5.6 Circuit arrangement at Hsync separation 29 Fig 5.7.a Circuit arrangement for Vsync separation 30 Fig 5.7.b Selected waveforms 30 Fig 5.8 State diagram of the FSM 32 Fig 5.9 Memory map for field 1 36 Fig 5.10 SRAM organization 37 Fig 5.1 1 RAM access and bus control signals 39 Fig 5.12 RAM write timing - 40 Fig 5.13 RAM read timing 41 Fig 5.14 MPU architecture 42 Fig 5.15 MPU - D S U interface 42 Fig 5.16.a MPU I/O map 44 Fig 5.16.D MPU memory map 44 Fig 5.17.a Null modem connection map 45 Fig 5.17.D Through modem connection map 45 Fig 5.18 Detailed functional block diagram of DSU 46 Fig 5.20.a Data read subroutine 49 Fig 5.20.b Dats write subroutine 49 Fig 5.21 MPU main routine 53 Fig 5.22 Image Capturing routine 54 Fig 5.23 Transmitted image format 55 Fig 5.24 Full image transfer routine 56 ix Fig 5.25 Window transfer routine Fig. 5.26 The user interface Fig. 5.27 Picture examples - different spatial resolutions Fig. 5.28 Picture examples - different bit resolutions List of tables Table 4.1 Comparison of upstream and downstream viewing 21 Table 5.1 Signal description of FSM 32 Table 5.2 State transition table for FSM design 33 Table 5.3 FSM state dependent functions 34 Table 5.4 Mode of operation 35 Table 5.5 ' SRAM address counter control 38 Table 5.6 SRAM chip access control 38 Table 5.7 . Address map for DSU access 43 Table 5.8 STE signal definitions 43 Table 8.1 Comparison between actual and delected vehicle positions 95 X I (