Detecting Crowded Zones as an Indicator for Abnormal Events

— This paper presents a distinct video surveillance system which took place in the Lebanese International University Saida- Campus, which is considered as a very crowded environment, and reveals if there is an unusual event. Our main target is to apply simple procedures that will be present as a future’s benchmark. The work is split into three major parts, starting by dividing the video frame into zones, then to compute the magnitude of optical flow in each, and finally to analyze these data and classify it, based on a logical threshold, as normal or abnormal events. We implement our results based on Histogram of Magnitudes for each zone (HOM) and the outcome met our expectations.


I. INTRODUCTION
Over time and space, technology is widely spreading across the world. It is used to facilitate our living skills in our daily life. Technology has been around surveillance systems for decades. In recent years, videosurveillance systems become a main interest in people's life such as government agencies, business, and private possessions. Nowadays, people seek for better image quality, less in cost, better in size and scalability. For safety issues, cameras can monitor real-time occurrences, collect data, and come out with analyzing the behavior of people. Monitoring is often performed through consecutive frames which are extracted from the video.
To take advantage on video surveillance, it is an essential thing to propose an algorithm that is simple and fast to detect human activities [1] [2]. It's an approach that combines the needs of the market and the simplicity. The world now is shifting towards mechanization due to the workers load. Moreover, the world is suffering from deficient in safety issues. So why not inventing a new approach that meets these market expectations? It doesn't need to be complex but a simple one.
Javanbakhti, S., and S. Zinger [3] propose Fast Abnormal Event Detection from Video Surveillance. Their approach of this page is based on block algorithm by analyzing the pixel wise motion context. This procedure indicates abnormal motion variation in regions based on the entropy (system's thermal energy) of Discrete Cosine Transform coefficients. They design a general framework based on features directly extracted from motion such as velocity at pixel level based optical flow. 1. Analyze information collected in frequency domain in each frame. 2. Compute DCT coefficients for motion magnitudes 3. Analyzing and recognizing the motion. 4. Describe the actions and compare the entropies for each block to a given median average values over time.
As we mention above their approach is somehow fast since it block-based computing and parallel processing. It exactly indicate in which part of frame the event occurs. However, It suffer from a noisy optical flow, limitation in the usage of median filter, and complexity in calculation.
Andrade et.al [4] observe the crowd optical flow in order to characterize crowd behavior, and they use unsupervised feature extraction to encode normal behavior. In this article, the analysis in based on optical flow, the feature extraction applies HMM (Hidden Markov Model) and spectral clustering. The detection of abnormal events is based on a threshold on the HMM likelihood function. Their approach Filtering reduce to noise of optical flow, spectral clustering is elegant and well-founded mathematically, and it works well when relations are approximately transitive (similarity). However, HMMs fail to represent appliance using a continuously power demand. In spectral clustering, very noisy datasets cause problems and it is expensive for very large datasets.
Based on the above we suggest a sufficient algorithm that deals with analyzing the content of a video to classify events between normal and abnormal ones, using a simple software algorithm, based on optical flow calculations. We have chosen our university a place to test our results in. Due to the instability of the secure conditions that surrounds the Lebanese International University (Saida Campus) a shown in Figure 2, we aim to solve this issue in order to be aware of anything that could happen to provide the safety of our friends and the students.

II. PROPOSED MODEL
Our proposed scenario is based on several steps. The below diagram in Figure 3 describes our algorithm.

A. Dealing with the video
Video -Surveillance Systems have become a major interest in our daily life. It can monitor a specific location for specific targets and mainly to achieve security. We have chosen our university as a place to examine our algorithm and come out with the required results. We have recorded a video in an attractive spot where students usually walk and meet together as shown in Figure 4. We get the full video information to characterize the mobility in this area. As it's known, there is a trade-off between the size of the video and its quality. In order to make the size of the video tolerable with simple calculations and with a low power demand, we decreased the quality of the video to handle the load video information in an acceptable manner.

B. Optical Flow in the Zones
A video is a set of successive image frames. These images are represented as I(x,y,t) where x and y are the pixel position and t represents the time. If an object moves through these frames, this motion results in a time-dependent displacement of the grey values in image sequence. The 2-d apparent motion field in image domain is called optical flow domain. Optical flow [5] works on different assumptions. It works either on the stability of pixel intensities between consecutive frames or on neighborhood-pixels that have similar motion.
Calculating optical flow is helpful in analyzing human behavior by modeling the global motion information we get through this estimation. Estimating the optical flow vectors can be done through calculating the magnitude and orientation for each cell. This way will ease the differentiation process of the interested objects between the successive frames. Hence, we can detect if this group of people is running, splitting, or normally going to their classes. Optical flow estimation is a challenging task in image analysis and computer-vision. Estimating optical flow vectors is used in video surveillance systems. First, we extract the point of interest in each frame. Then we track these points from frame to frame in order to detect whether these points are merging away from their normal values. The result is a set of four-dimensional vectors V.
(1) where Xi and Yi are the coordinates of feature i Ai is the motion direction of feature i Mi is the motion magnitude of feature i.
It works in with the distance between features i in frame t and its symmetric feature in frame t+1.
Many pre-existing procedures that work with optical flow suffer from noisy data. Actually, optical flow is noisy. For accurate results, we used a better version in optical flow that handles the noise -Lucas -Kanade -It expects that the flow is basically constant in a local neighborhood of the pixel under thought, and explains the essential optical flow conditions for every one of the pixels in that area, by the minimum squares basis [6].
By joining data from a few close-by pixels, the Lucas-Kanade technique can frequently resolve the intrinsic equivocalness of the optical flow condition. It is likewise less sensitive to image noise than point-wise techniques. Then again, since it is a simply local strategy, it can't give flow data in the inside of uniform locales of the image.
The Lucas-Kanade strategy expect that the removal of the picture content between two nearby frames is little and roughly constant inside an area of the point p under thought. Along these lines the optical flow condition can be accepted to hold for all pixels inside a window focused at p.
This system has more equations than unknowns and thus it is usually over-determined. The Lucas-Kanade method obtains a compromise solution by the least squares principle. Namely, it solves the 2×2 system (5) where is the transpose of matrix A. That is, it computes (6) where the central matrix in the equation is an inverse matrix. The sums are running from i=1 to "n".
The matrix is often called the structure tensor of the image at the point p.
So we used the above method in our approach. It computes optical flow locally. This means that a great calculate without having to depend on the whole image.

C. Building Histogram of Magnitudes
After the calculation of optical flow in each cell, we stored the values of estimated magnitudes in an array. These data should be visualized in order to classify them correctly. With this data, we implement histogram of magnitude for each zone [10] [11]. As indicated before, we split the frame into sixteen cells and each cell is treated individually. We label the zones from A to P as shown in Figure 4.
After that, we build the histograms for each zone and detect where the hot cells are. Being able to do partitioning would solve several problems like optical flow because we will be working on no discontinuities regions.

D. Implementation/Simulation Tools
The design consideration of our system was the programming language that suits best our simulation, while various options such as MATLAB and JAVA were employed; our chosen one is C++ using OpenCV [12]. Ii is widely used for segmentation, recognition, and motion tracking. OpenCV includes machine learning library. Moreover, it makes more time and has memory optimization, plus the availability of libraries for image processing. . We tend to have simple and fast approaches taking into consideration low cost enhancements. The software used is visual studio.

E. Definig a measure for classification of normal and abnormal event
After estimating the optical flow in each zone, we got all the magnitudes data and we need to analyze it. Choosing an appropriate threshold for classification should be based on comparison between optical flow calculations in normal scenario and abnormal one. So, we are going to take 2 cases and study their optical flow estimations in order to take the suitable threshold to get high accuracy. To make values easier, we set all the magnitude values to a range between 0 and 16

III. EXPERIMETAL RESULTS
To examine the execution of our method, we used the Histogram of Magnitudes of the optical flow. We used a video recorded in our university to observe the condition. Videos are utilized to show meaningful data to the security team who need to take proper actions in case of a risky situation.

A. Experimental Setup
The experiments were conducted using our personal computer with Intel Core i7 using visual studio 2010 and OpenCv 3.3.0 software. After getting the video, we partition the frame into 4x4 non overlapping zones. For each zone, optical flow vector is estimated. The magnitudes of these vectors are represented on histograms.          As shown in figure 16,

C. Definig a measure for classification of normal and abnormal event
After estimating the optical flow in each zone, we got all the magnitudes data and we need to analyze it. Choosing an appropriate threshold for classification was based on comparison between these optical flow calculations in normal scenario and abnormal one. We set all the magnitude values to a range between 0 and 16. We took the magnitude value = 8 as a threshold. If the estimated optical flow magnitude is below 8, than we will mark the case as a normal one. Else, it will be an abnormal event and actions should be taken.

IV. CONCLUSION
Nowadays, the use of video surveillance systems became a must in every moment of our daily life, in order to maintain security and provide us with the maximum achieved level of safety. To take benefit on video surveillance, an efficient method is implemented to detect abnormal events which may occur in crowded scene at LIU Saida campus. This pure software algorithm works with analyzing the content of a video to classify events between normal and abnormal ones, based on optical flow calculations, in each zone of the whole frame, using Lucas-Kanade method. The magnitude histograms were very sufficient and efficient proofs to show the importance of this algorithm in detecting hot cells and then classifying the event. In fact, this implemented method provides an efficient solution for event detection; and it can also be merged in the future with a hardware technique, for example, using a microcontroller to implement a security alert, which can control automatically the door of the auditorium, to protect and maintain the students' safety.