(trajectory)
| 984 | assert os.path.exists(image_path) |
| 985 | |
| 986 | def test_task_92(trajectory): |
| 987 | image_path = "./output/92.png" |
| 988 | ref_path = "./data/92.jpeg" |
| 989 | |
| 990 | # 打开目标图像和参考图像 |
| 991 | image = Image.open(image_path) |
| 992 | ref_image = Image.open(ref_path) |
| 993 | |
| 994 | # 将图像转换为灰度图 |
| 995 | gray_image = image.convert('L') |
| 996 | gray_ref_image = ref_image.convert('L') |
| 997 | |
| 998 | # 将灰度图转换为numpy数组 |
| 999 | gray_array = np.array(gray_image) |
| 1000 | gray_ref_array = np.array(gray_ref_image) |
| 1001 | |
| 1002 | # 计算每个图像的平均亮度 |
| 1003 | avg_brightness_image = np.mean(gray_array) |
| 1004 | avg_brightness_ref_image = np.mean(gray_ref_array) |
| 1005 | |
| 1006 | assert avg_brightness_image < avg_brightness_ref_image, "The brightness of the image is not lower than the reference image." |
| 1007 | |
| 1008 | def test_task_93(trajectory): |
| 1009 | image_path = "./output/93.png" |
nothing calls this directly
no outgoing calls
no test coverage detected