Image Filtering Applications with Parallel Programming
Hello everyone. This project includes 4 different applications. Each application performs filtering operations using different parallelism techniques. Now let's examine the applications together. You can follow my Github account for source codes:
Technologies
- MPI
- OpenMP
- C++
Parallel Programming
Parallel Programming, in simple terms, is the simultaneous use of multiple computational resources in solving a problem.
- Multiple processors are used in solving the problem.
- The problem is divided into different parts to be solved concurrently.
- Each part is divided into different command series.
- Commands are processed simultaneously on different processors.
In this project, each application performs filtering operations using different parallelism techniques. To run the applications, you need to have Ubuntu operating system. If you don't want to install it on your computer, you can install it in a VirtualMachine virtual environment and run it. Since all applications use the same image and matrices, the process was done through a single image, image matrix and script file.
filter1 Application
We open a terminal in Ubuntu and go to the directory where the project is located. As the first step to run the filter1.cpp application;
g++ filter1.cpp
we create an a.out file. Now we need to process our image matrix to obtain a filtered image matrix. For this;
./a.out GoruntuMatrisi1.txt
we write and obtain the GoruntuMatrisi1_filtered.txt file, which is the filtered image matrix. We will use this matrix to obtain the filtered image.
Now we will obtain the filtered image by running the script file. Before doing this operation, we need to install the possible packages that we will encounter. For this, we need the octave package. You can follow the steps below to download.
sudo add-apt-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave
After finishing the package installations, we can complete the last step of our project.
./Proje1Script.sh GoruntuMatrisi1_filtered.txt
After running, the original Goruntu1.bmp image and the filtered image will be as follows.


filter2 Application
In this application, as a different technique MPI library was used. MPI is a platform used for parallel programming purposes. MPI is basically based on running the same program on multiple computers and during this execution, programs communicate with each other and transfer data from each other. With MPI, we can distribute our work to computers as well as run multiple jobs (processes) on a single computer. Therefore, for example, in an environment with 10 computers, if 3 jobs are run on each computer, a total of 30 jobs will be executed. This means our program must behave as if it's running on 30 different computers.
We open a terminal in Ubuntu and go to the directory where the project is located. As the first step to run the filter2.cpp application, we need to download the necessary MPI library. You can perform the following operations sequentially:
sudo apt install libmpich-dev
sudo apt install libopenmpi-dev
After completing the download operations, we can run our project. First;
mpicxx filter2.cpp
we create an a.out file. Then;
mpi run -np 4 ./a.out
You can write any even number instead of 4 depending on how many times you want the program to run. After this process, we will obtain the matrix of the filtered image. Then;
./Proje1Script.sh GoruntuMatrisi1_filtered.txt
we obtain the filtered image by writing the command. The results will be as follows.


filter3 Application
This application was also written using the MPI library. Its operation is sequentially;
mpicxx filter3.cpp
mpi run -np 4 ./a.out
./Proje1Script.sh GoruntuMatrisi1_filtered.txt
And the result;


filter4 Application
In this application, the OPENMP library was used. OpenMP is an API that facilitates parallel programming work. Its working principle is to branch in parts that need to be processed in parallel, work in parallel, and merge again when the process is finished. To be able to use it in our application, we must first make the necessary downloads.
sudo apt-get install libomp-dev
After completing our downloads smoothly, we can run the application.
g++ filter4.cpp -fopenmp
./a.out GoruntuMatrisi1.txt
./Proje1Script.sh GoruntuMatrisi1_filtered.txt
After running, the original and filtered image will be as follows:

