| Image-to-map conversion | |
|
|
Author | Message |
---|
Metalhead33 Peasant
Messages : 4 Quality Points : 0 Registration Date : 2016-06-12 Age : 32 Location : Budapest, Hungary
| Subject: Image-to-map conversion 2016-06-12, 05:10 | |
| Hello everyone!
Currently, I am in charge of a project that would convert images to maps for H4: https://github.com/Metalhead33/Homm4-img2map
Why? Because I have an image of a map, and I am too lazy to make a map based off it by hand, so I'll convert the pixels of the image to terrain types.
Currently, my program isn't functional, and it's for Homm4, BUT... Homm3 uses the same format: map compressed into .gzip. So, if there is a demand, I can expand my project to work for both Homm3 and Homm4.
I have this image. I will clean it up, pick a specific part of it, and then I'll be able to convert it into a H4 map. | |
|
| |
Orzie Master Modder
Messages : 2166 Quality Points : 843 Registration Date : 2014-12-12 Age : 32 Location : Turkey
| Subject: Re: Image-to-map conversion 2016-06-12, 05:12 | |
| Nice! Would love to see such tool working for Heroes 1-3 too. ________________________ | |
|
| |
Metalhead33 Peasant
Messages : 4 Quality Points : 0 Registration Date : 2016-06-12 Age : 32 Location : Budapest, Hungary
| Subject: Re: Image-to-map conversion 2016-06-12, 05:14 | |
| - Orzie wrote:
- Nice! Would love to see such tool working for Heroes 1-3 too.
Once I manage to get my converter to work, I will do some research on H1-3 map formats, and get to working on it Be warned though, my tool will only generate terrain types - the map will be devoid of any objects on it. That will have to be put on it by the player. | |
|
| |
Orzie Master Modder
Messages : 2166 Quality Points : 843 Registration Date : 2014-12-12 Age : 32 Location : Turkey
| Subject: Re: Image-to-map conversion 2016-06-12, 05:15 | |
| That's how it must be done. Still, the mapmaker must remember that impassable terrain squares are colored with a darker version of a terrain color on the map. ________________________ | |
|
| |
Thorjac Gargoyle
Messages : 12 Quality Points : 5 Registration Date : 2015-09-10
| Subject: Re: Image-to-map conversion 2016-06-12, 08:56 | |
| This is already possible for Heroes III through the WoG editor. | |
|
| |
BoseDrache Nomad
Messages : 66 Quality Points : 50 Registration Date : 2015-08-01
| Subject: Re: Image-to-map conversion 2016-06-12, 11:46 | |
| I have 144x144 image to H3 map conversion program. Have written it myself, it creates 144x144 landscape and 144x144 obstacle images, so one should draw a map manually. | |
|
| |
Metalhead33 Peasant
Messages : 4 Quality Points : 0 Registration Date : 2016-06-12 Age : 32 Location : Budapest, Hungary
| Subject: Re: Image-to-map conversion 2016-06-12, 22:51 | |
| - BoseDrache wrote:
- I have 144x144 image to H3 map conversion program.
Have written it myself, it creates 144x144 landscape and 144x144 obstacle images, so one should draw a map manually. Is that so? May I take a look at the source code please? *cute face* | |
|
| |
BoseDrache Nomad
Messages : 66 Quality Points : 50 Registration Date : 2015-08-01
| Subject: Re: Image-to-map conversion 2016-06-13, 23:20 | |
| Since that was long time ago, I don't even understand all the features I've implemented there. It was a GameMaker program... I can retell the idea. I. Rough (but correct) conversion 1. You divide your picture into 2x2 squares. 2. For every square you try all the landscape types. Then for all 4 pixels in a square you choose if it should be clear or have obstacle - minimum of these 2 values: (r-r_cl)^2+(g-g_cl)^2+(b-b_cl)^2 (r-r_ob)^2+(g-g_ob)^2+(b-b_ob)^2 3. Summarizing 4 minimal values of 4 pixels you minimize it again across the landscape types and then attach a landscape type with minimal sum to a square. Rough conversion gives you a correct, but lower than possible resolution pseudographics. II. Auxiliary conversion (incorrect in terms of Editor) 1. For every pixel (independently) you try all possible combinations of landscape types and obstacle/free settings. Attach a combination with minimal sum (as above) to a pixel. III. Through a number of iterations you remove incorrect places such as alone cells or thin (1-cell) bands from (II) using (I) as an origin. How it works. (Origin image - just a random cat from net) (Results - landscape map, obstacles map and preview) | |
|
| |
Metalhead33 Peasant
Messages : 4 Quality Points : 0 Registration Date : 2016-06-12 Age : 32 Location : Budapest, Hungary
| Subject: Re: Image-to-map conversion 2016-06-19, 09:05 | |
| Even more good news! Together with a friend of mine, we have started working on the map converter even more than before. And I have already managed to get a few maps converted.
Here is the proof: http://www.mediafire.com/download/3w722k5450u2r6c/H4converted_maps.7z | |
|
| |
Darmani Master Modder
Messages : 289 Quality Points : 47 Registration Date : 2014-12-27
| Subject: Re: Image-to-map conversion 2016-06-19, 14:55 | |
| Nice! Let me know if you want help on the H2 map format. | |
|
| |
Pitsu Pikeman
Messages : 45 Quality Points : 32 Registration Date : 2015-08-02
| Subject: Re: Image-to-map conversion 2016-06-19, 21:00 | |
| - BoseDrache wrote:
(r-r_cl)^2+(g-g_cl)^2+(b-b_cl)^2 (r-r_ob)^2+(g-g_ob)^2+(b-b_ob)^2
Although the conversion is not exactly to grayscale, the number of colors in H3 is limited. Thus have you also tried with the relative corrections for human eye perciption? like: 0.3*(r-r_cl)^2+ 0.59*(g-g_cl)^2+ 0.11*(b-b_cl)^2 maybe it has no effect, and if it has, then only in certain cases, but it may be something to think about when doing palette reductions | |
|
| |
BoseDrache Nomad
Messages : 66 Quality Points : 50 Registration Date : 2015-08-01
| Subject: Re: Image-to-map conversion 2016-06-20, 02:50 | |
| - Pitsu wrote:
- Thus have you also tried with the relative corrections for human eye perciption?
like: 0.3*(r-r_cl)^2+ 0.59*(g-g_cl)^2+0.11*(b-b_cl)^2 I've tried it today. The result is in general worse than for equal coefficients. Same cat: | |
|
| |
Baronus Nomad
Messages : 65 Quality Points : 1 Registration Date : 2016-06-12
| Subject: Re: Image-to-map conversion 2016-06-21, 09:53 | |
| I found imagemagic for HIII but it generate only landscape. If it is possible good thing will be generating full playable map. Very good idea. | |
|
| |
Sponsored content
| Subject: Re: Image-to-map conversion | |
| |
|
| |
| Image-to-map conversion | |
|