I want to obtain a n*m matrix with a approximated "height" at each discrete point. The input is a picture (see link below) of the contours from a map, each contourline represents an 5m increase or decrease of the height.
My thoughts:
- I imported the picture as a logical png to a matrix called
Awhich means that every contourline in the matrix is a connected strip of '1's and everything else is just 0. - My initial thought was to just start in the upper left corner of the matrix, set that height to zero, declare a new matrix 'height' and start with figuring out
height(:,1)by adding 5 meters each time we meet a '1' in theAmatrix. Knowing the whole first colonn I now for each row start from the left and add 5 m each time we meet a '1'. - I quickly realized however that this wouldn't work since there is no way for the algorithm to understand whether it should add or subtract height, i.e if we are running uphill or downhill.
- If I somehow could approximate the gradient from the intensity of contourlines that would be great even though it would always be possible for a uphill to be a downhill and vice versa but then I could manually decide which is true of these two cases.

