views:

427

answers:

2

I just tried to use Google Map Buddy to get satellite image from Google Map. This application first download small images from google map and then stick them together into new image. I had to wait about 2 hours to get images download my computer and it looks like it downloaded all images (22,194 images) but then the app told me that it cannot stick them together. When I started app again I though this app will reuse images on my comp but it start downloading them again. So I had to stop the process and ask you, guys, if you know how I can put that puzzle together.

The naming pattern of those images goes like this:

x=92651y=48130zoom=17.png
x=92652y=48130zoom=17.png
x=92653y=48130zoom=17.png
x=92654y=48130zoom=17.png
x=92655y=48130zoom=17.png
...
...
x=92664y=48131zoom=17.png
x=92665y=48131zoom=17.png
x=92666y=48131zoom=17.png
x=92667y=48131zoom=17.png
...
...
x=92689y=48132zoom=17.png
x=92690y=48132zoom=17.png
x=92691y=48132zoom=17.png
x=92692y=48132zoom=17.png
x=92693y=48132zoom=17.png

What can I do to stick them together programmatically using some simple scripting language? I have access to Mac and Windows systems and may be can install any simple scripting languages.

Thanks

+1  A: 

The process of "sticking images together" is usually called "stitching" or "mosaicing".

I found a list of many applications that do this on Wikipedia article - "Comparison of Photo Stitching Applications".

Edited: removed link to single app I found and replaced with wikipedia list of software.

Nate
Note that a program like this would require you to hand-position potentially hundreds of tiles - depending on how large an area he wants.
Chris B
Is it possible to do it programaticaly using some command line or automator in Mac
Maksim
I believe that is what the "automatic" value in the "Matching Mode" column is for in the comparison.
Nate
Stitching usually requires overlap between the images as photo stitchign applications match common features to overlay them. In Google's case I'd suspect that the images fit neatly to each other but have no overlap which makes the entire stitching exercise a non-solution.
Joey
I don't think that's "required" - http://biop.epfl.ch/page72836-en.html
Nate
For most "Photo Stitching Applications" it will indeed be required. They are intended to be used to create panoramas from overlapping photographs. The link you posted is about stitching images from a motorized microscope.
Chris B
+1  A: 

You could use Python with Python Imaging Library (PIL).

First I'd make a list of filename and their coordinates. Extract the integer coordinates from the filenames with regular expressions and store them in a list of dictionaries:

>>> filename = 'x=92664y=48131zoom=17.png'
>>> imagePattern = re.compile(r'^x=(\d{5})y=(\d{5})zoom=17.png$')
>>> x,y = map(int, imagePattern.search(filename).groups())
>>> {'x':x, 'y':y, 'filename':filename}
{'y': 48131, 'x': 92664, 'filename': 'x=92664y=48131zoom=17.png'}

Having a list of dictionaries enables you to sort them according to either dimensions:

tileListSortedByX = sorted(tileList, key = lambda i: i["x"])

and also filter them:

fileListWhereX48131 = [tile for tile in tileList if tile["x"]==48131]

With these two operations you can easily imagine the for loops to iterate over tiles line by line.

The last thing you need to create a big empty image (with PIL) where you'll paste the small tile images into. Its size will be a multiple of the tile size.

>>> from PIL import Image
>>> bigImage = Image.new('RGB',(300,300),(255,255,255))
    #creates a white 300x300 image

Pasting the small images into the big one looks like this:

>>> smallImage = Image.open(tile["filename"])
>>> bigImage.paste(smallImage,(0,0))

Hope you get the idea.

Ivan