Skip to content

C++ implementation of Gaussian blur that leverages multithreading to process BMP images in parallel segments

Notifications You must be signed in to change notification settings

wzid/multithreaded-blur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multithreaded-blur

A parallel implementation of Gaussian blur using pthreads to process the image in 4 concurrent segments. Supports 24-bit BMP files.

In a school project I was tasked with implementing multithreading to complete a specific task. Using pthreads I was able to multi-thread the process to apply a gaussian blur to a BMP image.

gif showing the process on how to blur an image

Usage

Compiling

I don't believe that pthreads is supported on Windows, so i would be aware it may only run if you are on MacOS/Linux

Just run the following:

make

Running

./blur <file_name>.bmp <blur_radius>

The resulting blurred image should be in output.bmp

Blur Process

In this implementation I used a typical gaussian blur filter for the image.

$$ G(x) =\frac{1}{2\pi\sigma^2}e^{-\frac{x^2 + y^2}{2\sigma^2}} $$

I precomputed the kernel to apply and then split the image into 4 regions for which the threads would then apply the blur.

There are better and faster ways to get the nice natural look of a gaussian blur. Many of them being related to downscaling and upscaling such as the Kawase blur.

For simplicity sake, I did not implement that :) For more information on Kawase blur check out this link:

If you would like to learn more about blur filters in general here are some helpful resources:

Final Thoughts

Doing this project made me realize how much I enjoy image processing. I may add onto this project or create a whole suite of tools for image processing someday.

About

C++ implementation of Gaussian blur that leverages multithreading to process BMP images in parallel segments

Topics

Resources

Stars

Watchers

Forks