PDA

View Full Version : Vectorisation (convert raster map to vector form)



RichardProsser
02-08-2014, 02:38 PM
61155


Does anyone know of any software to help construct contour (height) information from a raster map? Doing that manually - even with an editor - could be tedious.

I have attached an example image to give you an idea of the challenge that I face!


Thanks ...

Richard

Gamerprinter
02-12-2014, 05:28 PM
Using Xara Photo & Graphic Designer 9, which has a built in image vectorizer, and tried it on your map sample. One problem is that your map sample is 72 dpi and your image is small, which gives me little to work with in hopes of creating an adequate conversion. I tried it, and to my judgment the process failed. It did vectorize, but the final image was very blurry and jaggy. I'm sure that if you posted a 300 ppi version of your map file closer to its original size, the conversion would have had better results.

I also sometimes work with CAD in my graphics shop, and I do own a rather expensive raster to vector converter for CAD purposes. It works well for CAD related work, but not well for illustrative work - and it costs more than $1000 for the software - so it is not a solution!

I know someone who works in a CAD shop and spends all his days using a drawing puck (CAD device) to retrace all the linework in existing drawings - including topographical maps like you've posted. Its all very tedious, but he is paid just to do that all day long.

So at best the process is problematic. As stated, if you had higher resolution and larger dimension maps to start with, you'd probably have better luck. As I didn't have much luck trying it with your sample.

SumnerH
02-13-2014, 12:43 AM
One problem is that your map sample is 72 dpi and your image is small, which gives me little to work with in hopes of creating an adequate conversion. I tried it, and to my judgment the process failed. It did vectorize, but the final image was very blurry and jaggy. I'm sure that if you posted a 300 ppi version of your map file closer to its original size, the conversion would have had better results.


This is exactly right. Auto-vectorization is hard even under ideal conditions, and low-res blurry images are almost impossible.

Attached is an SVG with 2 attempts courtesy of Inkscape: the top one is done based on brightness steps, the bottom uses edge detection. Neither is great, in part because of the original image quality.

ravells
02-13-2014, 08:59 AM
This looks like a countour map of a real place. If it is, then an alternative approach would be to go to the USGS site and download the DEM data of the location. Use a programme that will read DEM info (I use Fractal Terrains) but I expect WILBUR (which is free) will be able to do (not sure). I think there may be some DEM to vector converters out there, but this is getting beyond my field of knowledge.

Redrobes
02-13-2014, 04:12 PM
I tried to do this with some old maps I have and wanted a DEM of the map contours and its a hard thing to do. In fact I read a PhD paper on someone claiming to do this and asked some pointed questions to them and their response was "well er.. actually it doesnt work on many maps" yada yada which is about my experience of it. The reason is that unless you use specific maps and specific areas and terrain topology it cant work. The reason is that if you take a normal publication map then usually it prints the contours as a light colour and also its on a layer that is at the bottom of the printing stack. So contour heights, placenames and all sorts of stuff get put on layers which mask the contour. Secondly, on the maps which I had (and I wont mention which....) the contour lines and the buildings are of similar RGB colour so difficult to isolate. But heres the clincher, if you get to a steep ravine or cliff of any sort then all the contour lines bunch up and become a single line.

Ok, so say your map is special and does not have buildings on it and also no cliffs then I wrote a tutorial on how to convert these (usually ones I have drawn the contours myself) into a full pixel DEM. If I cant find the link then ill briefly explain it. Get your contours into black and white. I.e. white background and black lines. No shades of grey just contrast enhance till you lose them. Then using the flood fill tool with black ink, find either the highest or lowest point on the map and fill it. Then miss a contour then fill the next so its like zebra bands of black and white. Then you may want to smooth it to shades of grey and put the contrast back up to max again to make sure you dont leave any 1 pixel holes in it. Then shove it into inkscape and do the raster to vector scan of it in there. By doing the zebra you only get one set of vector lines per contour instead of one per side of the line.

I'll edit in the link if I can find it.

http://www.cartographersguild.com/how-do-i/12729-scanned-map-into-3d.html
http://www.cartographersguild.com/mapmaking-requests-archive/19247-geographic-hieght-map-game-mod-project.html
http://www.cartographersguild.com/3d-modeling-objects-maps/20393-osprey-style-map.html

A few posts where I detail that but no actual tut. Still there you go.