While picking in order from medium to more extreme color values is by no means a perfect algorithm, it’s not bad, and let’s pause here to consider how even this fairly sophisticated version of making image mosaics is still just a few lines of code. I think this one looks better than either of the others, and it has no obvious bias toward being better on one side or another. Now we just need to sort that list by its second elements (the positions), break it into rows and use Grid to arrange all the images: ] where matrix is a two-dimensional array of : Import returns an expression of the form Graphics. The first line imports all the images and computes the average color of each one: Now, before we get into all the things wrong with this image, let’s look at how the code works. ![]() If it doesn’t look like a face to you, step back about ten feet from your monitor and look again. With those prerequisites, here’s all it takes to create a credible mosaic image: (You don’t want too large of a master image otherwise the tiled composite images will be too small to see, and the effect is actually more interesting for relatively coarse mosaics because up close they look like nothing, while from a distance the face jumps out at you.) Second, a master image to form the mosaic out of: I made one called MendeleevIcon.tif, which contains a 20×20 pixel image of Dmitri Mendeleev’s face. First, a directory full of image files: I made one called “Pool” filled with a couple thousand small (32-pixel square) JPEG files. It turns out you can do a first pass at it with three lines of input. But upon brief reflection I decided it would probably be faster and easier for me to write code to do this from scratch in Mathematica than it would be to find something to download and then figure out how to use it. You might think that creating photo mosaics is a standard task for which software, probably even free software, is available. (You can see this library at don’t forget to order a copy of my photo periodic table poster.) It was convenient in this regard that I possess the world’s largest stock library of photographs of the chemical elements-about 2,000 photographs of roughly 1,550 different physical samples of the pure and applied elements-along with a photograph of Mendeleev and a bit of software called Mathematica. ![]() You’ve probably seen examples of photo mosaics where each “tile” in the mosaic is a tiny photograph, selected so the overall brightness and color of the tiny photo averages out to the brightness and color needed for its position in the overall mosaic.įollowing a suggestion by Ed Pegg, I suddenly found it impossible to imagine life without a photo mosaic of Dmitri Mendeleev, the principal inventor of the periodic table, made out of photographs of the elements.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |