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