finding contour lines that are closest

Hi,I need help!!!

I have a black/white contour map.Then I need a colour contour map. I need to know the maximums in the contour map. How can I to do that?Its maximum are essencial for colour’s routine to colouring. can anyone help me? the idea is to do a 3d-contour map finding a grid scale of the color-contour map.


Sorry I find it hard to understand your needs.
How is it possible to help you then :stuck_out_tongue: ?

  1. is that black/white or shades of grey ?
  2. define what you call maximum
  3. what is the colour routine doing
  4. what is the link between the 3 items : 3d contour map - grid scale - color contour map ?

I’m sorry. I believe that nontapeworm time to explain the problem completely. I go again:

I have a black/white contour map. This is a map where black lines represent contour lines. The rest of the map is white. My propouse is to do a 3d contour map from 2d black/white contour map.

To make this, first I need to colour the black/white contour map. It is the hard step!! I have a class that to colour a region given a posicion of the map.

You can to imagine a island’s map for example. In it, each island had a representation per contour lines. The idea is find the contour lines that are closest, it is for to colour the islands. It contour lines that are closest to represent the maximums of the islands.

Then with a colour contour map, I can to see each pixel to do the 3d contour map. You can to see too that the colour map is really a grid-colour map. I explain myself, each pixel represents a grid-scale of the one colour(anyone).

A example for a black/white contour map:

Well, thank you for you time.


This problem is not uniquely solvable, since a contour may either represent an increment or a decrement of altitude. Consequently, when you regard the contour lines of a mountain, they may as well be the contours of a lake, or anything in between.

A first step would be to develop a heuristic, like this: mark a deepest point manually, and then do a modified flood fill algorithm that assigns altitudes to visited points. The flood fill increments the altitude each time it visits a new pixel that is black from a white pixel.

There is still a problem when there is more than one deepest point in the terrain. One could seed the flood fill from several points, and the ‘color’ assigned to each newly visited pixel is the ID of the seed point plus the altitude as computed above. Whenever the flood fill reaches an already colored pixel with a different seed ID, the difference between the seed points can be computed.

This approach assumes that the altitude increment for a connected region happens at once. The flood fill has to be modified accordingly. What should not happen is that contour lines are interpreted a increments and decrements when coming from different seed points.

These are surely not the only problems, I was just musing about the problem a bit…