4. Recognition Method
4.6. Comparison Techniques
4.6.2. Pair and Triple Blocks
4.6.2.8. Clustering
The second stage of the matching algorithm is clustering the matched blocks. The cluster uses the block’s external parameters of scale, rotation, x, and y data. A mapping is calculated for each matched pair from the previous block matching step. This mapping contains the adjustment required to translate the block from its position, scale, and rotation in the viewed image to the database image. If a number of matches come from the same object, they will have very similar mappings resulting in a large cluster.
Mapping Calculation
Each mapping contains four transform values, scale, rotation, x offset, and y offset. The scale describes the size of the viewed image block relative to the target object block; its transform is calculated by dividing the viewed block scale by the target block scale. The rotation describes the difference in direction from the target block to the viewed image block; its transform is calculated by subtracting the target block direction from the viewed image block direction. The x and y offsets describe the position of the viewed image block relative to the target block within the images; and are normalised for the scale and rotation changes.
94
To calculate the position mapping the scale and rotation effects must first be removed. The target block’s x and y values are transformed by the scale and rotation mapping changes to remove these effects on the position change part of the mapping. If the position changes were directly compared, a simple rotation change would result in large position differences at the outside parts of an object, despite it still being in the centre of the image. Applying the mapping to the target blocks allows the rotation and scale components to be removed; so in the case of the simple rotation no position change would be found. The dependence is removed by plotting a vector from the centre of the image to the block’s position. The vector’s length is scaled by the scale transform value, and the rotation transform is added to its direction. The difference between the new vector endpoint and the viewed block position are used as the x and y transform values. Simply using the centre of the image will mean the target blocks are moved across the image, and introduces a position change that does not reflect the objects actual position in the image. However, this added change is applied uniformly, and will not affect the clustering process. With all four parts of the mapping calculated for the blocks, the clustering of these values can begin.
Generic Quality Threshold Clustering Algorithm
The Quality Threshold clustering algorithm requires the specification of the threshold distance within the cluster and the minimum number of elements in each cluster (Naik, 1999). From each data point all the points within this threshold distance are found and stored with the cluster. The largest cluster is regarded as the true cluster, and its points are removed from any others. The process is repeated until no more clusters of sufficient size can be formed.
95
Figure 35. Two dimensional QT clustering example
The blue circles show the first pass, they are all the same size to reflect the specific threshold distance. The green circle shows how a cluster (left most blue circle) is ‘moved’ due to the removal of points on the subsequent passes.
Naik gives some advantages and disadvantage of this approach. Advantages
• Quality Guaranteed - Only clusters that pass a user-defined quality threshold will
be returned.
• Number of clusters does not require specification.
• All possible clusters are considered - a cluster is generated with respect to every
96 Disadvantages
• Computationally intensive and time consuming - Increasing the minimum cluster
size or increasing the number of data points can greatly increase the computational time.
• Threshold distance and minimum number of element in the cluster must be
specified. Implementation
The matched block pairs have been stored in two arrays, and each matched pair is passed directly to the clustering algorithm. The first step calculates all the mappings, scale and rotation are calculated first so they can be used to calculate scale and rotation independent position mappings.
The QT clustering algorithm was implemented as above, with one significant difference to save time. The maximum number of clusters was set. Because there must be a large number of matches contained in a cluster, it was found that there would often be over 20 clusters converging on the same set of matches. Setting a maximum number instead of using every point reduced the number of convergent clusters to only a few, and vastly reduced the processing time.
The constraints to pass this stage of the matching algorithm are a minimum cluster size, and a minimum proportion of the previously matched blocks. If these are met the blocks contained in the largest cluster were passed on to the final stage for spatial matching. Currently the system is limited to only identifying one of each object in an image. However, it is expected to be a simple task to enable the clustering algorithm to return multiple block groups if multiple objects are likely.
The maximum error was required to be large, to ensure blocks that should be in the cluster made it through. The main reason for this was large deviation in the block’s external parameters. The calculated position mapping is affected by errors in scale and rotation.
97