## 3 Methods
### Image Pre-Processing  
The cameras are under manual control by the Highways Agency and therefore the direction in which the cameras point is variable. The direction is dependent on road traffic conditions at the time and any incidents that may have occurred that require closer inspection by the relevant authorities. Cameras located away from junctions are more likely to be static for most of the time and are aimed looking down the highway rather than across it. The first step of processing is to automatically collect images from each camera into sets of images that were taken in the same general direction. This was performed by cropping all images to remove static ancillary information (such as overlaid timestamps generated by the camera). An initial key image (usually the first one in the set) was established and subsequently an attempt to align it with the remaining images from that camera (the test images) was made.  
The alignment was not carried out on the raw images, but on ones that had been pre-processed. A binary image (two levels) describing where there were strong intensity edges within the image was found using an edge detector. This was then blurred with a Gaussian filter, which thickened the lines and gave them a Gaussian intensity profile. This was fed into a cross-correlation algorithm; the result of which generated a two-dimensional image, where the pixel intensities mapped how well aligned the two input images are if they were overlaid with different offsets between each another, in both the x- and y-axis. The offset between the maximum pixel value and the centre of the image was used to determine how much to offset one image against the other to bring them into alignment.  
Any pair of images where the maximum of the cross-correlation image was within 20 pixels from the centre was considered to be part of the same set of images. The offset between the peak and the centre of the image represents how much to offset one image against the other to align them. A cross-correlation performed between any two images must always have a maximum point, even if the images have completely different compositions, furthermore, these maxima could be within 20 pixels from the centre by chance. This would have the effect of images appearing to be aligned when they were not.  
To avoid misalignments, each image was divided into four equal quadrants and cross-correlations performed on each quadrant independently. For the image to be taken as part of the same set, the offsets between at least three of the quadrants were required to be within 2 pixels of one another. If the key image was correlated within 20 pixels and passed the quadrant test then the tested image was added to the key image's set. Otherwise, the image was treated as being taken in a different direction and became a new key image to be compared against later images. The process was repeated until all images were exhausted, by comparing each successive image with all the key images that had been determined so far. This process is also explained as a flowchart in Figure 2.  
Because images were always tested over all previous key images, even if a match had been found, it was possible for some images to appear in more than one set. Intersecting sets were combined by calculating the mean offset of the images that were common to both sets (relative to the key images of each set) and shifting the offsets in each intersecting set relative to this, thus making a superset. As image alignment is part of the collation process, this also has the effect of removing small variations in the direction the camera was pointing in, due to the result of wind, for example. The process is  
Figure 2: Flow-chart describing the image collection and alignment process, along with example images output at different stages of the process.  
resumable; the pre-processing stage can be restarted from where it last finished when newly acquired images are available, this means that the results can be continuously updated.