(trajectory)
| 1051 | assert contrast_image < contrast_ref_image, "The contrast of the image is not lower than the reference image." |
| 1052 | |
| 1053 | def test_task_95(trajectory): |
| 1054 | image_path = "./output/95.png" |
| 1055 | ref_path = "./data/95.jpeg" |
| 1056 | |
| 1057 | # 打开目标图像和参考图像 |
| 1058 | image = Image.open(image_path) |
| 1059 | ref_image = Image.open(ref_path) |
| 1060 | |
| 1061 | # 将图像转换为灰度图 |
| 1062 | gray_image = image.convert('L') |
| 1063 | gray_ref_image = ref_image.convert('L') |
| 1064 | |
| 1065 | # 将灰度图转换为numpy数组 |
| 1066 | gray_array = np.array(gray_image) |
| 1067 | gray_ref_array = np.array(gray_ref_image) |
| 1068 | |
| 1069 | # 计算每个图像的对比度(标准差) |
| 1070 | contrast_image = np.std(gray_array) |
| 1071 | contrast_ref_image = np.std(gray_ref_array) |
| 1072 | |
| 1073 | |
| 1074 | assert contrast_image > contrast_ref_image, "The contrast of the image is not lower than the reference image." |
| 1075 | |
| 1076 | def test_task_96(trajectory): |
| 1077 | image_path = "./output/96.png" |
nothing calls this directly
no outgoing calls
no test coverage detected