Overlapped images (what can you do with it)
Posted: 2013-01-03T20:41:42-07:00
As part of a problem I was facing I had a collection of maps (about 30 where were extracted and cleaned up from a game)
For example, ...
These maps overlaped, and I wanted to find how they fitted together.
So I created a rough script
http://www.imagemagick.org/Usage/scripts/overlap.v1
Runing it with the above using
produced 4 overlay results (all the same), which is the 'composite layering offset used' for the merge.
map_a3_fellesweden.png -page +-80+-32 map_a4_south_jungle.png -> "merged_001.png"
and results in this image
The script extracts 9 smaller sections (rather blindly) from each map and tries to find those sections in the other map. If the match is good enough, it calculates the offset between the two and layer merges the image to produce a composite.
The script is slow. Does not remember previous matches, and typically finds the same overlapping position multiple times. Also if the 'section' used for a specific search is very plain (that is it has a low energy or entropy) it may fail completely or fail to produce a good match. Also it does not handle multiple images (maps) very well, handle transparency well, or check how well the whole area of image overlap 'fits' together, or determine if it should overlay or underlay images relative to each other.
It is also not designed with 'real life images' or images with perspective distortions in mind, as you get with a panorama composite. but it is a start.
I am putting the script out for anyone else to 'play' with it, and perhaps improve it.
What improvements can you make?
For example, ...
These maps overlaped, and I wanted to find how they fitted together.
So I created a rough script
http://www.imagemagick.org/Usage/scripts/overlap.v1
Runing it with the above using
Code: Select all
overlap map_a3_fellesweden.png map_a4_south_jungle.png
map_a3_fellesweden.png -page +-80+-32 map_a4_south_jungle.png -> "merged_001.png"
and results in this image
The script extracts 9 smaller sections (rather blindly) from each map and tries to find those sections in the other map. If the match is good enough, it calculates the offset between the two and layer merges the image to produce a composite.
The script is slow. Does not remember previous matches, and typically finds the same overlapping position multiple times. Also if the 'section' used for a specific search is very plain (that is it has a low energy or entropy) it may fail completely or fail to produce a good match. Also it does not handle multiple images (maps) very well, handle transparency well, or check how well the whole area of image overlap 'fits' together, or determine if it should overlay or underlay images relative to each other.
It is also not designed with 'real life images' or images with perspective distortions in mind, as you get with a panorama composite. but it is a start.
I am putting the script out for anyone else to 'play' with it, and perhaps improve it.
What improvements can you make?