V
V
Vitaly Stolyarov2016-02-14 19:17:38
Images
Vitaly Stolyarov, 2016-02-14 19:17:38

How to extract elevation data from such a heightmap?

72e83fe6152f452eb6380ecd31f2159b.pngaa09dbe754164e2eb3e2f29965bdd5c2.png
All that is known: the blue areas are the lowest elevations, then comes red, then green, and after green even higher (in the lower left corner) comes red

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Stolyarov, 2016-02-14
@Ni55aN

Everything turned out to be simple, after visually evaluating the channels separately.
It turns out that the green channel is responsible for the total height from the bottom to the top, while the red channel represents the remainder for the green. At the same time, the green channel has several levels .
The formula is
: elevation = level*256 + green+red/256

V
Vasily, 2016-02-15
@Foolleren

But there is one moment, in the left corner there is again a countdown from 0, but the height increases, how to determine it programmatically is still unknown

it seems that when compiling the height map, a "byte" overflow occurred and everything was reset to 0
in the simplest case, you can determine the overflow area at the transition boundary 0 and 255, this is done by matrix convolution
-1 -1 -1
-1  8 -1
-1 -1 -1

but first you need to subtract the blue channel from the green
one, this is of course the first iteration of the solution
, that's what I got df1b8472b62b480aa7cc34ae735c5826.png
for those who are interested in what it is, I suggest the green channel in the "volume"
after a careful look at the height map, I came to the conclusion
that altuide = red + green * 256 + ( blue + add) * 256 ^ 2
channel add we get the following way
we do the convolution by the matrix
0 0 0
0 1 -1
0 0 0

the result is stored in the additional channel A1 (we recorded the transition from 255 to 0),
then we run the convolution matrix
0 0 0
-1 1 0
0 0 0

but this time we detect the transition from 0 to 255 and write to channel A2
in both channels we replace everything that is not 255 with 0, we replace 255 with 1
then we take the ADD channel (we take a type that understands negative numbers) we
run from 0 to x and sum we run the previous pixel with channel A1
from x to 0 and subtract A2 from the previous pixel
, we get the ADD channel which we use

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question