Topographic map Contour lines extraction

3.2k views Asked by At

I am trying to extract the contour lines from colour topographic maps. The goal is to build a 3D demonstration of the area, using an engine developed by me from zero. Untill now everything worked great (making the 3D engine from zero and displaying objects etc.), but now I got stuck...

I have seen many documents describing algorithms for doing such a thing, however - they use a short language which I have a hard time understanding and assume a very strong knowledge of image proccessing.

I would be very pleased if any of you could tell me of a good resource to learn from how to do it, or tell of a sequence of resources which will allow me to combine them into a complete alogrithm. If you know any book which contains a chapter on ther matter, or has descriptions which will allow me to combine some elements in them into my own system, it would be of great help.

If you know of someone who did a similar thing - it would also help me to know him.

Thanks in advance !

2

There are 2 answers

1
mloskot On BEST ANSWER

You can use GDAL library which provides API for generating contours from raster. See GDALContourGenerate function. If you want to learn about algorithms details, just take a look into the source code of GDAL.

You also can experiment with this GDAL capability using command line utility: gdal_contour

3
Sam Axe On

We do all our 3D terrain modeling from USGS DEM (Digital elevation model) files.

Edit: Convert your scanned images into grayscale and increase the contrast until you have the contour lines and not much else (either via image editing software or programmatically). At this point your lines should be black. Scan through the pixels and record all the black pixels that border other black pixels.. say you need a match of at least two other bordering pixels. You could also apply some kind of volume formula to each saved region.. say.. anything less than 50 contiguous pixels is thrown out.