Cameras Box Optimizer
Vizzion's Cameras Box Optimizer sample application illustrates a number of considerations when developing an application that retrieves a large amount of camera data as efficiently as possible, including getting an initial list of cameras, filtering cameras by type, partitioning into boxes with similar retrieval time, and updating the boxes over time
The full sample application source code is available for download.
Getting an Initial List of Cameras
Before we can generate optimal boxes, we need to do a one-time retrieval of the complete list of available cameras. Attempting to retrieve all the cameras in a single call will typically time out, so instead, the sample code retrieves cameras in 10x10 latitude/longitude boxes.
Filter Cameras By Type
Vizzion’s Camera Service can retrieve both roadside and hotspot cameras. Roadside cameras are stationary cameras which are installed by roads while hotspot cameras are virtual cameras that are assigned a geographic location and are used to capture images from cameras installed in vehicles. In this sample application we are only interested in the roadside cameras, so to make retrieval more efficient hotspot cameras are filtered out.
Partitioning Into Boxes With Similar Retrieval Time
The most efficient way to retrieve a large amount of camera data is to use multiple threads to retrieve multiple geographic boxes in parallel. In this sample we want to create 10 boxes, one for each of 10 threads, with a roughly equal number of cameras in each thread. An example is show below.
In order to generate these boxes, a recursive space partitioning algorithm is used. The algorithm recursively divides the original box with all cameras into smaller and smaller boxes, resulting in the desired number of boxes with a similar number of cameras in each. Each box should take a similar amount of time to retrieve in the target application.
Updating Boxes Over Time
Roadside cameras get added and removed over time. While these changes will have minimal effect on the optimal boxes in the short term, eventually these changes will accumulate and the boxes will need to be updated. Since retrieving a full list of cameras is time consuming, we recommend building in a weekly update of the optimal boxes to the main application.
Downloads
Download | Details |
---|---|
Source code | Requires Visual Studio 2012 or later |