Python Traffic Camera Analyzer
Sponsored Links
Python Traffic Camera Analyzer Ranking & Summary
File size:
0.003 MB
Platform:
Any Platform
License:
GPL (GNU General Public License)
Price:
Downloads:
1621
Date added:
2005-05-20
Publisher:
Pedram Amini
Python Traffic Camera Analyzer description
Python Traffic Analyzer is a Python base class and sample driver script written to retrieve and manipulate images from the TrafficLand cameras and calculate a numeric value representing the current traffic flow.
PyTrAn, an example driver script, an image collector and an image mask creator are available for download from the link shown at the bottom. To use the PyTrAn package begin by choosing a camera that you wish to analyze, for this example well use the camera captioned above.
We want to construct a mask over the area of the image that we are interested in, namely the road. In this particular example the road takes up the majority of the image but that is not always the case.
We will apply the mask over captured images to fine tune the area over which we are looking for movement. To create the mask we will first need to collect a sequential series of snapshots from the target camera. The image_collector.py script was written for this task:
$ mkdir mask_200003
$ cd mask_200003
$ ../image_collector.py 200003 30
Collecting 30 images...
30
Done.
The script is hard coded to capture images on a 2-second delay. The delay is necessary to ensure the image has changed. I believe 2-seconds to be the absolute minimum. Once complete, 30 images numbered 1 through 30 will be created in the current directory.
We construct a mask from these captured images by creating a diff-image for each sequential image pair and then adding each diff-image together. Naturally, a script was written to automate this task as well:
$ ../mask_maker.py 1 30
Creating a diff for each sequential image pair.
Diffing 29
Creating the initial mask from the first image pair.
Adding the rest of the diffs to the mask.
Masking 29
Done.
A number of .diff files are generated in this process. These files repesent the movement between individual sequence pairs.
The .diff files are simply intermediary files, the important bit is the mask file, which is generated as the sum of all differences.
The mask file may be dirty (as in this case) and require manual cleanup. The basic shape of the road however is clearly visible, evidence that we can with minimal effort automate the mask generation process. Also, this run was conducted at night, day-time images yield better results.
There are a few final steps we need to take before we can use the example PyTrAn driver script. First we need to convert the mask to ASCII (noraw) format:
$ pnmnoraw mask > mask_200003.ascii
Then we need to open an ImageMagick display window and get its X-window-ID using xwininfo. Finally, update camera_id and window_id in pytran_sampling.py and launch the driver:
$ ../pytran_sampling.py
DEBUG> grabbing frame from camera 200003
DEBUG> rotating image: pytran.this > pytran.last
DEBUG> refreshing image in 3 secs
taking a 5 minute sample at various thresholds.
DEBUG> grabbing frame from camera 200003
DEBUG> generating frame diff on pytran.last, pytran.this
DEBUG> displaying image: pytran.diff
DEBUG> converting pytran.diff to ascii
DEBUG> calculating traffic ratio...
ratio[5]: 55%
DEBUG> calculating traffic ratio...
ratio[10]: 52%
...
...
5 minute sample[5]: 67.88
5 minute sample[10]: 42.66
5 minute sample[15]: 30.57
5 minute sample[20]: 23.03
5 minute sample[25]: 18.39
5 minute sample[30]: 14.79
5 minute sample[35]: 12.42
5 minute sample[40]: 10.53
5 minute sample[45]: 9.06
5 minute sample[50]: 7.85
The sampling script will take 5 minute samples at varying color thresholds. The optimal threshold must be manually chosen. Furthermore, you will need to sample the traffic ratios during both heavy and light traffic times to get a good feel for your acceptable range. Also, keep in mind that the traffic ratio value is simply the percent change detected, or in other words the movement detected within the masked region. This means that a completely empty road will register similar values to a road so congested it looks like a parking lot. The time of day can be combined with the traffic ration to determine the logical truth.
With this task implemented and abstracted more complex systems can be built. When I find the time Id like to create a system that will take multiple potential travel routes and times, and during the travel time e-mail the traveler with the best route to take. Another idea I had would be to record the traffic flow values for each camera, for each day and for each half hour interval. Travelers and other interested parties can then analyze traffic patterns to determine the fastest route dependant on date/time.
PyTrAn, an example driver script, an image collector and an image mask creator are available for download from the link shown at the bottom. To use the PyTrAn package begin by choosing a camera that you wish to analyze, for this example well use the camera captioned above.
We want to construct a mask over the area of the image that we are interested in, namely the road. In this particular example the road takes up the majority of the image but that is not always the case.
We will apply the mask over captured images to fine tune the area over which we are looking for movement. To create the mask we will first need to collect a sequential series of snapshots from the target camera. The image_collector.py script was written for this task:
$ mkdir mask_200003
$ cd mask_200003
$ ../image_collector.py 200003 30
Collecting 30 images...
30
Done.
The script is hard coded to capture images on a 2-second delay. The delay is necessary to ensure the image has changed. I believe 2-seconds to be the absolute minimum. Once complete, 30 images numbered 1 through 30 will be created in the current directory.
We construct a mask from these captured images by creating a diff-image for each sequential image pair and then adding each diff-image together. Naturally, a script was written to automate this task as well:
$ ../mask_maker.py 1 30
Creating a diff for each sequential image pair.
Diffing 29
Creating the initial mask from the first image pair.
Adding the rest of the diffs to the mask.
Masking 29
Done.
A number of .diff files are generated in this process. These files repesent the movement between individual sequence pairs.
The .diff files are simply intermediary files, the important bit is the mask file, which is generated as the sum of all differences.
The mask file may be dirty (as in this case) and require manual cleanup. The basic shape of the road however is clearly visible, evidence that we can with minimal effort automate the mask generation process. Also, this run was conducted at night, day-time images yield better results.
There are a few final steps we need to take before we can use the example PyTrAn driver script. First we need to convert the mask to ASCII (noraw) format:
$ pnmnoraw mask > mask_200003.ascii
Then we need to open an ImageMagick display window and get its X-window-ID using xwininfo. Finally, update camera_id and window_id in pytran_sampling.py and launch the driver:
$ ../pytran_sampling.py
DEBUG> grabbing frame from camera 200003
DEBUG> rotating image: pytran.this > pytran.last
DEBUG> refreshing image in 3 secs
taking a 5 minute sample at various thresholds.
DEBUG> grabbing frame from camera 200003
DEBUG> generating frame diff on pytran.last, pytran.this
DEBUG> displaying image: pytran.diff
DEBUG> converting pytran.diff to ascii
DEBUG> calculating traffic ratio...
ratio[5]: 55%
DEBUG> calculating traffic ratio...
ratio[10]: 52%
...
...
5 minute sample[5]: 67.88
5 minute sample[10]: 42.66
5 minute sample[15]: 30.57
5 minute sample[20]: 23.03
5 minute sample[25]: 18.39
5 minute sample[30]: 14.79
5 minute sample[35]: 12.42
5 minute sample[40]: 10.53
5 minute sample[45]: 9.06
5 minute sample[50]: 7.85
The sampling script will take 5 minute samples at varying color thresholds. The optimal threshold must be manually chosen. Furthermore, you will need to sample the traffic ratios during both heavy and light traffic times to get a good feel for your acceptable range. Also, keep in mind that the traffic ratio value is simply the percent change detected, or in other words the movement detected within the masked region. This means that a completely empty road will register similar values to a road so congested it looks like a parking lot. The time of day can be combined with the traffic ration to determine the logical truth.
With this task implemented and abstracted more complex systems can be built. When I find the time Id like to create a system that will take multiple potential travel routes and times, and during the travel time e-mail the traveler with the best route to take. Another idea I had would be to record the traffic flow values for each camera, for each day and for each half hour interval. Travelers and other interested parties can then analyze traffic patterns to determine the fastest route dependant on date/time.
Python Traffic Camera Analyzer Screenshot
Advertisements
Python Traffic Camera Analyzer Keywords
DEBUG
Python Traffic Camera Analyzer
PyTrAn
Traffic camera
5 Minute
traffic
camera
mask
5
sample
python
Analyzer
Python Traffic Camera Analyzer
Image Recognition
Science and Engineering
Bookmark Python Traffic Camera Analyzer
Python Traffic Camera Analyzer Copyright
WareSeeker periodically updates pricing and software information of Python Traffic Camera Analyzer full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Python Traffic Camera Analyzer Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
traffic cameras
live traffic cameras
traffic cameras maryland
traffic camera accidents
live houston traffic cameras
honolulu traffic camera
traffic camera accident
traffic camera video
toronto traffic cameras
seattle traffic cameras
traffic camera pedestrian
maryland traffic cameras
dallas traffic cameras
traffic camera crash
caltrans live traffic cameras
seattle traffic camera
traffic camera houston
penndot traffic cameras
Related Software
Network Traffic Analyzer analyzes the network traffic on multiple network devices and creates HTML statistics. Free Download
Practical Query Analyzer produces HTML reports on query statistics. Free Download
Python in Scheme is a scheme library that allows you to run Python code within Scheme. Free Download
Build Order Anlyzer for the Axis & Allies RTS is a tool for analyzing builds in the Axis & Allies RTS game. Free Download
Python Call Graph (pycallgraph) is a Python library that creates call graphs for Python programs Free Download
Traffic Prioritizer is designed to run on a Linux router and prioritize users traffic by their bandwidth consumption. Free Download
Air Traffic Controller is an air traffic controller simulation. Free Download
python-dime project provides a way to parse and generate DIME messages. Free Download
Latest Software
Popular Software
Favourite Software