/Image-Processing

#Image Processing #Filters #Enhancement Techniques #Computer Vision #Image Analysis #Noise Reduction #Edge Detection #Histogram Adjustment #Image Quantization #Frequency Domain Processing #Binary Image Conversion #Downsampling and Upsampling #Laplacian Operator #Gaussian Filter #High Pass Filter #Low Pass Filter

Primary LanguageJupyter Notebook

1. Image Quantization

This code saves an image at different quality levels and then displays the saved images simultaneously. Its purpose is to show the impact of varying quality on the image.

Screenshot 1403-08-02 at 21 34 28

2. Convert RGB Image To Binary

This code reads an RGB image and converts it to grayscale. It then applies thresholding to convert the grayscale image into a binary image and displays both the input and output images side by side.

Screenshot 1403-08-02 at 21 35 05

3. Cropped

This code reads an image, crops a specified region, applies Gaussian blur to the cropped area, and saves the blurred image. It then displays the original, cropped, and blurred images side by side for comparison.

Screenshot 1403-08-02 at 22 32 56

4. Upsampling

This code reads an image and upsamples it by a factor of 2 using bilinear interpolation, improving its resolution. It then saves the upsampled image and displays both the original and upsampled images side by side, with axes visible for reference.

Upsampling

5. Downsampling

The provided code reads an image, downsamples it by factors of 1/2 and 1/4 using OpenCV's resize function, and displays the original and downsampled images. It checks if the image is loaded successfully before processing, ensuring that resizing operations are performed on a valid image.

Screenshot 1403-08-03 at 03 02 55

6. Change The Number Of Shades Of Gray

This code loads an RGB image, converts it to grayscale, and normalizes it to two different levels (128 and 64 shades). Finally, it displays the original image alongside the two normalized grayscale images for comparison.

Change_The_Number_Of_Shades_Of_Gray

7. Negative

This code reads a grayscale image and creates its negative, displaying both images. It also calculates and plots the histograms of the original and negative images to visualize the distribution of pixel intensities.

Input:

Negative Input

Output:

Negative output

8. Adjust Intensity Values

The code loads the original image and adjusts its color intensity using the rescale_intensity function. It then displays both the original and adjusted images side by side, with titles positioned below each image.

Adjust_Intensity_Values

9. Histogram Adjustment

The code loads a grayscale image, calculates its histogram, performs histogram equalization to enhance contrast, and computes the histogram of the equalized image. It then visualizes both the original and equalized images along with their histograms in a 2x2 grid using Matplotlib.

Histogram-Adjustment

10. Histogram Matching

The code performs histogram manipulation on an image by applying a wide Gaussian distribution with a high sigma and a low center, resulting in significant changes to pixel intensities. This transformation produces a final image that can appear drastically brighter or darker, along with a histogram that reflects these alterations.

Histogram_Matching

11. Mean Filter

This code adds Gaussian noise to the original image and then reduces that noise using a mean filter. Finally, it displays the original image, the noisy image, and the filtered image for comparison.

Mean_Filter

12. Box Filter

This code processes an input image using a box filter and displays both the original and the filtered images in separate subplots. It also checks for the existence of the file before loading the image to prevent errors.

Box Filter

13. Median Filter

This code adds Gaussian noise to an image and then reduces the noise using a median filter. Finally, it displays three images: the original image, the noisy image, and the filtered image side by side.

Median Filter

14. Min Filter

This code reads an image from a file and adds salt-and-pepper noise to it. It then filters the noisy image using a min filter (using the erosion operator) and displays three images: the original, the noisy, and the filtered one.

Min_Filter

15. Max Filter

The code reads an image, converts it to grayscale, and adds pepper noise to it. It then reduces the noise using a max filter and displays three images: the original, the noisy, and the filtered image.

Max_Filter

16. Gaussian Filter

The provided code applies a Gaussian filter to an image using OpenCV to blur it. It reads the image, creates the Gaussian filter, applies it, and then displays both the original and blurred images.

Input:

Gaussian Filter

Output:

Gaussian Filter output

17. Edge Detection

The code loads an image, converts it to grayscale, and applies various edge detection techniques (Canny, Laplacian, Sobel, and Roberts) to identify edges. It then visualizes the original image, grayscale image, and results of each edge detection method using Matplotlib subplots.

Input:

Edge Detection
EdgeDetection

Output:

Edge Detection output

18. Add_Laplacian_To_Original_Image

The provided code converts an image to grayscale and applies a Laplacian filter for edge detection. It then displays the original image, the result of the Laplacian filter, and the image after adding the Laplacian result back to the original, illustrating the impact of edge detection on image details.

Add_Laplacian_To_Original_Image

19. Sharpening Filter

This code applies a sharpening filter to the loaded image and displays the result alongside the original image. The filter is defined using a 3x3 matrix that enhances edges and increases the details of the image.

Sharpening Filter

20. Gaussian_Filter_In_Frequency_Domain

This code performs a Fourier transform on a grayscale image, visualizing both the original image and its frequency representation. It displays the Fourier transform, shifted Fourier transform, and the reconstructed image using appropriate magnitude calculations to ensure clarity and avoid loss of information.

Input:

Gaussian_Filter_In_Frequency_Domain

Output:

Gaussian_Filter_In_Frequency_Domain output

21. Butterworth High Pass Filter

This code applies a Butterworth high-pass filter to an input image and displays both the original and the filtered images. It first performs a Fourier transform on the image, designs the filter, and then obtains the final image using the inverse Fourier transform.

Input:

Butterworth High Pass Filter  input
Butterworth High Pass Filter input

Output:

Butterworth High Pass Filter out put

22. Ideal_High_Pass_Filter

This code applies an Ideal High Pass Filter to an image. It first performs a Fourier transform on the image, then removes low frequencies using a mask, and finally reconstructs the filtered image with an inverse Fourier transform.

Ideal_High_Pass_Filter ipynb

23. Inverse Filter

This code performs image processing steps using OpenCV, which include loading an image, converting it to grayscale, applying a Gaussian filter to blur the image, adding noise to the blurred image, and finally using an inverse filter to recover the original image. The results are displayed, showing the original image, grayscale image, blurred image, noisy image, and the image after applying the inverse filter.

Input:

Inverse_Filter input

Output:

Inverse_Filter output

24. Wiener Filter

This code demonstrates how to add Gaussian noise to an image, apply a Wiener filter for noise reduction, and visualize the results using Python's OpenCV and Matplotlib libraries. Finally, it displays the original image, grayscale image, noisy image, and restored image in a 2x2 grid for comparison of the effects of noise and restoration.

Input:

Wiener_Filter input

Output:

Wiener_Filter output

25. Gaussian High Pass Filter

The provided code applies a Gaussian high-pass filter to an image using OpenCV in Python. It reads an image, applies a Gaussian smoothing kernel,and then subtracts the smoothed image from the original to enhance high-frequency components, effectively highlighting edges and fine details.The results are displayed side by side for comparison between the original and filtered images.

Input:

Screenshot 1403-08-09 at 22 57 32

Output:

Screenshot 1403-08-09 at 22 57 39