P
P
pshevnin2021-04-28 16:46:55
Java
pshevnin, 2021-04-28 16:46:55

How to separate areas on a map with a border?

Good afternoon, I am writing a term paper in java. I will briefly describe its essence: There is a txt file that contains all the pixels of the image. I have to count them, and build a map of the area (physical) from this, the value of each pixel in the file indicates its height above sea level. Initially, the image of the map is black and white, I am attaching a picture. Now the essence of the problem: In the second part of the coursework, you need to paint the map in different colors every 50 meters, that is, sections of the map 0-50 meters above sea level, 50-100 meters above sea level, and so on, each is painted in its own color. I coped with this, but the sections still need to be separated by a line, and here the question arises, what is the easiest way to draw a dividing line between different sections of the map? (I work with the image using Graphics2D, the final image is a BufferedImage). Jpg maps are attached.
6089671d0b3b1861075361.jpeg6089672fcbe23414066401.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2021-04-28
@pshevnin

Well, in the primitive - pixel by pixel. You check for each pixel to see if there are pixels next to it that fall into a lower range. If there is, paint it with the color of the border.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question