MAT1750: An Image Manipulation Challenge

Charlene Chu - November 13, 2017

Problem

The image at http://drorbn.net/bbs/show?shot=17-1750-171016-111042.jpg is pathetic. Can you improve it? Whatever you do, should also work well with all other images at http://drorbn.net/bbs/show.php?prefix=17-1750.

Solution

First we will convolve the image using the mBlur convolution matrix to take the average of all the pixels around a given pixel. This will make image blurry. We will then subtract the blurriness from the original image. This will solve our problem. However, we can do better by making the image printable. To save toner and/or ink cartridge costs, we will negate the colour of the image so we have a white background. We will also make the image black and white so we don’t waste money on coloured ink (if the printer prints in colour). But, we can do better by getting rid of the noise. Since 1 represents white and 0 represents black in the image data, we can “round” the numbers in the image data to get rid of the noise. Here, we round up if the number is greater than 0.9 and round down otherwise.

MakePrintable[img_Image]:=Module[{n=25,mBlur},
mBlur=ConstantArray[1/(n^2),{n,n}];
Image[(ImageData[ColorConvert[ColorNegate[Image[ImageData[img]-ImageData[ImageConvolve[img,mBlur]]]],"Grayscale"]]//. x_Real :> If[x>0.9,1,0])]
];

Examples

Here are some examples.

img1=;

MakePrintable[img1]

img2=;

MakePrintable[img2]