Stereo Matching Using the Hausdorff DistanceEE148 Project WebpageTeam Members: Philip Nowell, Sam Thompson, Lilli Davis Project SummaryThe problem of reconstructing 3d information from 2d stereo images is a long standing and difficult one. One of the most difficult aspects of this problem is that of automatically determining matching features between the stereo image pair. The problem of curve matching between image pairs is made difficult because the topilogical connections between the segments may be lost or distorted between the images. Depending on the baseling and relative rotation of the cameras, curves may be deformed, segmented, or not correspond at all between the left and right images.The algorithm which we have implemented as a method of stero matching applies a mathematical metric known as the Hausdorff Distance as a feature-based method of establishing correspondences between the stereo image pair. Though for all our test images we used stereo images separated by a relatively small baseline and cameras with little relative rotation, the Hausdorff metric applies equally well to images which vary to a greater degree. The Hausdorff DistanceThe Hausdorff distance between the sets of points on two curves A and B is the maximum over each element a of A of the minimum over each element b of B of the distance from a to b. More simply, take the first element a of A and find the minimum distance to the set B. Do that again for the second element of A, and so on until you've done it for every element of A, and the Hausdorff distance is defined as the maximum of each of these minimum distances.The Hausdorff distance may be defined more concisely as In the stereo matching process before the Hausdorff distance may be applied between two curves the disparity of each curve must be calculated. The disparity is defined as the optimal traslation for a curve in the left*1* image so that if the left and right images were superimposed, the curve from the left image would be directly on top of the curve to which it matches. Thus before the Hausdorff distance may be usefully calculated between two curves the curves must be superimposed so that they overlap as much as possible.
Image Pre-Processing![]() Pre-processing is the term we use to describe all the steps which must be implemented in order to reduce a pair of stereo images to data structures holding sets of curves which can then be usefully manipulated.
![]()
![]()
![]() Starting at the pixel marked '1', all the nighbors around the pixel are traversed in order and the number of 0 to 1 transitions is counted. A 0 to 1 transition means that you have come from a pixel which is not used in an edge onto a pixel which is used in an edge. This information allows one to determine weather or not the pixel is on an edge boundary and therefore should be deleted. A pixel P is flagged for deletion if it satisfies the following conditions:
To ameliorate this problem, two passes are used for the completion of the algorithm. After all of the pixels are marked for deletion, in the first pass all teh south and east pixels are deleted and in the second pass all the north and west pixels are deleted. Splitting the process into two halves allows the process to efficiantly thin the edges into one pixel wide curves. ![]()
Once the edges have been segmented into cuves, the curves are collected and stored in an array. Each curve is represented by an array of numbers known as a chain code. A chain code is constructed by beginning at the head of the curve and storing the neighbor value of the next pixel in the curve. The neighbor value is a number from 1 to 8 which is an indication of the location of the next pixel in the curve, with north being 1, south being 5, and so on. chain codes consist of lists of neighbor values as the curve is traversed ![]() After the curve collection process, an array of curves represented as chain codes has been created and stored for futher use. The following is an image of the segmented curves, the colors differentiating between distinct curves. ![]()
![]()
In Kruskal's algorithm all edges of the graph are sorted according to weight with the smallest edges first. Then to form the minimum spanning tree edges are simply added in order but before each edge is added there is a check to be certain that a loop was not formed. The result of this process is that the shortest edges are added while the longest edges are all towards the end of the list and are therefore left out of the tree as by the time they are reached the whole tree has been spanned. ![]()
![]() The Matching ProcessOnce the preprocessing stage has been completed our stereo images have been reduced to a collection of data indicating the location of each curve in each image and how the curves in each image relate to each other. The actual matching process begins with choosing a starting edge in the left image called the root node.The root node is chosen to be one of the longest and straightest curves in the left image because a long straight curve will have a much lower probability of being noise. Also such a curve will be more likely to have a good match in the right image--a good match meaning a corresponding curve which does not branch or diverge in some strange way. Once the root has been found in the left image, it is placed on a voronoi diagram of the right image in such a way as to maximize the amount of black on the root curve. That is, the root is moved around in the voronoi diagram until it is placed on top of a curve which it most resembles. To place the root in the right image a search window of fixed size is used. This search window is determined by some basic assumptions such as that curves from the left image will be translated left in the right image and that the curve will not be translated much in the y direction between the stereo images. After the root node has been placed the translation which optimally placed the curve is recorded as the curves disparity. ![]() To match the remaining curves the minimum spanning tree is traversed recursively with each node passing its disparity to its neighbors to dynamically determine a search window for each node. This dynamic search window determination adds significantly to both the efficancy and accuracy of the matching process as each curve need only be matched within a small search window, and this, in turn, makes it less likely that curves will match to similar curves which are far away in the image. After the minimum spanning tree has been traversed completely and each curve from the left image has been placed optimally on the right image, matching points are determined by simply stepping along each properly placed curve from the left image and taking the nearest point in the right image. It is necessary to match points instead of curves because in the stereo images curves could be eliminated or segmented and therefore you will not have a one to one curve correspondence between the two images. Final ResultsHere is a picture of our final results. Each point is colored the same as the point which we calculated it matched to. As can be sees, the curve matching algorithm which we implemented worked quite well.
When starting our project our intent had been to actually reconstruct a 3D image by triangulating between our matched points. But in attempting to do this we ran into problems reconstructing our image because the matching points triangulated to 3D points which varied too much in space. Therefore, because of the nature of the 3D construction, we ended up with many disconnected and spiky horizontal slats across our image. If given more time, we would either attempt to implement a simple ball-pivot algorithm to connect our horizontal slats (after applying some sort of smoothing filter) or attempt to apply our algorithm to multiple perspective views of the same object in the hopes of getting better information. But since our time to work on the project is up, we consider our project complete having finished the curve matching algorithm. We are pleased with our results as effective automatic feature matching between stereo image pairs is a significant accomplishment in itself. Team Member ResponsibilitiesNote: Though each team member was made responsible for specific aspects of the project, most methods were written collaboratively and therefore the ascription of any one task to any one individual is somewhat difficult.Philip Nowell:
References[Kedem, Yarmovski96]: Klara Kedem and Yana Yarmovski, "Curve Based Stereo Matching Using the Minimum Hausdorff Distance", Symposium on Computational Geometry, 415-418, May 1996.[Schmid, Zisserman00]: Cordelia Schmid and Andrew Zisserman, "The Geometry of Matching Lines and Curves Over Multiple Views", International Journal of Computer Vision, 40(3):199-233, 2000. [Davis?]: Larry Davis, "Edge and Local Feature Detection" Related Websights & Additional Information
Contact InformationLilli Davis : davis@ugcsPhilip Nowell : nowell@cs Sam Thompson : samuelt@its |