A Palaeographer’s Adventures in Programming (2)

Photo: Andreas Praefcke

Photo: Andreas Praefcke

I’ve been away from my desk for around a week, making trips to the College of Arms in London to consult some of my medieval source material. The College of Arms is a royal corporation that is responsible for all matters relating to heraldry, that is, the granting of coats of arms and the recording of pedigrees. Stepping into the College of Arms feels like being thrust (willingly) back in time. The place exudes an elegant charm that is a relaxing contrast to the busy City around it, with its bustling bankers and tourists.

      However, a two-hour train journey from London brings me back to my desk in York, staring at an open screen in MATLAB and several browser tabs displaying an array of image processing guides. I’m trying to hone my skills in pre-processing in order to prepare my images of medieval scribal hands for pattern recognition, in order to detect changes in the features of handwriting over time. If you read my last blog post, you might remember that I’d begun to remove the noise in the images so that the computer’s ‘vision’ did not get distracted by unwanted elements introduced in the process of digitisation. I also thinned out the handwriting, so that irregularities in the thickness of strokes was eliminated, and we could only see the outline of the shape. However, though this was successful with some samples, with other – thicker – strokes, this resulted in a rather confusing shape:


      To begin to rectify this and create a smoother thinned image, I applied a morphological operation – that is, an image processing operation that alters the shape of the object.  The most basic of morphological operations are ‘dilation’ and ‘erosion’, which do exactly what they sound like they do. Dilation makes an image bigger by adding pixels to the boundaries of an image, whilst erosion removes pixels. Opening and closing both combine dilation and erosion, but in different orders. Opening performs erosion first, followed by dilation, and so smooths the image by breaking down its narrow strips and eliminating any thin portions of the image. It is good for removing noise from an image, because it simplifies the image. Closing is the opposite of opening, as it first dilates the image, then erodes it. Thus, it fills small holes and gaps, smooths its contours and maintains the shape and size of the object [1]. This is useful for the following image, because it contains gaps, which are responsible for the strange shape you see above:


With closing applied, the image looks subtly different, as all of the empty pixels within the letter are filled (though, of course, the image is inverted so the filled pixels appear empty and vice versa!):


And the resultant ‘thinned’ shape is much more faithful (though still not perfect):


I’m still experimenting with ways of making the shape of medieval letters more ‘readable’ for the computer and if any of my readers have tried and tested methods of doing this, I’d happily receive advice. For now, though, I’m enjoying letting the medieval and the modern meet in different ways, with surprising and visually-pleasing results.

[1] Jayaraman, Esakkirajan, and Veerakumar, Digital Image Processing (New Delhi, Tata McGraw, 2009) p. 554


One comment

  1. […] my experience has created a handy record of what I’ve done up until now. I can see that previously I was playing with ways of processing my images of medieval handwriting, to better represent the […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: