Of course, there will be some objects (such as posterboards) that have the same color as the door and also have vertical edges. If we could tell whether or not a particular object has a trapezoidal shape in the image, we could potentially achieve greater accuracy by eliminating non-trapezoids and trapezoidal objects that do not satisfy the same invariants under projective and perspective transformations as a door in Gates (which are all the same size). However, as we discussed above, noise, quantization, and thresholding make it difficult to detect the top and bottom of a door with Hough. We would require a more sophisticated shape-finding algorithm (such as having Hough give more weight to close-to-horizontal lines, using the convex hull of the B/W bitmap to find the upper and lower door-edges, or using the Snake as mentioned in the previous section).
Having been convinced that the object is a door, we use the MATLAB command imfeature to find its centroid, and place a small cross at this location. The final output of the algorithm, then, is the original image with the small crosses and detected lines superimposed on the objects the algorithm decides are doors. For the example we have been considering, the output looks as follows:
Figure 10: Output of algorithm.
Return to Table of Contents