Image Processing Techniques with PyQt5 GUI

Program output

Image Processing Project

Table of Contents
  1. Installation
  2. Introduction
  3. Objectives and scope
  4. Methodology
  5. Conclusion
  6. Contributing
  7. To Do
  8. Video Demos

📦: Installation

See the contributing guide for detailed instructions on how to get started with our project.

  1. Obtain a copy of Python 3.9
  2. Create a virtual environment & activate it.
  3. Run the following in the venv…
pip install cmake
pip install -r requirements.txt
  1. You can run the program in the venv
cd (install path)\Image_Processing\All_Project_Files\Final_Project_Files
python .\Image_Processing_Options.py


:pencil: Introduction

Edge detection is an essential part of image processing that involves finding the boundaries of objects within an image. This process can be used to extract useful information from an image, such as object recognition or feature detection. One of the most common techniques for edge detection is the Laplacian filter, which is a second-order derivative filter used to detect changes in the intensity of the image.

In this project, we will explore edge detection using the Laplacian filter and other image processing techniques such as low pass filtering (LPF), high pass filtering (HPF), and thresholding. LPF and HPF are commonly used to enhance images and remove noise, while thresholding is used to binarize an image into black and white pixels based on a certain threshold value.

The project will involve implementing these techniques and applying them to various test images to demonstrate their effectiveness in edge detection. The results will be analyzed and compared to determine the most effective approach for edge detection in different scenarios. The objectives of this project are to gain a deeper understanding of image processing techniques, specifically edge detection using the Laplacian filter, LPF, HPF, and thresholding, and to demonstrate the practical applications of these techniques in real-world scenarios.

Through this project, we hope to enhance our skills in image processing and analysis, as well as gain insights into the challenges and limitations of edge detection techniques.


:cloud: Objectives and Scope

Utilizing image processing techniques such as low-pass filtering (LPF), blurring, and other such techniques to reduce noise and improve the overall quality of the images, as well as using edge detection to define boundaries for the images' borders.

A number of different methods, including thresholding and edge detection, are utilised in the process of segmenting and extracting information from images.

The distinction between the different subcategories can be seen through the employment of a variety of user-defined functions as well as built-in functions (LPF, Edge detection, etc).


:cloud: Methodology

The methodology for this project involved several steps, including image acquisition, image preprocessing, edge detection using the Laplacian filter, LPF, HPF, and thresholding, and analysis of the results. The first step in the methodology was to acquire test images to be used in the project. These images were chosen based on their complexity and variability to test the effectiveness of the different edge detection techniques.

The second step was image pre-processing, which involved applying noise reduction techniques such as median filtering and histogram equalization to enhance the quality of the images. This was done to ensure that the edge detection techniques were applied to clear and high-quality images.

The third step was edge detection using the Laplacian filter, LPF, HPF, and thresholding techniques. The Laplacian filter was applied to detect edges by finding changes in the intensity of the image, while LPF and HPF were used to remove noise and enhance the edges. Thresholding was used to binarize the image into black and white pixels based on a certain threshold value.

Finally, the results were analyzed and compared to determine the most effective approach for edge detection in different scenarios. This involved visually comparing the different edge detection techniques and evaluating their accuracy in detecting edges.

Overall, the methodology for this project was a combination of image acquisition, pre-processing, edge detection using the Laplacian filter, LPF, HPF, and thresholding, and analysis of the results to determine the effectiveness of each technique in edge detection.


:small_orange_diamond: Down Sampling

Down Sampling:

• The process of resampling in a multi-rate digital signal processing system is referred to as down sampling, compression, and decimation in digital signal processing.

• Both down sampling and decimation can refer to the full process of bandwidth reduction (filtering) and sample-rate reduction, or they can be used interchangeably with the term compression.

• The technique produces an estimate of the sequence that would have been generated by sampling the signal at a lower rate when applied to a sequence of samples of a signal or a continuous function (or density, as in the case of a photograph).

• In down-sampling technique, the number of pixels in the given image is reduced depending on the sampling frequency. Due to this, resolution and size of the image decreases.

• Output:

image


:small_orange_diamond: Up Sampling

Up Sampling:

• Up sampling, expansion, and interpolation are terminologies used to describe the resampling procedure in a mult-irate digital signal processing system.

• Up sampling can refer to either expansion or the full expansion and filtering process (interpolation).

• Up-sampling technique increases the resolution as well as the size of the image. • Some commonly used up-sampling techniques are:

· Nearest neighbour interpolation · Bilinear interpolation · Cubic interpolation

• Output:

image


:small_orange_diamond: Negative of an Image

Negative of an Image:

• Photographic negative in which the light areas of the subject are reproduced as dark and the dark areas as light.

• Negatives typically take the form of a transparent material, such glass or plastic.

• These tones are reversed and result in a positive photographic print when sensitised paper is exposed through a negative, which can be achieved either by placing the negative and paper in close proximity or by projecting a negative image onto the paper.

• s = (L-1) – r, where L= number of gray levels

• Output:

image


:small_orange_diamond: Thresholding

Thresholding:

• Thresholding is a type of image segmentation, where we change the pixels of an image to make the image easier to analyze.

• In thresholding, we convert an image from colour or grayscale into a binary image, i.e., one that is simply black and white.

• Image thresholding is a simple, yet effective, way of partitioning an image into a foreground and background.

• We use two types of thresholding i.e. with and without background.

• Output:

Thresholding with background:

image

Thresholding without background:

image


:small_orange_diamond: Blurring

Blurring an image makes the image look less sharp.

• This can be done by smoothing the color transition between the pixels.

• When we blur an image, we make the colour transition from one side of an edge in the image to another smooth rather than sudden.

• The effect is to average out rapid changes in pixel intensity.

• We subtract the maximum pixel value(255) from the given image’s matrix.

• Output:

image


:small_orange_diamond: Low Pass Filtering (LPF)

Low Pass Filtering (LPF):

• It is also known as a smoothing filter. It removes the high frequency content from the image.

• Example of Low pass averaging filter mask is as shown:

image

• Output:

image


:small_orange_diamond: Gaussian Noise

Gaussian Noise:

• A Gaussian Filter is a low pass filter used for reducing noise (high frequency components) and blurring regions of an image.

• The filter is implemented as an Odd sized Symmetric Kernel (DIP version of a Matrix) which is passed through each pixel of the Region of Interest to get the desired effect.

• Output:

image


:small_orange_diamond: Facial Feature Detection

Facial Feature Detection:

Facial feature detection is a computer vision technique that identifies and locates the key features of a human face in an image, such as eyes, nose, mouth, eyebrows, etc. It can be used for various applications such as face recognition, emotion analysis, face editing, and more. This python program performs facial feature detection using the following steps:

  • Load an image file as input
  • Convert the image to grayscale
  • Detect faces in the image using a pre-trained Haar cascade classifier
  • For each detected face, draw a bounding box around it.
  • Detects facial features in each face using a pre-trained shape predictor model (eye haarcasacade classifier).
  • Display the output image with the detected faces and facial features highlighted.

• Output:

image


:small_orange_diamond: Laplacian Filter

Laplacian Filter:

• A Laplacian filter is an edge detector used to compute the second derivatives of an image, measuring the rate at which the first derivatives change. This determines if a change in adjacent pixel values is from an edge or continuous progression.

• Laplacian filter kernels usually contain negative values in a cross pattern, centered within the array. The corners are either zero or positive values. The center value can be either negative or positive.

• Output:

image


:small_orange_diamond: Conclusion

Conclusion:

• In conclusion, the project demonstrated the effectiveness of edge detection techniques using the Laplacian filter, LPF, HPF, and thresholding.

• The results showed that the Laplacian filter was the most effective technique for edge detection, with high accuracy in detecting edges in various test images. LPF and HPF were also effective in enhancing the edges and removing noise, respectively, which resulted in more accurate edge detection using the Laplacian filter. Thresholding was found to be less effective in detecting edges, but was still useful in binarizing the image for further analysis.

• The project also highlighted the importance of image pre-processing in edge detection, as the quality of the input image significantly impacted the accuracy of the results. The application of preprocessing techniques such as median filtering and histogram equalization was found to be critical in improving the quality of the images.

• Overall, the project provided valuable insights into the practical applications of edge detection techniques in image processing and analysis. The results demonstrate the potential of these techniques for a range of applications, from object recognition to feature detection. The limitations and challenges of these techniques were also discussed, providing insights for future research and development in this area.


Contributing

See the contributing guide for detailed instructions on how to get started with our project.

If you’re looking for a way to contribute, you can scan through our existing issues for something to work on. When ready, check out Getting Started with Contributing for detailed instructions.

Click on these badges to see how you might be able to help:

GitHub repo Issues
GitHub repo PRs
GitHub repo Merged PRs

Simple terms:

  1. Fork this repository
  2. Create a branch
  3. Commit your changes
  4. Push your commits to the branch
  5. Submit a pull request


To Do

  • Refine UI more, add Video processing and Erosion/Dilation features (Feature Request).
  • Improve Documentation, refine Sphinx structure and docs.
  • Add Dep Tree visualization
  • Try creating a Release if possible, explore PyQt5 .exe format export.
  • Show directory structure of the project.

In Progress

  • Showing user, which file to run as main file - portraying user flow.
  • Update documentation and make it relevant to sphinx comment format.

Done ✓

  • Add exceptions to prevent program from crashing when user opens window to select input image but clicks on the close button of the window; same with Save as button.
  • Add Facial Feature Detection Button.
  • Add a Video demo in the form of Gif Link for viewers to easily see the working.
  • Adding Save as button
  • Improve README guides, contributing guides, etc.


Video Demos

The entire project demo can be seen here - https://youtu.be/O-x44AT6ylU

  • Down Sampling
  • Up Sampling
  • Negative of an Image
  • Thresholding With Background
  • Thresholding Without Background
  • Blurring
  • Low Pass Filtering (LPF)
  • Gaussian Noise
  • Facial Feature Detection
  • Laplacian Filter
  • Down Sampling

    Down_Sampling_Demo

    Up Sampling

    Up_Sampling_Demo

    Negative of an Image

    Negative_Image_Sampling_Demo

    Thresholding With Background

    Thresholding_With_Background_Demo

    Thresholding Without Background

    Thresholding_Without_Background_Demo

    Blurring

    Blurring_Demo

    Low Pass Filtering (LPF)

    LPF_Demo

    Gaussian Noise

    Gaussian_Demo

    Facial Feature Detection

    Facial_Feature_Detection_Demo

    Laplacian Edge Detection

    Laplace_Edge_Detection_Demo

    Skills Utilized:

    • Qt Creator
    • PyQt5
    • OpenCV
    • NumPy
    • Graphical User Interface (GUI)
    • Qt
    • Python (Programming Language)
    • Pandas
    • Git
    • Machine Learning

    This project provided hands-on experience in image processing techniques, GUI development, and integrating various Python libraries. It serves as a foundation for further exploration in the field of image processing and computer vision.

    Srihari Thyagarajan
    Srihari Thyagarajan
    B Tech AI Senior Student

    Hi, I’m Haleshot, a final-year student studying B Tech Artificial Intelligence. I like projects relating to ML, AI, DL, CV, NLP, Image Processing, etc. Currently exploring Python, FastAPI, projects involving AI and platforms such as HuggingFace and Kaggle.