(image1_path: str, image2_path: str)
| 83 | |
| 84 | |
| 85 | def decrease_brightness(image1_path: str, image2_path: str) -> float: |
| 86 | def calculate_brightness(image): |
| 87 | # Convert the image to grayscale mode |
| 88 | grayscale_image = image.convert("L") |
| 89 | |
| 90 | # Get the image data |
| 91 | pixels = list(grayscale_image.getdata()) |
| 92 | |
| 93 | brightness = sum(pixels) / len(pixels) |
| 94 | return brightness |
| 95 | |
| 96 | image1 = Image.open(image1_path) |
| 97 | image2 = Image.open(image2_path) |
| 98 | |
| 99 | brightness1 = calculate_brightness(image1) |
| 100 | brightness2 = calculate_brightness(image2) |
| 101 | |
| 102 | return 1 if brightness1 > brightness2 else 0 |
| 103 | |
| 104 | |
| 105 | import cv2 |
nothing calls this directly
no test coverage detected