Image Blurrer

From UBC Wiki

Authors: XinRan Zhang, Andrew Lin

What are we doing?

Image blur is basically replacing a pixel with a weighted average of the pixel generated by a specific Filter and its surrounding pixels. Common Filters include Box Filter, Gauss Filter, Ball Filter, bilateral filters, etc.

Image blur is widely used in image reduction, data preprocessing, image noise reduction, etc.

How will we do it?

In order to simplify the calculation, we stipulate the following conditions:

1. We use linear symmetric separable filters, such as Box Filter or Gaussian filter, which means that correlation and convolve are exactly the same, we can directly use correlation

2. We use a fixed size 3*3 filter, and only consider grayscale images

3. We use zero padding for edge processing

Based on this, our algorithm follows the following steps

1. First read in the picture, and then use a suitable external library to complete the gray-scale conversion of the picture

2. Traverse each pixel in the two-dimensional array and perform correlation on the neighborhood of each pixel (This is basically an area of the same size as the Filter in the image, multiplying and summing the corresponding positions of the matrix one by one (normalization must be completed in this process)

3. Store the correlation result of each pixel in a new, two-dimensional array of the same size, and finally output

What are some of the uses of this project?

This related algorithm can not only apply Filter to pictures, but can also be used for template recognition, etc. This is the basic content of computer vision.

Similar uses also include pooling, preprocessing through a given filter before a multi-level neural network to retain two-dimensional information (rather than converting to a one-dimensional array) and extract features when digitizing pictures

What did we learn from doing this?

(This should be written after you have done the work.) What is the bottom-line? Is functional programming suitable for (part-of) the task? Make sure you include the evidence for your claims.

Links to code etc

https://github.com/XinRanZh/HasKell-Convolution