Saturday, May 19, 2012

Automatically extracting bomb drops from the Blitz Bomb Census maps

I just finished Blackout by Connie Willis and I was wondering where she did get all the exact times when the air raids of The Blitz were happening.
I am curious because I was thinking that a timeline map would give a visual effect of the huge destruction and hard times the Londoners had to go through...so I googled for it and found the following:
Both examples show nice data visualization opportunities, but they both show how difficult it is to obtain data. Digital access to historical data could triggers a blossoming of applications!

Anyway I experimented with the little map from the first blog and wrote a little program using SimpleCV.

This is were I started from:
and this is what I got (without too much work, I must admit):


The code is quite simple and the parameters could be changed to get higher accuracy.

blz = Image("./sampleimages/the_blitz.png")
img = blz.copy()
dist = img.colorDistance(SimpleCV.Color.WHITE)
dist.dilate(2)

segmented = dist.stretch(240, 255)
blobs = segmented.findBlobs()
if blobs:
 circles = blobs.filter([b.isCircle(0.6) for b in blobs])
 for c in circles:
  img.drawCircle((c.x, c.y),
                 c.radius(),
                 SimpleCV.Color.YELLOW,
                 2)
 img.show()