(trajectory)
| 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" |
| 1078 | ref_path = "./data/96.jpeg" |
| 1079 | |
| 1080 | # 打开目标图像和参考图像 |
| 1081 | image = Image.open(image_path) |
| 1082 | ref_image = Image.open(ref_path) |
| 1083 | |
| 1084 | # 将图像转换为HSV颜色空间 |
| 1085 | hsv_image = image.convert('HSV') |
| 1086 | hsv_ref_image = ref_image.convert('HSV') |
| 1087 | |
| 1088 | # 将HSV图像转换为numpy数组 |
| 1089 | hsv_array = np.array(hsv_image) |
| 1090 | hsv_ref_array = np.array(hsv_ref_image) |
| 1091 | |
| 1092 | # 计算每个图像的平均饱和度(S通道的平均值) |
| 1093 | avg_saturation_image = np.mean(hsv_array[:, :, 1]) |
| 1094 | avg_saturation_ref_image = np.mean(hsv_ref_array[:, :, 1]) |
| 1095 | |
| 1096 | # 检查目标图像的饱和度是否低于参考图像的饱和度 |
| 1097 | assert avg_saturation_image < avg_saturation_ref_image, "The saturation of the image is not lower than the reference image." |
| 1098 | |
| 1099 | def test_task_97(trajectory): |
| 1100 | image_path = "./output/97.png" |
nothing calls this directly
no outgoing calls
no test coverage detected