I'm interested in finding all tennis courts (and other similar well defined features like basketball courts) in my county, and I have aerial imagery of good (but varying) resolution, but I'm not sure of the best way to find them. Here are two examples of the imagery:

Tennis courts and basketball courts from VBMP 2009 Tennis courts from Bing

I've looked at the various methods, and I think template matching wouldn't work as it would be very slow since there can be arbitrary scale and rotation, and also the color can vary. The Hough transform sounds promising, but once I get all the lines I'm not sure how to find lines that constitute a rectangle with the appropriate ratio (about 36x29 feet), or better yet to account for the other marked lines.

For background, I'm aiming to add all tennis courts in my county to OpenStreetMap.

  • $\begingroup$ The lines are always in the same pattern, right? $\endgroup$
    – endolith
    Jan 15, 2012 at 5:50
  • $\begingroup$ Yes, they should be, at least for regulation size courts, which I believe is most. I've already mapped probably a hundred, so I could extract images, and analyze those. $\endgroup$
    – joshdoe
    Jan 15, 2012 at 12:31
  • $\begingroup$ Can you please post some more images? $\endgroup$ Oct 5, 2012 at 8:49
  • $\begingroup$ If available hyperspectral or multispectral imaging data could really help here. Green paint usually absorbs near infrared light while green plants often reflect the same light. $\endgroup$
    – Phil
    Jul 22, 2013 at 18:02

3 Answers 3


You have some very strong color and geometry cues you can leverage. I would try the following:

  1. Extract the Green channel & apply watershed type algorithm on it, followed by connected components. Subsequently compute component statistics (area & bounding box) for each component. Retain only the components with area ~= bounding box size. This will be true only for rectangular objects and will eliminate forests/wooded areas etc.
  2. Isolate the white channel (R=G=B) and apply hough transform on the output. This will give you the lines. Combine 1 & 2 to get your tennis courts.

I would first consider only the green channel, or make use in smarter ways of the peculiar colour properties of tennis court.

Once you´ve done that you can apply an edge detector, using an high threshold since the contrast between line and court is quite high.

To further remove outliers you can then apply hough transform at the end of the process.

Let us know if you get good results!


Aha there it is wrote a blog post on exactly this topic!

In their post they convert an image of a tennis court down to gray scale. Where they find the first and second derivatives of each horizontal and vertical line. Using this information they're able to determine where bright lines(possible court boundaries) are in the photo. From there they reduce the image to a black and white presentation of only the bright lines.

This is when they begin to search the image for the tennis courts. They use what they call a "model shape". A model shape is essentially a description of the object you're looking for "eg: 11 lines for a tennis court". The author finds all parallel line segments and compares the parallel line segments to the model shape. If there is a high enough match between the line segments and model shape then you have found a tennis court.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.