Image processing code that I wrote as part of my masters