Untitled
unknown
python
2 years ago
966 B
5
Indexable
import cv2 import numpy as np # List of file paths for the images to analyze image_paths = ["image1.jpg", "image2.jpg", "image3.jpg"] # Threshold for determining if an image is blurry threshold = 100 # List of blurry images blurry_images = [] # Iterate through the list of image paths for path in image_paths: # Read the image image = cv2.imread(path) # Convert the image to grayscale gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Compute the Laplacian of the image laplacian = cv2.Laplacian(gray, cv2.CV_64F) # Compute the absolute value of the Laplacian abs_laplacian = np.abs(laplacian) # If the max value of the absolute Laplacian is less than the threshold, # the image is considered blurry if abs_laplacian.max() < threshold: # Add the image to the list of blurry images blurry_images.append(image) # Print the list of blurry images print(blurry_images)
Editor is loading...