I am trying to recognize waterways from aerial photographs (say from Google Maps). Local governments often have GIS data that says where the waterways (and roads, buildings etc) are, but the water data in them is often somewhat inaccurate, and we might be able to improve them using aerial imagery. So we have some data already that isn't always to be trusted.

I know how to do some basic image processing on the data (unfortunately I don't have sample images to show here yet, I'm trying to imagine how I could do this, no working code yet):

  • I can collect some set of color values using bits of waterway in images, and figure out which pixels are closest to these colors, possibly also for other types of feature (grass, roads, buildings etc). If I set a threshold on which pixels are "close enough", I get a set of pixels that are probably waterways (but there will be a lot of noise).

  • I can turn the image into grayscale and use a standard edge detection algorithm to figure out where the edges are. Again, this gives me a set of pixels of like boundaries, but there will be noise and edges will be too think and/or have gaps.

What I want to have as output is a set of polygons that outline the probable waterways.

Intuitively I'd like to use the detected edges to create polygons, and the colour information to decide which of them are water, possibly making use of the government data we already have.

Is there a known way to get from the result of an edge detection algorithm to a nice set of closed polygons? Or any other tips on how to attack this problem, if there's a better way?


migrated from ai.stackexchange.com Feb 24 '14 at 18:17

This question came from our site for people interested in conceptual questions about life and challenges in a world where "cognitive" functions can be mimicked in purely digital environment.

  • 1
    $\begingroup$ Sidenote: Keep in mind that the google license does not allowed to do this! Openstreetmap has the same problem. OSM does have an agreement to use Bing images. $\endgroup$ – PiTheNumber Feb 17 '14 at 13:19

This is hard to do with color information alone. Color variations between (or even within) aerial and satellite imagery can be huge. Ideally you will want hyperspectral or at least infrared imagery (see this paper).

Assuming your edge detection can snap to pixel boundaries, you can take each pixel's borders as a closed polygon and union them together to form a polygon (depending on your union implementation you may end up with a polygon with inner rings or holes) or a collection of polygons. The Java Topology Suite and other computational geometry implementations can make this much easier for you. If you want to use sub-pixel boundaries you will need to be very careful that you have a good epsilon value set so you can snap edges that are very close but not exactly touching.

If you want to take the edges and combine them yourself you will want to build a graph of intersecting edges and implement code that traverses the graph (e.g. counter-clockwise) to find where it closes in on itself to form a polygon. This is how some of the union implementations of polygons works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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