Archived

This topic is now archived and is closed to further replies.

jollyjeffers

Generating a height map from an OS map

Recommended Posts

hi all, got an interesting little graphics challenge - wondering if anyone could provide me with some bright ideas, cos everything I''ve tried only get 1/2 way to the goal Dunno how many people will be familir with OS (Ordnance Survey) Maps, used primarily in the UK afaik (where I am). I presume most countries will have similar.. OS maps have orange lines indicating where contours are (you can tell gradient, and height), I need to take said image (with a whole load of other bits and pieces on it), extract the orange lines and then use this to convert/create a greyscale elevation map! Any clever ideas? I don''t need an algorithm for it - I can use Paint Shop Pro to author the images as an artist, and store said heightmaps, but so far its not working out too well Jack DirectX 4 VB: All you need for multimedia programming in Visual Basic Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
If you mess with the saturation in PSP you might be able to make the orange liens strongly visible. If you then mess with the contrast/brightness you might be able to suppress the background to some extent. After that you can try using the magic wand to pick out the orange lines (or the select by colour tool, unless thats a photoshop thing, can''t remember). Copy the orange lines out, and paste them into a separate image. When they are in a separate image.. fill in any orange bits that are missing (from text etc) as the lines have to be continuos. Next make a new layer.. and fill adjacent regions with gradually increasing (or decreasing) intensities of grey. When you have done it all (try and get a black to white spread)... you can then remove the orange layer, and then fill the remaining blank spaces. After that is done.. you can apply a gaussian blur to the resulting greyscale image, to make the transitions more continuos. This is a pretty roundabout method, but having said that, it might be possible to automate it more.

If the orange line extraction method is not working very well.. you could just trace the contours onto a second layer. This is a lot mroe labour intensive, but may prove more effective in the end.

Not sure what else you can do really.

Share this post


Link to post
Share on other sites
quote:
You could just trace the contours onto a second layer. This is a lot mroe labour intensive


hmm, I just found this one out results are good - but for a full size map it''d take days!

I''ll give your trick with saturation a go, I''ve been messing about with various filters and colour ops to try and filter out the background and enhance the contours..

cheers,
Jack

DirectX 4 VB: All you need for multimedia programming in Visual Basic
Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
I'd write a program myself to convert the contour maps to height maps, and then tweak the resulting heightmaps using Photoshop.

You could use an algorithm like Watershed to convert the contour, or some for of density estimation algorithm that would give you an interpolated height and an estimate as to where the top of each 'mound' is.

As long as each contour is a fully enclosed region (or can become a fully enclosed region with some preprocessing) you shouldn't have too much of a problem.

I'll explain in more detail:

Essentially what you want to do is determine which area corresponds to a particular contour. A flood-fill alogorithm should fill in each separate area provided that the contours are enclosed areas. Each area would have a corresponding height associated with it.


Once you know which area correspondes to where you have a number of options. As is you will have a very odd heightmap with a set of plateaus. To fix this you can try any number of solutions.

Bilinear interpolate across the pixels, use a median filter, cast rays to figure out where the 'top' of a mound is, etc... Whatever will give you the look your after.

Cheers,
Will






[edited by - RPGeezus on October 23, 2003 2:04:13 PM]

Share this post


Link to post
Share on other sites