title: Removing lakes from diamond square map
body: <p>I implemented the diamond square algorithm in Java, but i'm not entirely satisfied with the results as a height map. It forms a <strong>lot</strong> of "lakes" - small areas of low height. The heights are generated using the diamond square algorithm, then normalized. In the example below, white = high, black = low and blue is anything below height 15: a placeholder for oceans. </p>
  
  <p><a href="https://i.stack.imgur.com/ZVJoD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZVJoD.png" alt="height map example"></a></p>
  
  <p>This image shows the uncolored height map
  <a href="https://i.stack.imgur.com/nKEBZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nKEBZ.png" alt="enter image description here"></a></p>
  
  <p>How can I smooth the terrain to reduce the number of lakes? </p>
  
  <p>I've investigated a simple box blurring function (setting each pixel to the average of its neighbors), but this causes strange artifacts, possibly because of the square step of the diamond square. </p>
  
  <p>Would a different (perhaps gaussian) blur be appropriate, or is this a problem with my implementation? <a href="https://stackoverflow.com/questions/7549883/smoothing-issue-with-diamond-square-algorithm">This</a> link says the diamond square has some inherent issues, but these don't seem to be regularly spaced artifacts, and my heightmap is seeded with 16 (not 4) values. </p>