Image Processing
using MPI
Parallel Computing project
Image Processing using MPI
This project uses the MPI library to do image processing in multi-processor.
This project uses a Gaussian blur filter, Edge detection, Median, Global and
Local Thresholding.
readImage function:
this function reads an image from a file specified by the filePath to
- It opens the file in binary mode and reads its content into a vector of
unsigned characters.
MPI Initialization:
- The program initializes MPI using MPI_Init.
- It retrieves the rank of the current process (rank) and the total
number of processes (size).
Broadcasting Image Dimensions:
- The image dimensions (number of rows and columns) are
determined on process 0 (rank 0).
- These dimensions are broadcast to all other processes using
MPI_Bcast.
Dividing Rows Among Processes:
The image rows are divided among processes based on the total number
of processes.
- Each process computes its start and end row indices.
Scattering Image Data:
- Process 0 scatters the image data (grayscale pixels) to other processes
using MPI_Scatter.
- Each process receives a portion of the image (local to that process)
stored in local_image.
Gathering Thresholded Images:
- The thresholded local images are gathered back to process 0
using MPI_Gather.
- Process 0 reconstructs the global thresholded image
(thresholded_image).
Saving the Result:
- If process 0, it saves the global thresholded image to a file
named "local_thresholded_image.jpg".
MPI Finalization:
The program finalizes MPI using MPI_Finalize.
Adaptive Thresholding:
. Broadcasting Image Dimensions:
- The image dimensions (number of rows and columns) are
determined on process 0 (rank 0).
- These dimensions are broadcast to all other processes using
MPI_Bcast.
Dividing Rows Among Processes:
- The image rows are divided among processes based on the total
number of processes.
- Each process computes its start and end row indices.
Scattering Image Data:
- Process 0 scatters the image data (color pixels) to other processes
using MPI_Scatter.
- Each process receives a portion of the image (local to that process)
stored in local_image.
Median Filtering:
- The medianBlur function applies a median filter to the local
color image (local_image).
- Median filtering replaces each pixel value with the median
value of its neighborhood.
- This helps reduce noise and preserve edges in the image.
Gathering Filtered Images:
- The filtered local images are gathered back to process 0 using
MPI_Gather.
- Process 0 reconstructs the global filtered image
(filtered_image).
Saving the Result:
- If process 0, it saves the global filtered image to a file named
"median_filtered_image3.jpg".
Team members:
Doaa Khaled Nada Rabie
Aml Ahmed Rehab Mohamed
Aya Masoud Shrouk Khamis