Never in the history of the world

March 23, 2011 at 2:15 pm (Uncategorized)

I found a great quote today from the chairman of the Egyptian stock exchange, Mohamed Abdel Salam said (as paraphrased in the article)  “Never in the history of Egypt or the world, however, has he seen a stock market closed for such a long period”  which closed on January 27th and just re-opened today, so just under two months.

I’m sure this is an argumentative fallacy, but I’m not sure the type.  Read it closely, he makes it seem unprecedented (Never in the history of the world) then immediately constrains it to just what he has seen (I don’t know if he means during his lifetime or where he was physically present).  Makes you think that a stock exchange has never closed for that long right?  Or, at least, not a major one.  He might be technically right that he has never seen one closed that long, but certainly it has happened.

At the start of World War I, the New York Stock Exchange closed for four and a half months, more than twice as long as the Egyptian one was closed.  One would hope that he, as chairman of the exchange (a temporary position for him, his long-term position is chairman of Ministry for Clearing and Settlement) would know this, even if he hadn’t seen it himself.


Permalink Leave a Comment

Types of photomosaics

March 8, 2011 at 10:02 pm (computers, photography)

I have come up with three variations on the photomosaic, each has its own strengths and weaknesses, but keeping them in mind will let you pick the most appropriate one for the job.  If you haven’t read my prior post on photomosaic tips, you might want to read it too.

Photo mosaic of Yellowstone Lower Falls created with hundreds of other pictures taken in Yellowstone National Park

Classic Photo mosaics

  • contain lots of small pictures
  • only a little of the original picture shows through (30% or less)
  • have to get very close to see the contents of the individual tiles
  • good when:
    • you have lots of pictures
    • Will be viewed as a large image, such as printed out at 16×20 or larger


Larger tiles are easier to see when the final images is small. Lots of the original image shows through to compensate.

Chunky Mosaics

  • Fewer, larger pictures
  • lots of the original picture shows through (60% or so)
  • can see the individual images even from a distance
  • need to be careful not to have images that are too similar.
  • good when:
    • you don’t have many pictures to use as tiles
    • Will be viewed as a small image, such as online


The central focus of this mosaic (a bison) isn't made of tiled images, the baground is.

Subject Focus

  • Fewer, larger pictures
  • main object in the picture is solid, not a mosaic
  • only a little of the original picture shows through (30% or less)
  • The background tiles are an important part of the full image
  • Can be used to show history of the objects in the foreground, for instance, a newlywed couple with the background being pictures of them together before they got married.
  • need lots of feathering so the main image fades out slowly
  • good when:
    • you don’t have many pictures to use as tiles
    • the smaller images don’t match the colors of the subject very well
    • you want the focus to be on the subject, the tiled images fill in the backstory.

Subject focus mosaics take a bit more work than the other ones. There is at least one program that can make the center of the picture more opaque than the edges, but if your subject isn’t in the exact center or is irregularly shaped it might not work. I created this picture of a bison by first making a chunky photomosaic with only 30% of the original picture showing through. I then opened the original picture in an image editing program (I use the gimp) and did a freehand select of the bison and set the “Feather Edges” option to 100 pixels. I then pasted it into the mosaic and manually aligned it (it doesn’t have to be exact). Since I wanted the fade to be more gradual on the bison’s back I selected another region from the original using the same options, but when I pasted it into the mosaic I set the opacity at 66.6%.

Permalink 1 Comment

Photo mosaic tips

March 8, 2011 at 4:33 am (computers, photography)

Photo mosaic of Yellowstone Lower Falls created with hundreds of other pictures taken in Yellowstone National Park

Photo mosaics are impressive to look at and are easy to make.  Programs automate the generation of them, all you have to do is provide lots of source images.  If you want to spend a bit of time you can have even better results, here are some tips for generating great photomosaics.  These pictures are also called PhotoTile pictures but that term seems to be falling out of use.

I use metapixel under linux to make my photomosaics, it does a great job (here’s a nice overview of how to use it).  If you are more of a Mac or Windows person, there are photomosaic programs for those operating systems too, for example Andrea Mosaic for Windows and Mac or MacOSaiX for Mac. You can also find online tools to make mosaics.

I have a post about several different types of photomosaics you can make if you are interested.

For the main picture (the one that will be made into the mosaic).
It is best to have a simple picture with a large object in the foreground. Small details or a cluttered background will either get lost or make the picture too messy.  Examples of good pictures would be a head and shoulders portrait or a single object like your house or a car that takes up most of the picture.  Examples of pictures that probably won’t turn out are your kids playing in a field or a picture of a forest.

Have large sections of distinct colors.  If your photo is mostly of shades of a single color you will use only a small number of the available images and there will be lots of repetition of pictures.  You want to have lots of contrast between the subject and the background. A portrait of a light-skinned person against a beige wall wearing a white shirt will not work well.  If you are using a picture of a person, you can easily pick a shirt that stands out against the background.

The main picture doesn’t have to be very high resolution, feel free to crop it tightly to get the overall look you want.  The example pictures in this post were cropped from much larger pictures then resized for viewing on a computer monitor.

Have a theme
Photomosaics work best when there is a strong theme and the small pictures tie in to the main one.  For example, you might have the main picture be of a place you went to on vacation.  Make all the small pictures related to that place, or that vacation (don’t have random christmas pictures from 10 years earlier mixed in).  If you are making a mosaic of a city, pick something that is large and easily recognizable.

Have lots of pictures
You can make a mosaic with just a few dozen pictures, but the more pictures you have, the better the result.  Fortunately, with digital cameras it is easy to take lots of pictures.  The mosaics also look good even when you have similar (but not identical) pictures, for instance having several pictures of the same street scene but the cars and people are in different places can still look good.

I’d recommend having hundreds of pictures, but thousands would be even better. (10’s of thousands would be better still, but you may not have that many, particularly if you are sticking to a single theme.)

You do need to make sure all the pictures are appropriate, people who look closely at the image will be able to see the individual pictures, so if you aren’t comfortable showing someone a picture, don’t include it in the mosaic.

A photo-mosaic of Big Ben, created using hundreds of photos taken in the UK.

Test and refine
You can dump all your pictures into the program and get something done in 10 minutes or so, however, with a bit of effort and experimentation you can get better results.  Generate a picture with what you have, then look at it closely and see what you do and don’t like about it.  How much repetition is there? Is there a good variety of colors?  If it is of a person, can you see the details of the face?  Based on what you find, you can play around with different size tiles, decide what kind of background you want, and decide how big the foreground object should be.  You can also see if there are any types of pictures that there aren’t enough of and you can take more pictures.

Pick a tile size
Larger photo tiles make it easier to see the individual pictures but they make the overall image blockier and harder to make out. Pick the individual tile size based on the final output size, resolution of the picture, and expected viewing distance.  I made a mosaic that I printed 20 inches by 30 inches at a resolution of 300 dpi, I made the individual tiles 150 pixels square so that the individual tiles would be half an inch.  From 15 feet away or further it looked great, you could easily see the picture.  If I were going to put it in a room that made it hard to stand that far away, I could have made them 100 pixels square (a third of an inch).  If your end product is going to be viewed on a computer monitor you may want even smaller tiles, the example photos in this post have 33×33 pixel tiles. Mosaic programs can take advantage of changes in color within a picture so it isn’t exactly like having really big pixels, but there is a limit to how well that will work so don’t count on it too much.

If you let the main image show through a little bit the result will be much, much better.  I find about 30% helps alot without making it too obvious, but play around a bit and see what you like.  You can usually adjust this in the program, but if not you can do it in the gimp afterwards.  Look at how frequently the pictures can repeat too.  It would be nice if they never did, but it is unlikely to have enough pictures to do that. You want to repeat the pictures as infrequently as possible while still having it look good.  Start with a repeat of 5 then try 10, 15, etc.

About the images:

For the yellowstone image, I took a photo of Yellowstone falls and the valley and cropped it very tightly around the waterfall.  This picture has a good balance of colors, the blue sky, white water, tan rocks, green grass, and dark trees.  If you look at the full size image you can see lots of the tiles in the sky have blue water and open sky in them.  The tan rocks got filled in with pictures of elk and thermal pools on bare rock, the green grass got flower images and the dark green trees area got nightime pictures and pictures with lots of shadow areas.  The white waterfall got lots of images with geysers erupting.  I had about 450 pictures and couldn’t go back and take more.  I also tried making a mosaic of a geyser but that looked more like a white blob on a blue background so I didn’t use it.

The original image of yellowstone falls, before cropping and turning into a mosaic.

For Big Ben I used pictures from my trip to Britain.  In the original picture the clock was just a small feature so I really had to crop to make it recognizable.  There isn’t as much of a variety of colors in the picture as I would like.  I tried 5 pictures before settling on this one.  One of my earlier choices was a picture that included an iconic red telephone booth, however, I didn’t have enough pictures with red in them so it turned out pretty grey.  Another choice that didn’t work out was Windsor Castle, when turned into a mosaic the castle walls were just a blob and weren’t very recognizable.

The original image that I used for the photomosaic of big ben.

Permalink 1 Comment

The enron corpus

March 5, 2011 at 12:16 pm (nlp)

One of the issues that people who do nlp and machine learning struggle with is getting access to large quantities of data relevant to the task they are doing. (The other issue is getting that data classified so you can use it for training). If you are interested in doing nlp, machine learning, or sentiment analysis on emails, you should know about the Enron corpus.

As part of the Enron investigation, the federal government has over 5 million emails from enron.  This database was purchased for $10,000 by Andrew McCallum, a computer scientist at the University of Massachusetts, Amherst and made freely available.  There are several versions available, you can get the raw data or as a normalized mysql database.  A small portion of it has even been annotated.

Permalink Leave a Comment