Skip to content

The GrayscaleImageBoxFilter GitHub repo provides a Python script for smoothing images using a 3x3 box filter. It details setup, usage, and collaborative development practices.

Notifications You must be signed in to change notification settings

DavidGuamanDavila/GrayscaleImageBoxFilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

GrayscaleImageBoxFilter

Purpose

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.

Screenshot 2023-10-16 at 3 07 51 PM

Procedure How to Run Tasks

boxfilter.py File Procedure

Imports Required

  • Import OS
  • Import cv2
  • Import numpy

Steps to Run Program

  1. Clone the repo or fork the repo
  2. Open your terminal and cd into the repository
  3. Inside the repository depending on your terminal alias run: python3 boxfilter.py OR python boxfilter.py
  4. 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.

Screenshot 2023-10-16 at 2 57 16 PM

  1. 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:

Screenshot 2023-10-16 at 2 57 36 PM

Resultant message from the terminal:

Screenshot 2023-10-16 at 2 57 53 PM

Results on Testing First Image

Screenshot 2023-10-16 at 2 58 26 PM

The original image is on the left, and the resulting image is on the right.

Results on Testing Second Image

Screenshot 2023-10-16 at 2 58 39 PM

The original image is on the left, and the resulting image is on the right.

Results on Testing Third Image

Screenshot 2023-10-16 at 2 58 50 PM

The original image is on the left, and the resulting image is on the right.

Results on Testing Fourth Image

Screenshot 2023-10-16 at 2 59 09 PM

The original image is on the left, and the resulting image is on the right.

Results on Testing Fifth Image

Screenshot 2023-10-16 at 2 59 21 PM

The original image is on the left, and the resulting image is on the right.

Overview boxfilter.py

  1. 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.
  2. Image Padding A 1-pixel black border is added to the grayscale image to facilitate filtering.
  3. Image Filtering
  • A simple 3*3 filter matrix is applied to the image, performing a basic convolution operation.
  • The filtered output image is generated.
  1. Display Original vs. Filtered Images The original grayscale image and the filtered image are displayed side by side for comparison.
  2. Image Saving The filtered image is saved with the filename result_filtered_img.jpg

Contributions of Each Group Member

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.

About

The GrayscaleImageBoxFilter GitHub repo provides a Python script for smoothing images using a 3x3 box filter. It details setup, usage, and collaborative development practices.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages