Dec 27, 2007

Working with image: Mosaic images

Creating the image mosaic can be very easy in Mathematica.

First, what's inside the image?
Import["mnt.png", "Elements"]]

{"BitDepth", "ColorMap", "ColorSpace", "Data", "DataType", "Graphics", "GrayLevels", "ImageSize", "RawData", "RGBColorArray"}

We only need use the "Data": Import["mt.png","Data"]

Here we "steal" some images from Almighty Google as the example.
Import the following four images (a0,a1,a2,a3)
See these two guides for details on Quadtree coordinate system used by Google.
Coordinate systems for Google Maps and Google Satellite Images

Then create the data matrix for the new image:
mosaicimg=ArrayFlatten[{{a0, a1}, {a2, a3}}];

Draw the new image and export it:
Graphics[Raster[Reverse[mosaicimg]/255, ColorFunction -> RGBColor],
PlotRange -> {{0, 511}, {0, 511}}, ImageSize -> {512, 512}]

This is the image used in Fun with image overlay: Google Map

No comments: