Smoothing is an image processing technique used to blur, remove small details and reduce the noise of an image. There are different filter types, such as linear and non-linear. The filter for this project was a 3*3 box filter. The box filter is the mean of the neighbouring pixel intensities. In this project, we explore how the box filter affects different images.
- Import OS
- Import cv2
- Import numpy
- Clone the repo or fork the repo
- Open your terminal and cd into the repository
- Inside the repository depending on your terminal alias run: python3 boxfilter.py OR python boxfilter.py
- Type the path of the image you want to open. For example: ~/Documents/trial.jpeg. Then the image will be displayed in the grayscale mode.
- In the background, filtering is performed. The new image is saved, and both the original grayscale and the filtered image will be displayed.
Example of a padded image:
Resultant message from the terminal:
The original image is on the left, and the resulting image is on the right.
The original image is on the left, and the resulting image is on the right.
The original image is on the left, and the resulting image is on the right.
The original image is on the left, and the resulting image is on the right.
The original image is on the left, and the resulting image is on the right.
- User Image Input, Path Validation & Grayscale Conversion The user provides the file path of an image. Also, the code checks if the file path is valid. Finally, using OpenCV, the image is loaded and displayed in grayscale mode.
- Image Padding A 1-pixel black border is added to the grayscale image to facilitate filtering.
- Image Filtering
- A simple 3*3 filter matrix is applied to the image, performing a basic convolution operation.
- The filtered output image is generated.
- Display Original vs. Filtered Images The original grayscale image and the filtered image are displayed side by side for comparison.
- Image Saving The filtered image is saved with the filename result_filtered_img.jpg
Both Aabir Basu and Anton Guaman worked to complete this project collaboratively by following the extreme programming methodology, most notably that of pair programming. All project requirements were distributed equally among the two group members through a mutual understanding of each other's strengths and schedules. All deliverable code was continuously peer-reviewed to ensure that development did not regress. Issues were made at each stage before a feature was added, helping the group keep track of what needed to be done and what was already implemented.