From the binary image of roads, the image of distance to roads can be computed by a method based on mathematical morphology, taking the digital elevation model into account.
Figure 21(a): Image of distances to roads
(Pixels in black colour are the nearest from a road)
Figure 21(b): Image of distances to roads (false colors)