PARAMETRIZATION OF THE OPTICAL FLOW CAR TRACKER WITHIN MATLAB COMPUTER VISION SYSTEM TOOLBOX FOR VISUAL STATISTICAL SURVEILLANCE OF ONE-DIRECTION ROAD TRAFFIC

A computer vision problem is considered. The prototype is the optical flow car tracker within MATLAB Computer Vision System Toolbox, tracking cars in one-direction road traffic. For adapting the tracker to work with other problems of moving cars stationarycamera-detection, having different properties (video length, resolution, velocity of those cars, camera disposition, prospect), it is parametrized. Altogether there are 19 parameters in the created MATLAB function, fulfilling the tracking. Eight of them are influential regarding the tracking results. Thus, these influential parameters are ranked into a nonstrict order by the testing-experience-based criterion, where other videos are used. The preference means that the parameter shall be varied above all the rest to the right side of the ranking order. The scope of the developed MATLAB tool is unbounded when objects of interest move near-perpendicularly and camera is stationary. For cases when camera is vibrating or unfixed, the parametrized tracker can fit itself if vibrations are not wide. Under those restrictions, the tracker is effective for visual statistical surveillance of one-direction road traffic.


NOMENCLATURE
CAMS is a continuously adaptive mean shift; CVST is Computer Vision System Toolbox™; KLT is Kanade-Lucas-Tomasi; MCSCD is a moving cars stationary-camera-detection; MNF are motion numerical features; OFCT is an optical flow car tracker; VSS is visual statistical surveillance; A is an algorithm used to compute optical flow; F is a narrowed and ranked set of relevant OFCT parameters; motion g is a motion vectors gain; ( ) moment N t is a number of cars intersecting an appropriate region at a moment t; ( ) t is a total number of cars intersected the line all over the video (first) frames; blob r is a marginal ratio in classifying the blob as a car; factor r is a frame scaling percentage; T is a total number of frames; t is a moment (a frame); th v is a velocity threshold, computed from the matrix of complex velocities; w is a width (in pixels) of a square structuring element; γ is a binary classification factor; θ is a time unit.

INTRODUCTION
Computer vision is an inseparable and high-promising part of automation.This is a very huge scientific field, included methods for acquiring, processing, analyzing, and understanding multi-dimensional data from the real world in order to produce decisions as numerical or symbolic information [1,2].Particularly, these data are images and frames from video sequences, views from cameras, or plane projections from scanners.Computer vision efficiently uses utilities and facilities of applied mathematics, machine learning and artificial intelligence, image and signal processing [1,3,4].Being scientific-technological discipline, computer vision renders its theories and models to the construction of computer vision systems.Such systems mainly are designed for controlling industrial processes, autonomous vehicle navigation, detecting events for VSS, organizing imaged and databased information, analyzing and modeling topographical environments, computer-human interaction [1,5,6].
The being described application areas employ a few contemporary general problems of computer vision, whose resolution depends on the application requirements and approaches in solving.Typically, these problems are recognition, motion analysis, scene reconstruction, image restoration.Computer vision system methods for solving them issue from multi-dimensional data acquisition, preprocessing, feature extraction, detection, segmentation, high-level processing.Eventually, the final decision required for the application is made.Before computer vision system projection, using hardware (power sources, multi-dimensional data acquisition devices, processors, control and communication cables, wireless interconnectors, monitors, illuminators) anyway, its work must be modeled in order to heed of the application area unpredictable specificities.Up-to-date MATLAB ® environment grants a powerful CVST, providing algorithms and tools for the design and simulation of computer vision and video processing systems [4,7,8].CVST proposes a lot of MATLAB ® functions, MATLAB System objects™, and Simulink ® blocks for feature extraction, motion detection, object detection, object tracking, stereo vision, video processing, and video analysis.Its tools include video file input/output, video display, drawing graphics, and compositing.For rapid prototyping and embedded system design, CVST supports fixed-point arithmetic and C code generation.Also there are demos, showing advantages of CVST.Some of those demos are a good basis for projecting real computer vision systems.However, for doing that there sometimes are not enough evident parameters, whose values might have been adjusted for other tasks within the regarded computer vision problem class.One of the classes, demonstrated in CVST, is the optical flow object tracking [2,3,9,10].
When studying methods of tracking the object and motion estimation, one of the key demos in CVST is OFCT.This demo tracks cars in a one-direction road traffic video by detecting motion using the optical flow methods [2,11,12].These methods, trying to calculate the motion between two image frames which are taken at neighboring times at every voxel position, are based on local Taylor series approximations [2,3,13] of the image signal.They use partial derivatives with respect to the spatial and temporal coordinates.The cars are segmented from the background by thresholding the motion vector magnitudes.Then, blob analysis is used to identify the cars [1,14,15].
A blob is an image region in which some properties are constant or vary within a prescribed range of values.All the points in a blob can be considered in some sense to be similar to each other.Blob detection refers to mathematical methods that are aimed at detecting image regions that differ in properties, such as brightness or color, compared to areas surrounding those regions.Given some property of interest expressed as a function of position on the digital image, there are two main classes of blob detectors [14,16,17].The first class is differential methods, which are based on derivatives of the function with respect to position.The second class is methods based on finding the local maxima and minima of the function.
CVST algorithms for video tracking are CAMS and KLT ones [2,4,18,19].CAMS uses a moving rectangular window that traverses the back projection of an object's color histogram to track the location, size, and orientation of the object from frame to frame.KLT tracks a set of feature points from frame to frame and can be used in video stabilization, camera motion estimation, and object tracking applications.CVST also provides an extensible framework to track multiple objects in a video stream.It includes Kalman filtering to predict a physical object's future location, reduce noise in the detected location, and help associate multiple objects with their corresponding tracks [2,3,19].The Hungarian algorithm is for assigning object detections to tracks [20].Blob analysis and foreground detection is used for moving object detection.Additionally, there are annotation capabilities to visualize object location and to add object label.
Motion estimation is the process of determining the movement of blocks between adjacent video frames.CVST provides a variety of motion estimation algorithms -optical flow, block matching, template matching.These algorithms create motion vectors, which relate to the whole image, blocks, arbitrary patches, or individual pixels [21,22].The evaluation metrics, for finding the best match in the block and template matching, includes particularly mean-square error principle [2,3,21,23,24].
OFCT within CVST shows how moving objects are detected with a stationary camera.In series of video frames, optical flow is calculated and detected motion is shown by overlaying the flow field on top of each frame.But OFCT takes the specified series of 121 video frames, and so this demo cannot be applied outright for other moving cars videos with different frames' number or distinct frame size.Besides, OFCT didn't offer a numerical feature of motion results in the video frames series, except instant calculation of objects intersecting an early horizontal line at a moment.Therefore OFCT should be parametrized for getting some needful numerical features of motion results in the video frames series, and for resolving at least slightly different tasks of MCSCD.

PROBLEM STATEMENT
Our goal is to view and rank the clue parameters in OFCT for parametrizing it within MATLAB CVST, what is going to be adapted for working with other MCSCD problems, having different properties (video length, resolution, velocity of those cars, camera disposition, prospect).Nominally, from the given set 0 F of OFCT attributes, we must yield a set of relevant OFCT parameters, whereupon this set is narrowed and ranked to F .Formally, this is a map ( ) ensuring true MNF of videos.Parametrization of OFCT within MATLAB CVST by adding the MNF will allow projecting a computer vision system for VSS of one-direction road traffic.This is very important problem in organizing and optimizing the road traffic for its safety.
The successive components of the said goal are the following.Firstly, there must be structuring and algorithmization of information processing stages when onedirection road traffic is video-analyzed.Then, for VSS, MNF at OFCT windows should be added.And, eventually, the parametrized OFCT is going to be tested on another video.

REVIEW OF THE LITERATURE
Structurally, video information processing is divided into four items [2,3,8]: 1) extraction of the foreground; 2) extraction and classification of moving objects; 3) tracking trajectories of the revealed objects; 4) recognition and description of objects-of-interest activity.
Conventionally, the video foreground is of moving objects or regions.So, extraction of the foreground consists in separating moving fragments of the view from the motionless ones.These ones, being stationary objects or regions, are background of the view.Accuracy at this stage predetermines whether a computer vision problem is going to be satisfactorily solved.And nearly the best accuracy in selecting moving objects can be ensured with the optical flow methods [2,3,9].The foreground extraction stage predetermines also the requirements to computational resources that may be needed at the rest three stages.
At the second stage, the extracted foreground is segmented.Each segment is a compact region whose pixels move at approximately equal velocities.Before segmentation the image is filtered for reducing noise, including impulse noise [1,4,25,26].Median filter as nonlinear digital filtering technique is usually invoked for noise reduction, running through the image entry by entry, and replacing each entry with the median of neighboring entries [26,27].For removing image defects (non-compactness), morphological dilatation and erosion over segments are fulfilled [1].Subsequently, contours of the selected segments become smoother and they contain minimal quantity of spaces (gaps) within the object.Then those segmented regions, being moving objects, are classified.The classification is rough, meaning that its result is the moving object's type -a man, a car, an animal, etc.
At the third stage, the revealed objects' trajectories are tracked.For the tracking fulfillment, the one-to-one correspondence between the revealed objects on successive frames must be determined.
Finally, there are recognition and description of the revealed-and-tracked objects.In particular, for a task of MCSCD, it is VSS.Here, major MNF are number implying how many cars intersect the line on average in the time unit θ (second, minute, hour, etc).

MATERIALS AND METHODS
The video in MATLAB OFCT demo has resolution 120by-160, where the one-direction road traffic runs approximately vertically.Stages of this video processing are the said above within the processing loop to track cars along the series of 121 video frames.Initially the optical flow estimates direction and speed of motion.The optical flow vectors are stored as complex numbers, and the velocity threshold from the matrix of complex velocities is computed.Then median filter removes speckle noise introduced during thresholding and segmentation.For thinning out the parts of the road and other unwanted objects and filling holes in the blobs, there are applied morphological erosion and closing methods.After that the blob analysis method estimates the area and bounding box of the blobs, filtering out objects which cannot be cars with binary classification factor CVST objects to display the original video, motion vector video, the thresholded video and the final result.
( ) moment N t is displayed in the viewer named «Results» (Figure 1) in its left upper corner.2. Having been made as a MATLAB function, it works with other MCSCD problems.But primarily it should to be adjusted to the problem, slightly changing 19 parameters (name of the file is not reckoned in) in sets ( 4) and (5).These parameters are input in the following order:  = is returned as well (Figure 3).And there are no missed or defectively-tracked cars anymore.
Hereinafter, we will test the OFCT parametrized under (4) and ( 5) for seeing how MATLAB function "ofct" performs on other MCSCD problems for VSS of one-direction road traffic.But the part of empirical adjustment is omitted.The omission cause is that the adjustment is not routine.

EXPERIMENTS
For testing the parametrized OFCT, diverse videos containing one-direction road traffic have been explored.It is noteworthy that the road view is not always straight perpendicular.Figure 4 shows that cars are successfully tracked when they move non-perpendicularly having different velocities and accelerations.At that, the input arguments of the being invoked parametrized OFCT are just slightly different.For instance, there are invocations: VSS of bigger vehicles causes a new problem.Trucks having long trailers may be split into a few blobs and thus the big long vehicle is tracked as two or more.Another great problem is that the rectangular bounding box sometimes disappears for a frame or two and then appears again.This effect may cause a fail of MNF calculation.
For cases when camera is vibrating or unfixed, the parametrized OFCT can fit itself if vibrations are not wide.However, the influential parameters (6) and their order (7) may become incomplete.Wider ranges of the camera vibration will require either to re-rank the elements of the set

CONCLUSIONS
The testing-experience-based criterion of ranking OFCT parameters has allowed to reduce the set of 19 non-arranged elements down to eight ones (6) ordered as (7).The advantage (preference) means that the parameter (of the couple) shall be varied above all the rest (to the right side of the ranking order).At that, there is no preference inside of the couples { } an MCSCD problem.This is possible owing to parametrization of the OFCT within MATLAB CVST whose corollary is the ranking (7).Consequently, MCSCD problems are solved via MATLAB function «ofct».These primitives are indispensable to projecting a computer vision system for VSS of one-direction road traffic and ensuring its safety.
For general VSS of one-direction road traffic, the parametrized MATLAB function «ofct» is not going to be used straight off.The explanation lies in that the objects-ofinterest activity is the cars' movement which must be almost perpendicular, and camera disposition ought to hang over the road (hanging not low).Hence, the promising research is in adapting the developed MATLAB tool for tracking vehicles of any form and size, moving in one-direction under arbitrarily disposed camera.

blob a is a ratioF
between area of the blob and area of the bounding box; max b is a maximum blob area in pixels; min b is a minimum blob area in pixels; offset b is a border offset in plotting motion vectors; max c is a maximum number of blobs in the input image; col d is a step through horizontal axis, when coordinates are generated for plotting motion vectors; frame d is a number of frames between reference frame and current frame; line d is a distance between centers of structuring element members at opposite ends of the line; row d is a step through vertical axis, when coordinates are generated for plotting motion vectors; 0 is a set of OFCT attributes;

Figure 1 - 3 -
Figure 1 -Four viewers, visualizing the running MATLAB OFCT demo file name is input at the front of them.

Figure 4 -
Figure 4 -Snapshots off the viewer «Results», visualizing the running OFCT by MATLAB function «ofct» on other MCSCD problems for VSS of one-direction road traffic near-perpendicularly (but not horizontally or close to that) and camera is stationary.Nonetheless, adjustment even on the foremost couple { } max max , x y by (7) may take substantial time.And tracking any vehicles is handled harder.VSS of bigger vehicles causes a new problem.Trucks having long trailers may be split into a few blobs and thus the big long vehicle is tracked as two or more.Another great problem is that the rectangular bounding box sometimes disappears for a frame or two and then appears again.This effect may cause a fail of MNF calculation.For cases when camera is vibrating or unfixed, the parametrized OFCT can fit itself if vibrations are not wide.However, the influential parameters(6)  and their order (7) may become incomplete.Wider ranges of the camera vibration will require either to re-rank the elements of the set(6)  or to re-select influential parameters from the set

( 6 )
or to re-select influential parameters from the set elements are likely to be varied simultaneously.The adjustment is that naive heuristic optimization of values in(6)  giving true -ISSN 1607-3274.Радіоелектроніка, інформатика, управління.2015.№ 3 e-ISSN 2313-688X.Radio Electronics, Computer Science, Control.2015.№ 3 max x is maximal deviation ratio of the bounding box through horizontal axis; end y is a value of ordinate in the frame, where tracking ends; p

Table 2 -
Adjustable parameters attached to the MATLAB OFCT demo ones are algorithms of Horn -Schunck and of Lucas-Kanade.Thus, the set of parameters (Table2) Figure 2 -The modified MATLAB OFCT code, made as MATLAB function «ofct» with 19 adjustable parameters Therefore the MATLAB OFCT demo may be modified over one or several parameters from the set Радіоелектроніка, інформатика, управління.2015.№ 3 e-ISSN 2313-688X.Radio Electronics, Computer Science, Control.2015.№3The flaw concerning the 73-th frame of the video in original MATLAB OFCT demo is remedied by launching the modified MATLAB OFCT code as follows (from the MATLAB Command Window prompt): function [hVideo4] = ofct(filename, OpticalFlowMethod, ReferenceFrameDelay, ResizeFactor, w, d_line, alpha_line,...