MCPcopy Create free account
hub / github.com/Gen-Verse/OpenClaw-RL / decrease_brightness

Function decrease_brightness

gui-rl/desktop_env/evaluators/metrics/gimp.py:85–102  ·  view source on GitHub ↗
(image1_path: str, image2_path: str)

Source from the content-addressed store, hash-verified

83
84
85def 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
105import cv2

Callers

nothing calls this directly

Calls 2

calculate_brightnessFunction · 0.85
openMethod · 0.80

Tested by

no test coverage detected